Displaying 1 result from an estimated 1 matches for "pr9".
Did you mean:
pr
2011 Apr 09
1
loop and sapply problem, help need
...d2 <- c(22, 11, 44, 11, 33, 11, 22, 22, 11, 22)
lcd3 <- c(12, 12, 34, 14, 13, 12, 23, 23, 12, 12)
#generating variables through sampling
pvec <- c("PR1", "PR2", "PR3", "PR4", "PR5", "PR6", "PR7", "PR8", "PR9",
"PR10")
fun11 <- function(x){
smpool <- c(1,2,3,3)
x <- sample(smpool, 10, replace= TRUE)
}
newd <- sapply (pvec, fun11)
# function to recode this new generated data
fun3 <- function(x) {
(if ( x ==1){
x = lcd1
}else if (x ==2){...