[R] editing import data, strings

gaja gajahorvat at hotmail.com
Fri Feb 17 18:24:30 CET 2012


Regards.

I'm a beginner in programing, so I have a basic question for you.
If someone could help me please..

I want to create a function, which will be able to export files from excel.
I tried with
a <- read.csv(file, sep =",", as.is = TRUE, row.names = 1, header = TRUE),

.. but instead of numbers, it gives me strings for example: "299,311".

I can handle this string for example:
b <- "299,311"
as.numeric(gsub(",", "", b))
299311

Now, I´m interested how to inport it from that file,.

I tried with
a <- read.csv(file, sep =",", as.is = TRUE, row.names = 1, header = TRUE)
a <- gsub(",", "", a)
a <- as.numeric(a)

But it doesn't work.
I used search engine on forum, but didn't find any function that I could
help with.

I would be very gratefull if someone could help me.

Gaja

--
View this message in context: http://r.789695.n4.nabble.com/editing-import-data-strings-tp4397899p4397899.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list