Dear all, I am interested in finding out how to change the names of coefficients in the lm function. I have a design matrix which I called "design" where each variate has its own name. However when I issue the command: lm.1<-lm(response~design-1, weights=some.weights) and follow it with: summary(lm.1) it seems to paste as a character the names of the variates with design i.e I have something like: designAge designPlace designOccupation ... as names of coefficients and instead I just wanted to be it seems to do Age Place Occupation. P.S.. the reason I need this is because I am using the xtable library to turn output into latex tables and do not want to manually delete each and every single "design" word in the coefficients name vector. Thank you so much for any feedback, Jean Eid
If you coerce "design" into a data frame and then do lm.1 <- lm(response ~ . - 1, data=design, ...) that should work. Andy> -----Original Message----- > From: Jean Eid [mailto:jeaneid at chass.utoronto.ca] > Sent: Wednesday, September 10, 2003 4:28 PM > To: r-help at stat.math.ethz.ch > Subject: [R] coef names in lm > > > Dear all, > I am interested in finding out how to change the names of > coefficients in the lm function. I have a design matrix which > I called "design" where each variate has its own name. > However when I issue the command: > > lm.1<-lm(response~design-1, weights=some.weights) > > and follow it with: > > summary(lm.1) > > it seems to paste as a character the names of the variates > with design i.e I have something like: > > designAge > designPlace > designOccupation > ... > as names of coefficients and instead I just wanted to be > it seems to do > Age > Place > Occupation. > > P.S.. the reason I need this is because I am using the xtable > library to turn output into latex tables and do not want to > manually delete each and every single "design" word in the > coefficients name vector. > > Thank you so much for any feedback, > > Jean Eid > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo> /r-help >------------------------------------------------------------------------------ Notice: This e-mail message, together with any attachments,...{{dropped}}
Maybe this will work for you: df <- as.data.frame(design) lm.2 <- lm(response ~ ., df) -roger Jean Eid wrote:>Dear all, >I am interested in finding out how to change the names of coefficients in >the lm function. I have a design matrix which I called "design" where each >variate has its own name. However when I issue the command: > >lm.1<-lm(response~design-1, weights=some.weights) > >and follow it with: > >summary(lm.1) > >it seems to paste as a character the names of the variates >with design i.e I have something like: > >designAge >designPlace >designOccupation >... >as names of coefficients and instead I just wanted to be >it seems to do >Age >Place >Occupation. > >P.S.. the reason I need this is because I am using the xtable library to >turn output into latex tables and do not want to manually delete each and >every single "design" word in the coefficients name vector. > >Thank you so much for any feedback, > >Jean Eid > >______________________________________________ >R-help at stat.math.ethz.ch mailing list >https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > >-- Together, we can stop attaching Word documents http://www.fsf.org/philosophy/no-word-attachments.html