[R] In Ops.factor(...) not meaningful for factors

Александр Мащенко saneki2105 at gmail.com
Sun Aug 27 19:53:13 CEST 2017


Good evening!
I don't know R,  but I have to do this work for my diploma. So I'm sorry for the strange message below. Help me anybody decides this issues, please.

a part of the code is:

for (i in 1:133) {
r_squared <- vector()
sample_bank <- mydata[((i-1)*311+1):(i*311),]

#return for bank
return_bank <- diff(sample_bank[,4])/sample_bank[,4][-length(sample_bank[,4])]
I've got these errors:
model <- lm(sample_est[,6] ~ sample_est[,7], na.action=na.omit)
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA) cases

In addition:  Warning message :
In Ops.factor(diff(sample_bank[, 4]), sample_bank[, 4][-length(sample_bank[, : ‘/’ not meaningful for factors ( how to change type of columns that it works well?)

 colnames(ab_ret) <- as.character(col_nam)
Error in `colnames<-`(`*tmp*`, value = character(0)) : attempt to set colnames on an object with less than two dimensions If there are not enough information..
To load the files available at this URL: https://drive.google.com/open?id=0BxDK2ohAcqDMN0Vpb1g0U2pCczQ

I tried to find answers on stackoverflow, but it didn't help me.
I'm sorry, I can't explain well because don't know R and English well.
I'll be glad any helpful information.
Thank you.
	[[alternative HTML version deleted]]



More information about the R-help mailing list