[R] editing import data, strings
jim holtman
jholtman at gmail.com
Fri Feb 17 19:06:50 CET 2012
At least post the first 10 lines of the file so that we can see what
it is. It may be that some of the data is enclosed in quotes, but it
is hard to tell without seeing the actual data.
On Fri, Feb 17, 2012 at 12:24 PM, gaja <gajahorvat at hotmail.com> wrote:
> 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.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.
More information about the R-help
mailing list