I have met into this problem when I tried to run panel regression by plm. My code: library(plm) indus <- read.csv(file="full.csv",header=TRUE) industry<-as.data.frame(indus) reg<-lm(LnTSO2 ~ LnPGDP + LnPGDP2 + LnSOES + LnCOES + LnLIMD + LnSHOLD + LnPRIV + LnFIEs + LnEXP + LnIMP + LnLEXRE + LnVALTAX + LnIND1 + LnIND2 + LnIND3 + LnIND4 + LnIND5 + LnIND6 + LnIND7 + LnIND8 + LnIND9, data=industry, model = "pooling") *Error in names(y) <- namesy : 'names' attribute [1144] must be the same length as the vector [0]* My data is attached showing as a screenshot. http://r.789695.n4.nabble.com/file/n4503946/%E6%9C%AA%E5%91%BD%E5%90%8D.jpg Does anyone know why this is happening and how to fix?\ Thanks very much. -- View this message in context: http://r.789695.n4.nabble.com/names-attribute-must-be-the-same-length-as-the-vector-tp4503946p4503946.html Sent from the R help mailing list archive at Nabble.com.
Uwe Ligges
2012-Mar-26 16:30 UTC
[R] 'names' attribute must be the same length as the vector
On 25.03.2012 22:10, jiefan wrote:> I have met into this problem when I tried to run panel regression by plm. > My code: > > library(plm) > indus<- read.csv(file="full.csv",header=TRUE) > industry<-as.data.frame(indus) > reg<-lm(LnTSO2 ~ LnPGDP + LnPGDP2 + LnSOES + LnCOES + LnLIMD + > LnSHOLD + LnPRIV + LnFIEs + LnEXP + LnIMP + LnLEXRE + LnVALTAX + > LnIND1 + LnIND2 + LnIND3 + LnIND4 + LnIND5 + LnIND6 + LnIND7 + > LnIND8 + LnIND9, data=industry, model = "pooling") > *Error in names(y)<- namesy : > 'names' attribute [1144] must be the same length as the vector [0]* > > My data is attached showing as a screenshot. > http://r.789695.n4.nabble.com/file/n4503946/%E6%9C%AA%E5%91%BD%E5%90%8D.jpg > > Does anyone know why this is happening and how to fix?\ > Thanks very much.Check if the names attribute of the data fits to the data.frame's dimensions. Uwe Ligges> > > -- > View this message in context: http://r.789695.n4.nabble.com/names-attribute-must-be-the-same-length-as-the-vector-tp4503946p4503946.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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.