Hello everyone, I have a set of data in the following form, which are stored in an Excel file: nick john peter lesson1 0.465 0.498 0.473 lesson2 0.422 0.44 0.134 lesson3 0.45 0.35 0.543 lesson4 0.590 0.64 0.11 lesson5 0.543 0.5 0.32 What I want to do is a 2d-graph plot where I will have the name of the student in the X-axis and the name of the lesson in the Y-axis and the number from each pair will be used to construct the plot. I am newbie with R and I don't know which package shall I use nor the commands with which I will import my data in R so that the plot will be created... Any help would be greatly appreciated. -- View this message in context: http://www.nabble.com/transform-excel-data-into-graph-tf4046056.html#a11493073 Sent from the R help mailing list archive at Nabble.com.
There are numerous ways of importing data from excel. One is to save as a .csv and use the read.csv function. Or, you can copy to the clipboard and use the read.delim("clipboard",header=T) function. Are you looking at a bar graph where the lessons have the names nested below them on the x axis, and the numbers on the y? As these are all introductory elements of using R, going through the numerous intro R manuals available online is your best bet. Try: http://cran.r-project.org/manuals.html and also under "Contributed Documentation" at the above site. cross123 wrote:> > Hello everyone, > I have a set of data in the following form, which are stored in an Excel > file: > nick john peter > lesson1 0.465 0.498 0.473 > lesson2 0.422 0.44 0.134 > lesson3 0.45 0.35 0.543 > lesson4 0.590 0.64 0.11 > lesson5 0.543 0.5 0.32 > > What I want to do is a 2d-graph plot where I will have the name of the > student in the X-axis and the name of the lesson in the Y-axis and the > number from each pair will be used to construct the plot. > I am newbie with R and I don't know which package shall I use nor the > commands with which I will import my data in R so that the plot will be > created... > > Any help would be greatly appreciated. > >-- View this message in context: http://www.nabble.com/transform-excel-data-into-graph-tf4046056.html#a11494545 Sent from the R help mailing list archive at Nabble.com.
I am not sure exactly what you want but see if this will work. It will give you a dotchart. Assume your data.frame is dat First give the lessons column a name. See ?names convert numbers in data.frame to a matrix for dotchart dmat <- as.matrix(dat[,2:4]) Draw dotchart using dat$lessons as a dotchart(dmat, labels = dat[,1]) --- cross123 <ctsirigos at yahoo.com> wrote:> > Hello everyone, > I have a set of data in the following form, which > are stored in an Excel > file: > nick john peter > > lesson1 0.465 0.498 0.473 > lesson2 0.422 0.44 0.134 > lesson3 0.45 0.35 0.543 > > lesson4 0.590 0.64 0.11 > > lesson5 0.543 0.5 0.32 > > > What I want to do is a 2d-graph plot where I will > have the name of the > student in the X-axis and the name of the lesson in > the Y-axis and the > number from each pair will be used to construct the > plot. > I am newbie with R and I don't know which package > shall I use nor the > commands with which I will import my data in R so > that the plot will be > created... > > Any help would be greatly appreciated.