[R] Question about making histogram and x must be numeric

9man lucas_9man at hotmail.com
Sun Nov 18 22:45:05 CET 2012


Hello all,

I hope someone of you can help me out, I have searched other posts as well
but I can't find any solution to the problem I'm dealing with.

I want to make a histogram from the data Telephone Lines

MDGdataset <-read.csv("MDG_dataset_2010.csv", header=T)
MDGdatasetAdapted <- subset(MDGdataset, select = c(Country_Code,
Country_Name, Year, GNI.per.capita..Atlas.method..current.US..,
Telephone.lines..per.100.people., Internet.users..per.100.people.))
MDGdatasetAdapted
MDGdatasetAdapted <- na.omit(MDGdatasetAdapted)
names(MDGdatasetAdapted) <- c("Code","Country","Year","GNI","Telephone
Lines","Internet Users") 

Then I do as follows:

hist(MDGdatasetAdapted$Telephone.Lines, ylab="Frequency", xlab="Telephone
Lines per 100 people", main="Frequency of telephone lines per 100 people",
nclass=100)

To give an example, the first 2 lines of the MDGdatasetAdapted dataset look
like this:
  Country_Code                            Country_Name Year
GNI.per.capita..Atlas.method..current.US.. Telephone.lines..per.100.people.
Internet.users..per.100.people.

1            AFG                             Afghanistan 2010                                       
410                              0.1                             3.7

What am I doing wrong for getting the message:
Error in hist.default(MDGdatasetAdapted$Telephone.Lines, ylab = "Frequency", 
: 
  'x' must be numeric 

??
Please help me out I would be eternally grateful



--
View this message in context: http://r.789695.n4.nabble.com/Question-about-making-histogram-and-x-must-be-numeric-tp4649979.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list