Hello,
I am tying to read R data files (.RData) into Alteryx. I use this code in the R tool:
write.Alteryx(readRDS("C:/Users/user/Desktop/Alteryx Data/July 2018, Single Cell Exp/ALL_8_SAMPLES/Riley_1904_170.RData"), 1)
This error gets returned
Error: R (1): Error in readRDS("C:/Users/user/Desktop/Alteryx Data/July 2018, Single Cell Exp/ALL_8_SAMPLES/Riley_1904_170.RData") :
Info: R (1): unknown input format
Info: R (1): Calls: write.Alteryx -> readRDS
Error: R (1): Execution halted
Error: R (1): The R.exe exit code (1) indicated an error.
What am I missing? Thanks for the help!
Solved! Go to Solution.
Thanks Be,
The file path name was correct, but I changed the file name to remove the ',' and redid the code as suggested:
write.Alteryx(readRDS("C://Users//creily//Desktop//Alteryx Data//July 2018 Single Cell Exp//Riley_1904_170.rds"),1)
I received this new error this time.
Error: R (1): Error in as.list.default(X) :
Info: R (1): no method for coercing this S4 class to a vector
Info: R (1): Calls: write.Alteryx ... encodeForWrite -> sapply -> lapply -> as.list -> as.list.default
Error: R (1): Execution halted
Error: R (1): The R.exe exit code (1) indicated an error.
What is the tool you referenced that can read in a R data file?
The normal input tool does not seem to recognize this RData file type.
I did remove the writeAlteryx part, and the R script ran without errors. However, with the Browse tool, there was no saved data. While running, I saw the data go through the message box, so it was reading it. Is there a way to store it? I tried:
test.obj <- readRDS("C~...")
But that did not store it in the object.
The initial R error is saying that the RData contains an S4 class - meaning it's probably a complex object and not a simple table. Can you check what the object structure looks like in R/RStudio?
obj <- readRDS(...)
str(obj)
After that you have to figure out which part of the object you want to import to Alteryx and/or convert it to a dataframe if necessary.
For example:
table <- obj@dat
write.Alteryx(as.data.frame(table),1)
It's possible that the RData contains a more complicated structure so you'll have to determine what/how to extract it.
Got a response from DavidxL that showed up in my email, but not on this discussion page. The RData matrix is a complex object, so I will try and pull in each sub-matrix within it and try to assign to some objects. Will probably generate more questions!
The database in R I was working with is a S4 class type, so Alteryx had no ability to properly extract. I do some pre-transformations on the data in R, and then extract the sub-matrices of interest out as separate files that are more readable. Thanks!