Dear List, I have replicated an experiment 100 times. Each experiment lasts for 15 iteration. Thus I have collected results into a data.frame with 100 columns (one column for each experiment) and 15 rows (one row for each iteration). I would like to plot mean values at each iteration using plotmeans, but I am unable to understand the syntax I should use. I tried: times<-as.factor(seq(1,15)) plotmeans(data~times) with no luck... what should I tell to plotmeans in order to evaluate my dataset? Best regards, Simone -- Simone Gabbriellini, PhD PostDoc@DISI, University of Bologna mobile: +39 340 39 75 626 email: simone.gabbriellini@unibo.it academia.edu: http://goo.gl/7pq62 DigitalBrains srl Amministratore mobile: +39 340 39 75 626 email: simone.gabbriellini@digitalbrains.it home: www.digitalbrains.it [[alternative HTML version deleted]]
The formula in plotmeans compares vectors. This should work: data <- unlist(data) times <- rep(1:15, 100) plotmeans(data~times) Best, Nello -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Simone Gabbriellini Sent: Mittwoch, 26. Juni 2013 17:20 To: r-help at r-project.org Subject: [R] help with plotmeans (gplots) Dear List, I have replicated an experiment 100 times. Each experiment lasts for 15 iteration. Thus I have collected results into a data.frame with 100 columns (one column for each experiment) and 15 rows (one row for each iteration). I would like to plot mean values at each iteration using plotmeans, but I am unable to understand the syntax I should use. I tried: times<-as.factor(seq(1,15)) plotmeans(data~times) with no luck... what should I tell to plotmeans in order to evaluate my dataset? Best regards, Simone -- Simone Gabbriellini, PhD PostDoc at DISI, University of Bologna mobile: +39 340 39 75 626 email: simone.gabbriellini at unibo.it academia.edu: http://goo.gl/7pq62 DigitalBrains srl Amministratore mobile: +39 340 39 75 626 email: simone.gabbriellini at digitalbrains.it home: www.digitalbrains.it [[alternative HTML version deleted]] ______________________________________________ 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.
Your data is probably not arranged correctly. See if this works for your data:> # Creating a reproducible example > set.seed(42) > dat <- matrix(rnorm(100*15, 5, 5)+rep(1:15, each=100), 15, 100,byrow=TRUE)> str(dat)num [1:15, 1:100] 12.85 13 -2 8.98 16.67 ...> require(gplots) > # Rearranging dat as a data.frame with a time variable (1 to 15)and the experimental value (val)> # See the result of str(dat2) below for the structure > dat2 <- data.frame(time=rep(1:15, each=100),val=as.vector(t(dat)))> str(dat2)'data.frame': 1500 obs. of 2 variables: $ time: int 1 1 1 1 1 1 1 1 1 1 ... $ val : num 12.85 3.18 7.82 9.16 8.02 ...> plotmeans(val~time, dat2, n.label=FALSE)------------------------------------- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77840-4352 -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Simone Gabbriellini Sent: Wednesday, June 26, 2013 10:20 AM To: r-help at r-project.org Subject: [R] help with plotmeans (gplots) Dear List, I have replicated an experiment 100 times. Each experiment lasts for 15 iteration. Thus I have collected results into a data.frame with 100 columns (one column for each experiment) and 15 rows (one row for each iteration). I would like to plot mean values at each iteration using plotmeans, but I am unable to understand the syntax I should use. I tried: times<-as.factor(seq(1,15)) plotmeans(data~times) with no luck... what should I tell to plotmeans in order to evaluate my dataset? Best regards, Simone -- Simone Gabbriellini, PhD PostDoc at DISI, University of Bologna mobile: +39 340 39 75 626 email: simone.gabbriellini at unibo.it academia.edu: http://goo.gl/7pq62 DigitalBrains srl Amministratore mobile: +39 340 39 75 626 email: simone.gabbriellini at digitalbrains.it home: www.digitalbrains.it [[alternative HTML version deleted]] ______________________________________________ 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.