> How do you do a bar chart of 2 vectors?
> I have one vector which has 10 numbers, and another which has 10 names.
> The numbers are the frequency of the corresponding name, but when I do a bar
> chart it says that there is no height. Thanks.
The first thing we'd need to know is HOW you tried to create the bar
chart. R usually offer quite a lot different ways to tackle a problem
so knowing what exactly you did helps a lot in helping.
That said, I'll assume you tried the barplot() command which would
work e.g. like this:
v1 <- 1:3
v2 <- c('A', 'B', 'B')
barplot(v1, names.arg=v2)
If v1 is a named vector things are even easier:
names(v1) <- v2
barplot(v1)
As I said, there are a bunch of other ways - e.g. using the lattice function
barchart() which works a bit differently.
cu
Philipp
--
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
Maximus-von-Imhof-Forum 3
85354 Freising, Germany
http://webclu.bio.wzw.tum.de/~pagel/
______________________________________________
[email protected] 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.