cannot draw a histogram on R

#1
Im trying to draw a histogram with the code below.

stat <- read.csv("C://Desktop//lung cancer.csv",header=T)
x = (2000:2013)
y = (0:12000)
hist(stat$Year,stat$Cases, ylab="Cases",xlab="Year",main="Number of cases of Lung Cancer:2000-2013")



error message:

> hist(ylab="Cases",xlab="Year",main="Number of cases of Lung Cancer:2000-2013")
Error in hist.default(ylab = "Cases", xlab = "Year", main = "Number of cases of Lung Cancer:2000-2013") :
argument "x" is missing, with no default
> stat <- read.csv("C://Heramba//Desktop//lung cancer.csv",header=T)
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file 'C://Heramba//Desktop//lung cancer.csv': No such file or directory
 

hlsmith

Omega Contributor
#2
I don't use R a bunch, but can you run this line by line to better figure out where the error(s) is.


And maybe do some basics like just run the following:
summary(stat)
x
y


P.S., is the double slashes a thing? "//"
 

rogojel

TS Contributor
#3
hi,
why do you have 2 parameters for the hist call? It only needs one. My guess is that you want a barchart of the number of cases per year. Something like:

Years=as.character(D$Years)
barplot(D$Counts, names.arg=Years)


regards