Displaying 1 result from an estimated 1 matches for "dload_20000".
2013 Mar 21
0
how do I read certain files from a directory based on number of columns?
...>Suppose, I have three files "File1.txt", "File2.txt", "File3.txt" in a
folder. 
>list.files() 
>#[1] "File1.txt" "File2.txt" "File3.txt" 
>read.table("File2.txt",header=TRUE,stringsAsFactors=FALSE) 
># dload_40000 dload_20000 d1 
>#1 1 4 3 
>#2 4 9 9 
>#3 3 8 3 
>
>lapply(list.files(),function(x)
{x1<-x[any(scan(file=x,what="",nlines=1)%in%
>"dload_60000")]; if(length(x1)!=0)
>read.table(x1,header=TRUE,stringsAsFactors=FALSE) else NULL}) 
>#Read 3 items 
>#Read 3 items...