Try this:

setClass("myClass")
setAs("character", "myClass", function(from)as.numeric(gsub(",", "", from)))

d <- read.table("clipboard", sep = ",", check.names = FALSE, quote = '"',
header = TRUE, fill = TRUE, colClasses = c('character', rep('myClass',
232)))

On Fri, Feb 17, 2012 at 3:24 PM, gaja <gajahorvat@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@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.
>



-- 
Henrique Dallazuanna
Curitiba-Paranį-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]

