[R] Help with arguments in .Script

David Winsemius dwinsemius at comcast.net
Sat Dec 19 14:56:11 CET 2009


On Dec 19, 2009, at 6:24 AM, Veronesi, Fabio wrote:

> Dear R users,
> my problem, at the moment, is the following:
> I need to apply a script to a very big dataset, so I need first to  
> subdivide the dataset into samples and then apply the script to  
> every single sample.
> Now I tried to solve the problem with these linest:
>
> S00001<-data[data$sub==1,1:3]         #which divide the dataset in  
> samples based on the number on the column "sub"

It is only going to give you the subset for which that logical  
condition is true, so it is not "dividing the dataset."

> data<-S00001                                         #because in the  
> script the dataset is always called "data"
> .Script("R",script.R,args=data,write.csv(table,c:\table.csv)
>
> With the last line I basically want to run the script ("script.R),  
> with the created dataset and, at the end of the script, I need to  
> write the table, created inside the script, in a csv file.
> Obviously it does not work.
> Do you have some suggestion to solve a problem like this?

Wouldn't we need to see script.R?

(And your call to write.csv is going to fail because R does not accept  
single backslashes in path specifications in any of the OS's in which  
it might be running.)

>
> and provide commented, minimal, self-contained, reproducible code.
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list