[R] Read in files in r

lily li chocold12 at gmail.com
Wed Nov 9 03:42:52 CET 2016


Hi R users,

In the current directory, there are several folders (such as fold1, fold2,
fold3, etc.), while each folder includes the same named files, such as
file1.txt, file2.txt, file3.txt, etc. The structures of each folder and
each file are the same, but with different values. I want to read the files
from each folder, but can't get it to work. Could you please tell me why?
Thanks.

rd1 = read.table(file=list.files('fold1')[1], head=T)
rd2 = read.table(file=list.files('fold1')[2], head=T)

rt1 = read.table(file=list.files('fold2')[1], head=T)
rt2 = read.table(file=list.files('fold2')[2], head=T)

Then there are the warning sign that 'cannot open file 'file1.txt': No such
file or directory'

	[[alternative HTML version deleted]]



More information about the R-help mailing list