[R] Create Pie chart from .csv file

Richard.Cotton at hsl.gov.uk Richard.Cotton at hsl.gov.uk
Thu May 7 12:50:04 CEST 2009


> Ive found out a way around my problem. I was trying to plaot a histogram 
of
> strings, but I had to change it into integers. I ran an sql query on the
> original DB that I got the CSV file from and used COUNT to get the 
number of
> each unique item in a given column. I then used these numbers to create 
a
> histogram in R. It's a round about way of doing it, but it will have to
> suffice.

Glad you found a solution to your problem.  For future reference, an 
easier way to convert strings to numbers is to use as.numeric or 
as.integer.

as.numeric("1.23")              # 1.23
as.integer("4")         # 4

If the process of reading in your data from the CSV file converts the 
strings to factors, then see the FAQ on R (
http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-do-I-convert-factors-to-numeric_003f).

Regards,
Richie.

Mathematical Sciences Unit
HSL


------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}




More information about the R-help mailing list