Hi I have data in the following format Cort Day Animal 23 0 1 27 3 1 24 0 2 27 1 2 34 2 2 30 3 2 24 4 2 20 0 3 24 1 3 28 2 3 34 4 3 etc. It is measured across time(day) however no every individual is measured the same number of times. All I want to do is plot the Raw data and then run a line connecting the data points of each individual animal, for the example above there would be three lines as there are three animals. I've tried, gplots, lattice and car but I'm not really figuring it out, any help would be greatly appreciated! Thanks Clara -- View this message in context: http://r.789695.n4.nabble.com/Plotting-Lines-Through-multiple-groups-tp3850099p3850099.html Sent from the R help mailing list archive at Nabble.com.
if it was me, i'd do library("ggplot2") df <- read.table(pipe("pbpaste"), header=T, sep='\t') df$Animus=factor(df$Animal, labels=c("Tom", "Dick", "Harry")) qplot(Day, Cort, data = df, geom="line", colour=Animus) On Sep 28, 2011, at 8:03 AM, clara_eco wrote:> Hi I have data in the following format > Cort Day Animal > 23 0 1 > 27 3 1 > 24 0 2 > 27 1 2 > 34 2 2 > 30 3 2 > 24 4 2 > 20 0 3 > 24 1 3 > 28 2 3 > 34 4 3 > etc. > It is measured across time(day) however no every individual is measured the > same number of times. All I want to do is plot the Raw data and then run a > line connecting the data points of each individual animal, for the example > above there would be three lines as there are three animals. > I've tried, gplots, lattice and car but I'm not really figuring it out, any > help would be greatly appreciated! > > Thanks > Clara > > > -- > View this message in context: http://r.789695.n4.nabble.com/Plotting-Lines-Through-multiple-groups-tp3850099p3850099.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Hi Clara, are there repeated measures of an animal on the same day? Otherwise I did not get the point of the level of aggregation. Using lattice you can do sth like xyplot(Cort~Day,groups=Animal,type=c("p","a"),data=df) but with your given data this just connects the raw points hth. Am 28.09.2011 08:03, schrieb clara_eco:> Hi I have data in the following format > Cort Day Animal > 23 0 1 > 27 3 1 > 24 0 2 > 27 1 2 > 34 2 2 > 30 3 2 > 24 4 2 > 20 0 3 > 24 1 3 > 28 2 3 > 34 4 3 > etc. > It is measured across time(day) however no every individual is measured the > same number of times. All I want to do is plot the Raw data and then run a > line connecting the data points of each individual animal, for the example > above there would be three lines as there are three animals. > I've tried, gplots, lattice and car but I'm not really figuring it out, any > help would be greatly appreciated! > > Thanks > Clara > > > -- > View this message in context: http://r.789695.n4.nabble.com/Plotting-Lines-Through-multiple-groups-tp3850099p3850099.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.-- Eik Vettorazzi Institut f?r Medizinische Biometrie und Epidemiologie Universit?tsklinikum Hamburg-Eppendorf Martinistr. 52 20246 Hamburg T ++49/40/7410-58243 F ++49/40/7410-57790 -- Pflichtangaben gem?? Gesetz ?ber elektronische Handelsregister und Genossenschaftsregister sowie das Unternehmensregister (EHUG): Universit?tsklinikum Hamburg-Eppendorf; K?rperschaft des ?ffentlichen Rechts; Gerichtsstand: Hamburg Vorstandsmitglieder: Prof. Dr. J?rg F. Debatin (Vorsitzender), Dr. Alexander Kirstein, Joachim Pr?l?, Prof. Dr. Dr. Uwe Koch-Gromus
Thank you Eik Vettorazzi-2 That was exactly what I wanted! Regards Clara -- View this message in context: http://r.789695.n4.nabble.com/Plotting-Lines-Through-multiple-groups-tp3850099p3853753.html Sent from the R help mailing list archive at Nabble.com.