On 18-03-2013, at 19:57, Pietro <freeri...@gmail.com> wrote:

> Yes, it's true Berend!
> 
> What i do is simply use read.xlsx  function
> 
> db <- read.xlsx2("c:/mydb.xlsx",1,as.data.frame=T)
> 
> This is excel file i use:
> http://dl.dropbox.com/u/102669/mydb.xlsx
> 

I don't have the required packages installed to read .xlsx files since I have 
no need.
But I can load your xlsx in LibreOffice without any issues.
I'm not sure what read.xslx2 actually does with columns. It seems that is 
regards the colClass of all columns as "character".
So maybe you should try read.xlsx or export the file as a .csv
Or specify colClasses.

Berend


> I can't find  a way to import as numeric.
> My objective is to be able to work (in R) with my NA's
> 
> 
> At 18.46 18/03/2013, Berend Hasselman wrote:
> 
>> On 18-03-2013, at 16:49, Pete <freeri...@gmail.com> wrote:
>> 
>> >
>> > I have this little data.frame
>> >
>> > http://dl.dropbox.com/u/102669/nanotna.rdata
>> >
>> > Two column contains NA, so the best thing to do is use na.locf function 
>> > (with
>> > fromLast = T)
>> >
>> > But locf function doesn't work because NA in my data.frame are not 
>> > recognized as
>> > real NA.
>> >
>> > Is there a way to substitute fake NA with real NA? In this case na.locf 
>> > function
>> > should work
>> >
>> 
>> Your data are all characters. Do
>> 
>> str(db)
>> 
>> to see that. What is probably supposed to be numeric is also character,
>> Somehow you have managed to read in data that R thinks is all chr.
>> Your NA are "NA" in reality: a character string "NA".
>> 
>> You will have to review the method you used to get the data into R.
>> And make sure that what you want to be numeric is indeed numeric.
>> Then you can start to think about doing something about the NA's.
>> 
>> Berend
> 

______________________________________________
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.

Reply via email to