[R] Error:non-numeric argument in my function

Grześ gregorio99 at gmail.com
Sun May 31 23:43:33 CEST 2009

I have a function:

zywnoscCalosc<- function( jedzenie, n1, n2, n3, n4, d1, d2, d3, d4 ) { 

ndf <- data.frame(nn1=n1,nn2=n2,nn3=n3,nn4=n4)
ddf <- data.frame(dd1=d1,dd2=d2,dd3=d3,dd4=d4)
for (i in 1:length(n1)){

wekt_n = ndf[i,]

wekt_n_ok = wekt_n[!is.na(wekt_n)]

dl_n = length(wekt_n_ok)
wynik = (1*wekt_n_ok)/(1*dl_n)

and I get an error like this:
Error in 1 * wekt_n_ok : non-numeric argument to binary operator

Anybody can help me?
View this message in context: http://www.nabble.com/Error%3Anon-numeric-argument-in-my-function-tp23807218p23807218.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list