search for: myvars1

Displaying 1 result from an estimated 1 matches for "myvars1".

Did you mean: myvars
2007 Aug 26
3
subset using noncontiguous variables by name (not index)
...hanks, Bob mydata <- data.frame( x1=c(1,2,3,4,5), x2=c(1,2,3,4,5), x3=c(1,2,3,4,5), x4=c(1,2,3,4,5), x5=c(1,2,3,4,5), x6=c(1,2,3,4,5), x7=c(1,2,3,4,5) ) mydata # This does what I want. summary( subset(mydata,select=c(x1,x3:x5,x7) ) ) # Can I substitute myVars? attach(mydata) myVars1 <- c(x1,x3:x5,x7) # Not looking good! myVars1 # This doesn't do the right thing. summary( subset(mydata,select=myVars1 ) ) # Total desperation on this attempt: myVars2 <- "x1,x3:x5,x7" myVars2 # This doesn't work either. summary( subset(mydata,select=myVars2 ) )...