Closed ValentinChCloud closed 6 years ago
Yes, we can do this on the R side, but the function python.call of rPython library, will return :
On the R side it could look like
library('rPython')
python.load("/usr/local/bin/get_user_history.py")
x <- python.call("user_history",history_id)
v<-list()
# If the first element is not a list, it's mean only one dataset
if(is.list(x[[1]]) == FALSE) {
if(x$'extension' == 'csv'){
name<-paste(x$'hid',x$'name')
id<-unname(x$'hid')
v[[name]]<-id
}
}else{
l=length(x)
for (y in 1:l){
if(x[[y]]$'extension' == 'csv'){
name<-paste(x[[y]]$'hid',x[[y]]$'name')
id<-unname(x[[y]]$'hid')
v[[name]]<-id
}
}
}
This is a bit heavy, but it's imposed by the fact R doesn't handle dictionnary objet as Python (mentioned there
I guess you right, I shouldn't have modified the python function to suit R problems, the function has to be the most flexible possible.
Hello @bgruening, I have noticed this PR is still open , may be it can be merged if it's ok for you?
Sorry, forgot about that :(
Thanks! @erasche is working on a new awesome concept of mounting in entire histories during container start, so this will also make your life easier we hope!
Hello Björn, I take this opportunity (#4) to propose a function Actually I use this to get the user history ( not a specific dataset). I think it could be useful in case where you want to get the list of all datasets and their names ( and choose only csv,txt etc..) , to display it to the user, and (this is the point) to display it on client side to have a dropdown button for example .
There is the R function to get the dataset and parse for only csv file_type.
It's an shiny use case example :
Once you get v as a named list, you can easely display it as show above. When the user click on the name of his dataset, in fact this is the hid wil be used to get the dataset.