[R] Data Manipulation
Joshua Wiley
jwiley.psych at gmail.com
Fri Sep 10 18:19:15 CEST 2010
Hi,
Yes, the table() function is not to read the data, but to do the
frequency counts of each level. I just included the read.table() part
so that you could copy and paste my code, but I did not include the R
output from table(dat).
> table(dat)
dat
A B C D
3 3 2 1
It nicely tallies for you. Also, you can look at a simple plot:
# you will have to run this in your R
# because I do not know an easy way to include graphs
plot(table(dat))
You can also save the results in a new variable and then access portions of it:
> my.table <- table(dat)
> my.table # the full table
dat
A B C D
3 3 2 1
> my.table[2] # just extract the second element
B
3
>
Cheers,
Josh
On Fri, Sep 10, 2010 at 9:11 AM, dfong <dfong at medicine.umaryland.edu> wrote:
>
> I'm actually importing it from a CSV, so I already have that in a table. But
> i Can't make a graph with text. I assume I need to do some counting in order
> to draw the graph?
> Any example of this?
>
> thanks
> --
> View this message in context: http://r.789695.n4.nabble.com/Data-Manipulation-tp2534662p2534690.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.
>
--
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/
More information about the R-help
mailing list