[R] data manipulation for plotting

John Kane jrkrideau at yahoo.ca
Thu Feb 14 20:05:18 CET 2008


Here are a couple of ways depending on what you want.

data1=c(1,1,1,4,5,5,6)
plot(table(data1))
---------------------------------------
plotvec <- as.vector(aa)
nns <- names(aa)
plot(plotvec, xaxt="n")
mtext(nns, at=1:4, side=1)
---------------------------------------
--- "rich at thevillas.eclipse.co.uk"
<rich at thevillas.eclipse.co.uk> wrote:

> 
>    Hi,
> 
>    i'd like to plot some data that I have with the
> value on the x axis and freq
>    on the y axis.
> 
>    So, I need to calculate the freq a value is seen
> within my data vector
> 
>    for example, say i have a vector of data
> 
>    data=c(1,1,1,4,5,5,6)
> 
>    I want
> 
>    values<-c(1,4,5,6)
> 
>    freq<-c(3,1,2,1)
> 
>    in order to enable me to plot this. Sorry, i'm
> new to R. What is standard
>    procedure here for plotting the data vector?
> 
>    cheers
> 
>    Rich
> 
> 
> 
> 
> 
>    
> ______________________________________________
> 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.
> 



[[elided trailing spam]]



More information about the R-help mailing list