Re: [R] Reading a specific column of a csv file in a loop

2011-11-15 Thread Jan van der Laan
Yet another solution. This time using the LaF package: library(LaF) d<-c(1,4,7,8) P1 <- laf_open_csv("M1.csv", column_types=rep("double", 10), skip=1) P2 <- laf_open_csv("M2.csv", column_types=rep("double", 10), skip=1) for (i in d) { M<-data.frame(P1[, i],P2[, i]) } (The skip=1 is needed as l

Re: [R] Reading a specific column of a csv file in a loop

2011-11-15 Thread Gabor Grothendieck
On Tue, Nov 15, 2011 at 9:44 AM, Juliet Hannah wrote: > In the solution below, what is the advantage of using "0L". > >  M0 <- read.csv("M1.csv", nrows = 1)[0L, ] > As mentioned, you will find quite a bit of additional info on the sqldf home page but to address the specific question regarding the

Re: [R] Reading a specific column of a csv file in a loop

2011-11-15 Thread Juliet Hannah
In the solution below, what is the advantage of using "0L". M0 <- read.csv("M1.csv", nrows = 1)[0L, ] Thanks! 2011/11/8 Gabor Grothendieck : > 2011/11/8 Sergio René Araujo Enciso : >> Dear all: >> >> I have two larges files with 2000 columns. For each file I am >> performing a loop to extract t

Re: [R] Reading a specific column of a csv file in a loop

2011-11-08 Thread Jim Holtman
have you considered reading in the data and then creating objects for each column and then saving (save) each to disk. That way you incur the expense of the read once and now have quick access (?load) to the column as you need them. You could also use a database for this. On Nov 8, 2011, at 5:

Re: [R] Reading a specific column of a csv file in a loop

2011-11-08 Thread Gabor Grothendieck
2011/11/8 Sergio René Araujo Enciso : > Dear all: > > I have two larges files with 2000 columns. For each file I am > performing a loop to extract the "i"th element of each file and create > a data frame with both "i"th elements in order to perform further > analysis. I am not extracting all the "i

[R] Reading a specific column of a csv file in a loop

2011-11-08 Thread Sergio René Araujo Enciso
Dear all: I have two larges files with 2000 columns. For each file I am performing a loop to extract the "i"th element of each file and create a data frame with both "i"th elements in order to perform further analysis. I am not extracting all the "i"th elements but only certain which I am indicati