Hello again,
I am trying to use a series of commands to convert an R dataframe to a Synapse table. This is just a test, as I'm developing a high throughput (or more accurately, not manual) pipeline to convert and merge .csv files into Synapse tables:
schema=TableSchema(df_name,'syn1867134',colnames(df))
df_table=Table(schema,df)
synStore(METADATA_table)
When I try to sync this table to synapse using synStore, I get the following error:
Will wait for 1 seconds then retry. Press CTRL+C to quit.Error encountered: {"reason":"java.lang.NumberFormatException: For input string: \"individual id\""}. Will wait for 1 seconds then retry. Press CTRL+C to quit.
Google tells me that it's likely due to the presence of NAs (and their improper handling) of the individual id column in my dataframe, df. However, none of these columns are missing values.
I do know that this column is "character" by this command
coltypes=sapply(df,class)
Result for Individual ID: "character"
I suspect I'm getting this error because I am either not explicitly defining column data types, or because of some behind the scenes handling.
Can anyone suggest a fix? Thanks!
Created by Laura Sloofman lauragails @lauragails: would you please run `sessionInfo()` and post the output so we can see what version of the R client you are using?
If the version is NOT 1.14, then when you first load the package are you prompted to upgrade the package to 1.14-2? This issue was noted here and should be transient: https://sagebionetworks.jira.com/browse/SYNR-1066
**Can you confirm the version of the R client you're using?**
I'm going to loop in @brucehoff in this conversation - if this is a recurrent problem with an older version of the client, we may want to take further action.
Odd follow-up table uploading error:
I am now creating a table that is loading properly into Synapse, and Synapse is giving me the following error:
```
Error in getS4ClassNameFromSchemaName(concreteTypeSchemaName) :
No S4 class name for org.sagebionetworks.repo.model.table.TableUpdateTransactionRequest
Calls: synStore ... createS4ObjectFromList -> getS4ClassNameFromSchemaName
```
Lines that might be helpful for debugging are:
```
tc=as.tableColumns(data)
df_name='binary_metadata'
schema=TableSchema(df_name, 'syn7077749', tc$tableColumns)
df_table=Table(schema,data)
synStore(df_table)
```
FYI I was able to load my desired table manually. I have done so and stored it in: syn8219728
Thanks! https://www.synapse.org/#!Synapse:syn5637528/discussion/threadId=765&replyId=7521
I don't think as.tableColumns is working correctly (or I'm doing it wrong).
I am running these series of commands (METADATA is a data frame that should have no null values - here null is a string. I did a systematic replace to replace any "true" nulls with an NA string)
tc <- as.tableColumns(METADATA)
schema <- TableSchema(METADATA,metadata_table_directory, tc$tablecolumns)
METADATA_table=Table(schema,METADATA)
synStore(METADATA_table)
These are the errors I get as a result:
Error: HTTP Error: 400 for request https://repo-prod.prod.sagebase.org/repo/v1/entity
{"reason":"Invalid Entity name: '{\"Neuropath\":[],\"Antipsychotic-Free (weeks)\":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
In addition: Warning messages:
1: In if (pathIndex > 0) { :
the condition has length > 1 and only the first element will be used
2: In if (paramIndex > 0) { :
the condition has length > 1 and only the first element will be used
3: In charToRaw(object) :
argument should be a character vector of length 1
all but the first element will be ignored
4: In if (!(uri == "/version")) { :
the condition has length > 1 and only the first element will be used
I created a dummy dataframe and table using the same series of commands (1 column named hi with entries c(1,2,3,4) and got the following error:
> synStore(df_table)
Error: HTTP Error: 400 for request https://repo-prod.prod.sagebase.org/repo/v1/entity
{"reason":"Invalid Entity name: '{\"hi\":[1,2,3,4]}'. Entity names may only contain: letters, numbers, spaces, underscores, hypens, periods, plus signs, and parentheses"}
The name as.tableColumns should have picked up would be simply "hi", based on the structure of my dummy dataframe. FYI I tried tc$tablecolumns and tc$tableColumns, if that makes a difference.
Thanks again. Indeed, I tested and confirmed the error you get. I filed a bug report to report a more informative error message in this case:
https://sagebionetworks.jira.com/browse/SYNR-1052
If there is a point in any documentation that you were following that led you down this path, let me know as well so I can address that too. Thanks! In this case, you need to first run `as.tableColumns` on `df`:
```
tc <- as.tableColumns(df)
schema <- TableSchema(df_name, 'syn1867134', tc$tablecolumns)
```
Quite a cryptic error message, I'll take a look and see if I can reproduce.
Drop files to upload
Converting R dataframe to Synapse table page is loading…