Displaying 2 results from an estimated 2 matches for "jedzeni".
Did you mean:
jedzenie
2009 Jun 02
2
What do you think about my function?
...n't
briliant :/ but what do you think? What I should do that my function will be
better? (now is very slow and not ideal, sometimes I also get a mistake!)
########## My function #############################################
dzieci<-transform(dzieci, zywnosc=0)
zywnoscCalosc<- function( jedzenie, sklep, n1, n2, n3, n4, d1, d2, d3, d4 )
{
skl <- sklep
wynik <- vector()
wynik <- jedzenie
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_d = ddf[i,]...
2009 May 31
1
Error:non-numeric argument in my function
Hello!
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...