[R] graph displays

John Kane jrkrideau at inbox.com
Tue Jun 26 15:37:45 CEST 2012


Sorry I misunderstood what you wanted.   Using ggplot2 and reshape2 which I imagine you will have to install, this should give you what you want

library(ggplot2)
library(reshape2)

xx1  <-  melt(Dataset, id = c("Source"))

p  <-  ggplot( xx1 , aes(variable, value, fill= Source   )) +
                            geom_bar(position = "dodge") +
                           scale_y_continuous(" Scale Values") +
                           scale_x_discrete("X values") +
                           opts( title = "Graphing Exercise")
 
p




John Kane
Kingston ON Canada


> -----Original Message-----
> From: ricardosousa2000 at clix.pt
> Sent: Tue, 26 Jun 2012 01:24:17 -0700 (PDT)
> To: r-help at r-project.org
> Subject: Re: [R] graph displays
> 
> 
> 
> Good morning,
> Thanks for help.
> I can explain better what I am trying to do.
> I'm trying to read data from a file, separated by a tab, with the
> following
> code.
> 
> 
> Dataset<-read.table("C:/Users/Administrator/Desktop/R/graph.txt",sep="\t",
> quote="\"",header = TRUE)
> View(Dataset)
> dput(Dataset)
> 
>> View(Dataset)
>> dput(Dataset)
> structure(list(Source = structure(1:3, .Label = c("A", "B", "C"
> ), class = "factor"), X1000s = c(47L, 37L, 17L), X600s = c(63L,
> 64L, 62L), X500s = c(75L, 45L, 25L), X250s = c(116L, 11L, 66L
> ), X100s = c(125L, 25L, 12L), X50s = c(129L, 19L, 29L), X10s = c(131L,
> 61L, 91L), X5s = c(131L, 131L, 171L), X3s = c(131L, 186L, 186L
> ), X1s = c(131L, 186L, 186L)), .Names = c("Source", "X1000s",
> "X600s", "X500s", "X250s", "X100s", "X50s", "X10s", "X5s", "X3s",
> "X1s"), class = "data.frame", row.names = c(NA, -3L))
>> Dataset
>   Source X1000s X600s X500s X250s X100s X50s X10s X5s X3s X1s
> 1      A     47    63    75   116   125  129  131 131 131 131
> 2      B     37    64    45    11    25   19   61 131 186 186
> 3      C     17    62    25    66    12   29   91 171 186 186
> 
> 
> the idea is to get a graph like this excel, but in R,
> as I'm still in the learning phase of the R, I have little knowledge how
> to
> do
> 
> http://imageshack.us/photo/my-images/51/testlt.png/
> 
> --
> View this message in context:
> http://r.789695.n4.nabble.com/graph-displays-tp4634448p4634488.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.

____________________________________________________________
Receive Notifications of Incoming Messages
Easily monitor multiple email accounts & access them with a click.
Visit http://www.inbox.com/notifier and check it out!



More information about the R-help mailing list