[R] Converting character to numeric: Error: (list) object cannot be coerced to type 'double'

Rui Barradas ruipbarradas at sapo.pt
Fri Dec 7 16:16:13 CET 2012


Hello,

It's the column that you want to convert, not the data.frame.

f1 <- as.numeric(f$INE001A01036)

Hope this helps,
Rui Barradas
Em 07-12-2012 14:23, Vikram Bahure escreveu:
> Dear R users,
>
> I am facing a pretty a unusual problem while converting character to
> numeric. Any input would be appreciated.
>
> Below is the code and error faced:
> ---------------------------------------
> *> str(cmie.dts)*
> *'data.frame': 4397 obs. of  1 variable:*
> * $ INE001A01036: chr  "1482181740.000000" "1482181740.000000"
> "1482181740.000000" "1482181740.000000" ...*
> *> f1 <- as.numeric(f)*
> *Error: (list) object cannot be coerced to type 'double'*
> *-----------------------------------------*
> *
> *
> Thanks in advance.
>
> Regards
> Vikram
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.




More information about the R-help mailing list