[R] check availability of a file in R

David Winsemius dwinsemius at comcast.net
Wed Sep 7 03:37:44 CEST 2011


On Sep 6, 2011, at 8:07 PM, Farhad Shokoohi wrote:

> I need to use a loop and each time go to folder i and check  
> availability of .RData file. If it exist load it and if not submit a  
> command in linux. Something like this
>
> for (i in 1:10){
> 	setwd(~/i/)
# Perhaps:
	if (target %in% list.files( patt="\.Rdata") ) {

> .Rdata (?????)

> 	#load (.RData
             load( target)
> 	else

# perhaps you could explain your goals for this next operation?

> 	<run a command in linux like " cd ~/i/  ;  qsub job$i.pbs" >
> }
>
> Any idea how to do that in R?
>
> Farhad

-- 

David Winsemius, MD
Heritage Laboratories
West Hartford, CT



More information about the R-help mailing list