Hi Arun, thank you. I will look through that later on today when I get a
chance. I have to complete another part of this project now.

Irucka


<-----Original Message-----> 
>From: arun kirshna [via R] [ml-node+s789695n4661145h71@n4.nabble.com]
>Sent: 3/12/2013 10:35:39 PM
>To: iruckaE@mail2world.com
>Subject: Re: how do I read certain files from a directory based on
number of
>columns?
>
>Hi, 
>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 
>#Read 1 item 
>#[[1]] 
> # dload_40000 dload_60000 d1 
>#1 1 5 3 
>#2 4 6 9 
>#3 3 4 3 
>
>#[[2]] 
>#NULL 
>
>#[[3]] 
> # dload_60000 
>#1 11 
>#2 44 
>#3 33 
>
>May be this helps you in getting started. 
>A.K. 
>
>
>
>
>If you reply to this email, your message will be added to the
discussion below:
>http://r.789695.n4.nabble.com/how-do-I-read-certain-files-from-a-direct
ory-based-on-number-of-columns-tp4661144p4661145.html
>
>To unsubscribe from how do I read certain files from a directory based
on number
>of columns?, click here.
>NAML 


<span id=m2wTl><p><font face="Arial, Helvetica, sans-serif" size="2" style="font-size:13.5px">_______________________________________________________________<BR>Get the Free email that has everyone talking at <a href=http://www.mail2world.com target=new>http://www.mail2world.com</a><br>  <font color=#999999>Unlimited Email Storage &#150; POP3 &#150; Calendar &#150; SMS &#150; Translator &#150; Much More!</font></font></span>



--
View this message in context: http://r.789695.n4.nabble.com/how-do-I-read-certain-files-from-a-directory-based-on-number-of-columns-tp4661144p4662101.html
Sent from the R help mailing list archive at Nabble.com.
	[[alternative HTML version deleted]]

