How to make a tablet with R from a table?

I have some data in .cvs. I would like to make a simple barcode in R, with this data, but I am a bit lost in R.

Specie   Number
A        18756
V        8608 
R        3350 
P        3312 
O        1627


I already have the number of each instance. I just want to display the results? A, V, R, P, O - species names.

I am a little confused about what should I do first? Do I need to convert a table to a matrix? What commands do I need to use in R?


source to share

2 answers

Here's a simple example:

y = data.frame(Specie=c('A','V','R','P','O'),Number=c(18756,8608,3350,3312,1627))
barplot(y$Number, names.arg=y$Specie)


You have to use read.csv (or one of your friends) to read from the file into the Data Frame.



Try it help(barplot)

. There you will find a command that does what you need. Specifically, you enter Number as the height argument and Specie for the names.arg argument.



All Articles