Here's my situation. I have an object that I've created using read.spss.
> a <- read.spss(...)
> attach(a)
Now in this object (a) is a set questions that I would like to pull out that follows a sequence of question numbers.
> q3 <- data.frame(q3_1, q3_2, q3_4, ... q3_27)
Is there a way to automate it such that it pulls out all questions starting with "q3_" from the original object into the new q3 data.frame?
I've tried using the paste function to no avail.
> q3 <- data.frame(paste("q3_",1:27,sep=""))
That just returns a data.frame with the pasted sequence.
Ideally, I would like something that pulls in everything from a question beginning with a "qX_", as some values are missing or outdated.
Thanks in advance!