In an earlier post, a person wanted to divide each of the rows of 

rawdata by the row vector sens so he did below but didn't like it and 

asked if there was a better solution.

 

rawdata <- data.frame(rbind(c(1,2,2), c(4,5,6))) sens <- c(2,4,6)

 

temp <- t(rawdata)/sens

temp <- t(temp)

print(temp)

 

Gabor sent three other solutions and I understood 2 of them but not the one
below.

 

I think I understand mapply a little but what I don't understand how 

it knows to take the rows of rawdata and then I guess recycle sens ?

how did the mapply know not to take the columns of rawdata and do 

something to them ? or maybe mapply does things element by element and it is
doing more 

complex recycling ? I guess I don't really understand mapply that well but I
did 

read the help of it.

 

Thanks so much for any enlightenment from anyone besides Gabor. I bother him
enough already

and he does more than enough.

 

tempc <- data.frame(mapply("/", rawdata, sens))

print(tempc)

 

                                 Mark

 

 

 

 

 


        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to