[R] graph displays

Jim Lemon jim at bitwrit.com.au
Tue Jun 26 14:24:44 CEST 2012


On 06/26/2012 06:24 PM, MSousa wrote:
>
>
> 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/
>
Hi MSousa,
Try this:

library(plotrix)
barp(Dataset[,-1],names.arg=rep("",10),col=2:4)
staxlab(1,at=1:10,labels=names(Dataset)[-1])
legend(2,170,Dataset$Source,fill=2:4)

Jim



More information about the R-help mailing list