lattice xyplot in R - how to plot multiple observations of same subject -
I have a dataset that looks like the following and I want to use xyplot to ram it in R: id = c ("1", "1", "1", "1", "1", "1", "1", "2", "2", " 2 "," 2 "," 2 "," 2 "," 2 "," 2 "," 2 "," 2 "," 2 "," 2 "," 2 "," 2 ") TIME = c ("0", "0.5", "1", "1.5", "2", "2.5", "3", "0", "0", "0.5", "0.5", "1", " 1 "," 1.5 "," 1.5 "," 1.5 "," 2 "," 2 "," 2.5 "," 2.5 "," 3 "," 3 "), OBS = C (" 0 "," 0.73 "," 0.98 " , "0," "0.01", "0.01", "0.01", "0.01", " VISITNUM = c ("1", "1", "1", "1", "1", "1", "5.4", "5.6", "7.8", "8.0", "8.4", "8.8" , "2", "1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "1", "2", "1" 1 "," 2 "," 1 "DF [id (df $ ED, DF $ visit, DF $ TIME), Library (Latin) print (Explanation) (DIF $ ID), DF = Data. Frame (ID, Time, OBS, Visitian) DF & LT; (OBS ~ TIME As you can see, many observations on topic 2 (the last OBS point first sequence and the first of the next sequence), group = id, data = df, type = 'b',))
OBS point)
-
How can I choose Xyplot that I plot 2 to 2 hours for 2 to 2 hours Do not want to go and thus should be treated as an individual in each sequence, resulting in three distinct lines?
-
How do I want to specify the plot for a single topic that is to be plotted (i.e. only subject 1)?
I'm new to hide in R, so please see me on other packages which you may find more suitable for these purposes.
Thank you in advance.
/ ykl
1) To separate two trips for topic 2 For this, you can create a new group variable in
groups = by pasting
id and
VisitNUM > such reasoning:
xyplot (OBS ~ TIME, group = paste (id, visit number) data = df, type = 'b',) subset < Code> logic to see:
xyplot (OBS ~ TIME, group = paste (id, visit number) data = df, subset = id = = 1, Rkar = 'B',)
Comments
Post a Comment