I'm new to R
and I'm trying to get my script more efficient. I have a data.frame
of 25480
observations and 17
variables.
One of my variables is Subject
and each subject has its number. However, the number of observations (lines
) for each subject is not equal. I would like to separate my subjects
into groups
, according to their number. How can I do it?
Before I used this formula:
gaze <- subset(gaze, Subject != "261" & Subject != "270" & Subject != "275")
But now I have too many subjects to repeat Subject each time. Is it possible to define interval of subjects to cut
or to split
. I tried this command but it doesn’t seem to work:
gazeS <- (gaze$Subject[112:216])
cut(gaze, seq(gaze, from = 112, to = 116))
Could you help me to fix this code, please?