Leif Peterson
2008-Oct-29 13:30 UTC
[R] Selecting cases for a grouping value to refill x and y vectors
The variable "iter" from read.table takes on values of 0,5,10,15, and 20. I am trying to pick off values of iter by assigning it to "grp", and e.g. iter<-5, then fill the x and y vectors and make plots of x,y for each value of iter (>0) For some reason all of the plots are the same, so I am not changing x and y. Any sugestions on how to refill vectors x and y when iter takes on certain values? thx LP> > mydata<-read.table("C:/refvecs_iters_5.csv", header=TRUE, sep=",",na.strings="NA", dec=".", strip.white=TRUE, row.names=1)> > x <- runif(1000) > y <- runif(1000) > > summary(mydata)iter xin yin Min. : 0 Min. : 0.01792 Min. : 0.03055 1st Qu.: 5 1st Qu.: 3.10674 1st Qu.: 3.13284 Median :10 Median : 5.46899 Median : 5.43446 Mean :10 Mean : 5.43360 Mean : 5.39696 3rd Qu.:15 3rd Qu.: 7.70127 3rd Qu.: 7.70780 Max. :20 Max. :10.00000 Max. :10.00000> > #plot(mydata$xin,mydata$yin) > > split.screen(c(2,2))[1] 1 2 3 4> > for (k in 1:4){+ + screen(k) + cnt <- 0 + grp<- mydata$iter * 5 + for (i in 1:5000 ) { + if (grp<-k*5) { + cnt = cnt + 1 + x[cnt] <- mydata$xin[i] + y[cnt] <- mydata$yin[i] + } + } + #p = cbind(x=rnorm(300), y=rnorm(300)) + #p = cbind(x, y) + #tt = delaunayn(p) + #trimesh(tt,p,axis=TRUE,box=TRUE) + plot(x,y) + }> >[[alternative HTML version deleted]]
Reasonably Related Threads
- How to set read.table variables to vectors?
- Geometry delaunayn and deldir results, differing results from Octave due to decimal precision?
- Geometry delaunayn and deldir results, differing results from Octave due to decimal precision?
- Geometry delaunayn and deldir results, differing results from Octave due to decimal precision?
- precision warning in delaunayn function