It looks like you've gotten answers elsewhere, but for completeness, I'll
explain my shot in the dark:
The construction
function (x) sin(x^2)
to pick one example, is what's called an anonymous (or lambda) function. In R,
they are often used in conjunction with the *apply() family to describe
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
Is this what you want to do: this will remove the commas and convert to numeric
> x <- read.csv("C:\\jph\\indicatorgapminderpopulation.csv"
+ , as.is = TRUE
+ , check.names = FALSE
+ )
>
> # convert to numeric column 2+
> for (i in 2:ncol(x)){
+ x[, i] <-
Thanx for posting. :)
I'm posting a link to excel file, same as I want import to table.
Its dl link, don't be mad, hehe
http://spreadsheets.google.com/pub?key=phAwcNAVuyj0XOoBL_n5tAQ&output=csv
Thanx,G.
ps: @Michael Weylandt;
Thanx for your code,... I tried to used it, but unsucsesfully. I rea
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 wrote:
> Regards.
>
> I'm a beginner in programing, so I have a basic q
If you know all your data should be numeric, you could perhaps try
something like this:
apply(a, 2, function(x) as.numeric(gsub(" ", "", x)))
but it can't be tested without your actual data. (Look at dput() for
the best way to send data by email)
Michael
On Fri, Feb 17, 2012 at 12:24 PM, gaja
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 numbe
7 matches
Mail list logo