[R] using csv file for stacked bar plot, rows to columns

Davis_fishgirl lrledesma at gmail.com
Thu Oct 13 00:11:18 CEST 2011


**NEW TO R**-been trying to teach myself with no prior experience in
computer languages, so I apologize if I am poor at using technical terms
Hi, I have perused some of the previous posts on this topic and tried their
solutions, but am still coming up with error messages(sometimes more than 50
at a time)

I have:
a csv file with four columns(that I have read into R, no problem, we will
call it DATA)
date, Location1, Location2, total

Dates cover almost a year
location values are number of fish seen at that location

I would like to show a stacked bar plot so someone can see the breakdown for
total fish seen on any particular day.  I was able to create a simple bar
plot for total number of fish versus Date, but when I have tried to make a
stacked graph it creates four bars(one for each column). 

Do I have to convert my data so each date has its own column or is there a
way I can use my data as is?

script I have tried:

barplot(as.matrix(DATA))

barplot(t(DATA),names.arg=DATA$Date)

fish<-table(DATA$Location1,DATA$Location2)
barplot(fish,names.arg=DATA$Date)

Any help is appreciated.


--
View this message in context: http://r.789695.n4.nabble.com/using-csv-file-for-stacked-bar-plot-rows-to-columns-tp3899909p3899909.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list