I have facing an error recently, i have a data frame called Centroid like this( this is a small piece of the real archive)
X1989 X1990 X1991 LAT LON
1 10 11 10 -44,3517712669 -22,9847296224
2 12040 12040 14589 -42,2932250108 -22,7536045078
3 3 3 3 -43,9128279672 -22,4248877183
4 20 20 20 -44,2046056169 -22,4533649489
And i need to multiply each year column by the LAT
column and LON
column as well.
I tried doing that with a for loop
LAT<- Centroid[,29]
xlat<-as.list
for ( col in Centroid[,1:28]) {
xlat<- col * Centroid[,29]
cbind(TABTRUE,xlat, make.col.names= TRUE)
}
but I get this error:
Error in col * Centroid[, 29] : non-numeric argument to binary operator.