community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
SOLVED

Trying to read RData file into Alteryx

Highlighted
Asteroid

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!

Alteryx Certified Partner
Alteryx Certified Partner
Does the readRDS code itself work fine in R? I believe when using filepaths you must escape forward slashes so every / should actually be //

Also is the comma supposed to be in the filepath?

As an alternative you may wish to try reading this file type into Alteryx with a standard input data tool, when you navigate to try and find your file it won't show, but at the bottom of the menu where it says 'all data files, change this option to 'all files' and your rdata file should then appear.

Ben
Asteroid

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.

Asteroid

What is the tool you referenced that can read in a R data file?

Alteryx Certified Partner
Alteryx Certified Partner
Try using just a normal input data tool.

As for the error, what type of object does the readRDS() function create with your file? Again my question would be does this work without the write.alteryx piece?
Asteroid

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.

Comet

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.

Asteroid

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!

Asteroid

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!

Labels