Hi,

I am attempting to write code which will read in my data which is of this
form:

X1        Y1        X2       Y2        ....       Xn        Yn
0          0          0         0                    0          0
1          0          1         255                 1          0
2          255       2         0                    2          255
3          0          3         0                    3          0
4          0          4         0                    4          0
5          0          5         0                    5          255
6          125       6         125                 6         0
7          0          7         0                    7          0
8          0          8         0                    8          125
.
.
.

With n~100. My current code deals with only 1 data set, n~1 (below):


profile<-read.table("datav1.txt",header=T)
attach(profile)

lines<-profile[Y>100,]
d<-lines$X
i<-1
l<-1:1:i

while(i<30){
l[i]<-(d[(i+1)]-d[i])
temp<-i+1
i<-temp
}

L<-l[l>22]


I want to extend this to accept n data sets to see how L varies between each
data set. The way I have been trying to do this is as follows:

profile<-read.table("datav2.txt",header=T)
j<-1
lines[j]<-profile[profile$Y[(2*j)]>100,]

etc.

However this returns the message "Error in profile$Y : object of type
'closure' is not subsettable". Does anybody know if there is any way I can
read in a file containing many data sets and save each data set as an
element of some matrix before performing the calculations (above) on it? Or
some other method to achieve the same thing?

Any help or suggestions would be great! Thank you.





--
View this message in context: 
http://r.789695.n4.nabble.com/Reading-in-and-manipulating-multiple-data-sets-from-the-same-input-file-tp3335523p3335523.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to