Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR R

how to create a loop for different categories in a column in r

nm1 <- unique(s$flavor)
for(i in seq_along(unique(s$flavor))){
    tmp <- s$age[s$flavor == nm1[i] ]
    v1[i] <-paste("mean =", mean(tmp), "sd =", sd(tmp))
  }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #create #loop #categories #column
ADD COMMENT
Topic
Name
1+5 =