org] On
> Behalf
> Of arun
> Sent: Wednesday, July 03, 2013 10:15 PM
> To: Shaun ♥ Anika
> Cc: R help
> Subject: Re: [R] Subsetting multiple rows of a data frame at once
>
> Hi,
>
> carbon.fit = expand.grid(list(x=seq(0, 5, 0.01), y=seq(0, 5, 0.01)))
> dim(carbo
xt,y=yt), carbon.fit)
(You still want to round your numbers as before.)
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of arun
> Sent: Wednesday, July 03, 201
Hi,
carbon.fit = expand.grid(list(x=seq(0, 5, 0.01), y=seq(0, 5, 0.01)))
dim(carbon.fit)
#[1] 251001 2
xtNew<-sprintf("%.2f",xt)
ytNew<- sprintf("%.2f",yt)
carbon.fit[]<- lapply(carbon.fit,function(x) sprintf("%.2f",x))
res<-do.call(rbind,lapply(seq_along(xtNew),function(i)
subset(carb
Hi,
Possibly, FAQ 7.31
Using the same example:
set.seed(24)
df<- data.frame(x=sample(seq(0.25,4.25,by=.05),1e5,replace=TRUE),y=
sample(seq(0.10,1.05,by=.05),1e5,replace=TRUE),z=rnorm(1e5))
dfOld<- df
df[,1:2]<- lapply(df[,1:2],function(x) sprintf("%.2f",x))
x1<- c(1.05,2.85,3.40,4.25,0.25)
y1<-
Hi,
Try this:
set.seed(24)
df<- data.frame(x=sample(seq(0.25,4.25,by=.05),1e5,replace=TRUE),y=
sample(seq(0.10,1.05,by=.05),1e5,replace=TRUE),z=rnorm(1e5))
#Used a shorter vector
x1<- c(1.05,2.85,3.40,4.25,0.25)
y1<- c(0.25,0.10,0.90,0.25,1.05)
res<-do.call(rbind,lapply(seq_along(x1),function
5 matches
Mail list logo