search for: newframe

Displaying 15 results from an estimated 15 matches for "newframe".

2007 Jul 17
2
SLLOOOWWW function ...
...ge[2])){ # Extract all data associtaed with the current time (minute) frame <- subset(mylist,mylist[["Time"]] == minute) # Sort by Intensity frame <- frame[order(frame[["Intensity"]],decreasing = TRUE),] # Establish output frame using the most intense candidate newframe <- frame[1,] # Establish overlap-checking vector using the most intense candidate lowppm <- round(newframe[1,][["Mass"]]-newframe[1, [["Mass"]]/1E6*ppmrange,digits=digit) highppm <- round(newframe[1,][["Mass"]]+newframe[1, [["Mass"]]/1E6*ppmran...
2004 May 11
2
lm with predictor matrix
...ple of how to fit a linear model where the response is a matrix, please? (other than a loop over lm calls) The ?lm points me to model.matrix but it is not clear to me how to use a model matrix in an lm call. fit<-lm(headmatrix ~ tailmatrix) causes problems as soon as I use predict(fit,newframe). The variables in tailmatrix are not found in newframe. Thanks, Claus --------------------------------- [[alternative HTML version deleted]]
2005 Aug 12
1
as.formula and lme ( Fixed effects: Error in as.vector(x, "list") : cannot coerce to vector)
...or message. Same works ok with lm, and with > lme and a fixed formula. > > # demonstrates problems with lme and as.formula > demo<-data.frame(x=1:20,y=(1:20)+rnorm(20),subj=as.factor(rep(1:2,10))) > demo.lm1<-lme(y~x,data=demo,random=~1|subj) > print(summary(demo.lm1)) > newframe<-data.frame(x=1:5,subj=rep(1,5)) > predict(demo.lm1,newframe,level=0) > > fma<-as.formula("y~x") > demo.lm<-lm(fma,data=demo) # ok > predict(demo.lm,newframe,level=0) # ok > demo.lm2<-lme(fma,data=demo,random=~1|subj) # looks ok, but isn't > pr...
2001 Feb 23
1
as.formula and lme ( Fixed effects: Error in as.vector(x, "list") : cannot coerce to vector)
...as.formula with lme leads to an error message. Same works ok with lm, and with lme and a fixed formula. # demonstrates problems with lme and as.formula demo<-data.frame(x=1:20,y=(1:20)+rnorm(20),subj=as.factor(rep(1:2,10))) demo.lm1<-lme(y~x,data=demo,random=~1|subj) print(summary(demo.lm1)) newframe<-data.frame(x=1:5,subj=rep(1,5)) predict(demo.lm1,newframe,level=0) fma<-as.formula("y~x") demo.lm<-lm(fma,data=demo) # ok predict(demo.lm,newframe,level=0) # ok demo.lm2<-lme(fma,data=demo,random=~1|subj) # looks ok, but isn't print(summary(demo.lm2)) #Fixed effe...
2011 Sep 13
1
implicit data frame reference
If I create an aggregation like this: aggregate(lastYear[,8:10],list(Stadium=lastYear$STAD),mean) I'll get a new data frame, which I can order if I assign it like this: newFrame <- aggregate(lastYear[,8:10],list(Stadium=lastYear$STAD),mean) newFrame[order(newFrame$TEMP),] But.. if I just want to do this in one statement, what can I do? If this was perl, I'd be using something like $_: aggregate(lastYear[,8:10],list(Stadium=lastYear$STAD),mean)[order($_$TEMP),] S...
2011 Mar 19
1
strange PREDICTIONS from a PIECEWISE LINEAR (mixed) MODEL
...ct(mod) lines(x[order(x)],yy[order(x)],col=2,lwd=2) #--lme #grouping factor, unbalanced g<-as.character(c(1:200)) id<-sample(g,size=1000,replace=T, prob=sample(0:1,200,rep=T)) table(id) #unbalanced mod2<-lme(y~x+x*(x>-1),random=~x|id, data=data.frame(x,y,id)) summary(mod2) newframe<-data.frame( #fictious id id="fictious", x) newframe[1:5,] #predictions yy2<-predict(mod2,level=0, newdata=newframe) lines(x[order(x)],yy2[order(x)],col="blue",lwd=2) # add variable in the model z<-rgamma(1000,4,6) mod3<-lme(y~x+x*(x>-1)+z ,random=~x|id...
2005 Sep 08
1
Converting a matrix to a dataframe: how to prevent conversion to factor
..."Text2",..: 1 2 3 4 $ NUMBERS: Factor w/ 4 levels "11","12","13",..: 4 3 2 1 One work-around is to write the matrix (or the dataframe) to a file, then read the file back using the as.is argument. write.table(MATRIX, "JUNK", row.names=F) NEWFRAME <- read.table("JUNK", as.is=T, header=T) > str(NEWFRAME) `data.frame': 4 obs. of 2 variables: $ TEXT : chr "Text1" "Text2" "Text3" "Text4" $ NUMBERS: int 14 13 12 11 This restores the NUMBERS to their intended mode (integers,...
2006 Sep 13
7
inserting columns in the middle of a dataframe
Dear R users: Is there a built-in and simple way to insert new columns after other columns in a dataframe? I.e. currently I have: V1 V2 V3 V4 [1,] [2,] Etc. But I want V1 V5 V2 V3 V4 [1,] [2,] Etc. Can this be done in one line? Jon Minton [[alternative HTML version deleted]]
2007 Oct 08
2
as.ordered
Hello Members, I try to convert variables in a data.frame (bract.awn) in the class ordered. str(bract.awn) 'data.frame': 348 obs. of 2 variables: $ bracts.length.relative.to.flower...............Min: Factor w/ 4 levels "1","2","3","4": 2 3 3 3 3 2 1 4 3 2 ... $ bract.awn.relative.to.body.................Max : Factor w/ 4 levels
2011 Mar 18
1
PREDICTIONS from a PIECEWISE LINEAR (mixed) MODEL: THEY AIN'T LINEAR BETWEEN BREAK POINTS!!
...e a fictious data.frame for the predictions , in fact lme predict values inside the clusters , id in my case, they are patients.. I need instead a population result... nx<-seq( min(cd4,na.rm=T), max(cd4,na.rm=T), length.out=200) nt<-seq( min(rt,na.rm=T), max(rt,na.rm=T), length.out=200) newframe<-data.frame( #generate a fictious patient's profile id="48", cd4=nx, rt=nt, sex=rep("M",200), age=rep(mean(age),200), nadir=rep(mean(age),200), pharmac2=rep("PI.boost",200), resp2=rep("mild",200), hbs=rep(1,200), hcv=rep(1,200), hivbl=rep(mean(h...
2004 Mar 26
4
multicolumn sort on dataframe?
...evels( nspr.code ) )[nspr.code] nspr.tpa <- as.numeric( levels( nspr.tpa ) )[nspr.tpa] hope <- as.data.frame( cbind( nspr.code, as.numeric(nspr.tpa) ) ) and it seems to work, but I have dataframes that I would like to sort on using multiple columns (numeric and character). Something like : newframe <- sort( data=frame, list=c(plot,plant,sp) ) Or am I just barking up the wrong tree? Jeff. --- Jeff D. Hamann Forest Informatics, Inc. PO Box 1421 Corvallis, Oregon USA 97339-1421 541-754-1428 jeff.hamann at forestinformatics.com www.forestinformatics.com
2010 Jun 18
5
extract date time from a text file
I a have a text file where every line is like that: "2007-12-03 13:50:17 Juan Perez" ("yy-mm-dd hh:mm:ss First Name Second Name") I would like to make a data frame with two column one for date and the other one for name. When I use read.delim it was transformed in a data frame with 4 colums. Bye, Sebasti?n.
2003 Aug 29
2
extract numerical variables from a data frame
Hi I try to create from a data frame a new one which contains only the numerical variables (or factorial ones). Is there any function which does this task directly ? Or, is there any function which return the mode of each columns of a data frame. ? Thanks a lot for any help you can offer me, Vincent Spiesser
2010 Nov 10
1
Inserting Missing Data
Greetings I'm attempting to insert missing data on the smallest size class of cave cricket instars into a data frame. The data involve censusing photoplots (plots) of roosting cave crickets in which we discern in four instars or size classes. I need to insert data on size class one into a data frame that already has data on size classes two through four. The data can be merged by their
2001 Nov 12
2
check() warnings for survival-2.6
...t; "is.na.coxph.penalty" [19] "is.na.ratetable" "is.na.ratetable2" [21] "labels.survreg" "match.ratetable" [23] "model.frame.coxph" "model.frame.survreg" [25] "model.newframe" "print.coxph.penal" [27] "print.ratetable" "print.summary.survreg" [29] "print.survdiff" "print.survexp" [31] "print.survreg.penal" "residuals.survreg.penal" [33] "summar...