When You install Synapser, You may encounter a similar error:
$ R CMD BUILD .
Execution halted
ERROR: configuration failed for package ‘synapser’
* removing ‘/private/var/folders/2n/xwh21m9s3sq_mhnkbc6n6z_c0000gn/T/RtmpZ47UPP/Rinstf55478c3f09/synapser’
For this error, You can try first remove $HOME.virtualenvs then run the build command again.
When you build synapser, you may encounter the following error:
$ R CMD BUILD .
Error: processing vignette 'upload.Rmd' failed with diagnostics:
No credentials provided.
--- failed re-building ‘upload.Rmd’
First, create a file named .synapseConfig
in your home
directory. Then add the following lines to the file:
[authentication]
authtoken = <authtoken>
Now, you should be able to build Synapser.
Synapser is compatible with reticulate and the two packages can be used together in the same R session.
If you are getting this kind error:
synStore(tmp2)
Error in value[[3L]](cond) : 'concreteType'
As of synapser v2.0.0, it is still only compatible with reticulate
v1.28 due to a miscellaneous update in reticulate
v1.29. Specifically, py_to_r()
now succeeds when
converting subtypes of the built-in Python types (e.g. list, dict, str).
Please install reticulate v1.28.
remotes::install_github('rstudio/reticulate@v1.28')
As a workaround, if you wish to communicate with Synapse in an R session that also uses reticulate, you can use the Synapse Python client direclty through reticulate.
The core of the Synapser library is the python client. Reticulate is used to translate R to Python and back.
These are the documented conversions from R to Python: Reticulate Type Conversions
NA
values in R do not have a direct equivalent in
Python. This has been a topic of great discussion. Synapser is not
trying to solve this. NA
values in R are handled by
Reticulate per the implementation defined in Reticulate.
When working with R and Reticulate, NA values in types tables are converted by Reticulate depending on the data type.
For numeric data types, NA values are converted to the corresponding
R value NA_real_
. For integer data types, NA values are
converted to NA_integer_
. For logical data types, NA values
are converted to NA_logical_
. For character data types, NA
values are converted to NA_character_
.
In addition, Reticulate also converts any values that cannot be
coerced to the specified data type to NA_character_
.
Reticulate performs these conversions automatically.
When Reticulate converts R objects to Python objects, the NA values
in R types tables are converted to Python’s None
.
R’s NA
is a logical constant of length 1 which is used
to represent the absence of a value. In Python, the equivalent of
NA
is None
, which is a special constant used
to indicate the absence of a value.
Reticulate automatically converts NA
values in R types
tables to None
when converting R objects to Python. This
ensures that the data types and values remain consistent between the two
languages.
Examples:
NA
s to Python
True
, which convert back to TRUE
in R
na_logical = NA
class(na_logical)
## [1] "logical"
na_py <- reticulate::r_to_py(na_logical)
na_py
## True
na_r <- reticulate::py_to_r(na_py)
na_r
## [1] TRUE
na_logical = c(T, F, NA)
class(na_logical)
## [1] "logical"
na_py <- reticulate::r_to_py(na_logical)
na_py
## [True, False, True]
na_r <- reticulate::py_to_r(na_py)
na_r
## [1] TRUE FALSE TRUE
NA
s to Python strings,
which convert back to characters in R
na_char = c("T", "F", NA)
class(na_char)
## [1] "character"
na_py <- reticulate::r_to_py(na_char)
na_py
## ['T', 'F', 'NA']
na_r <- reticulate::py_to_r(na_py)
na_r
## [1] "T" "F" "NA"
NA
s to Python
np.nan
, which convert back to NA
in R