mode(x) <- "double"

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

mode(x) <- "double"

aledanda
Hi,
I need your help!!
I imported a big coloumn vector from a txt file but it results as mode :"list" I want to change it in numeric otherwise I can't do my analysis. This is what i get:

mode (data) <- "double"
Error in eval(expr, envir, enclos) :
 (list) object cannot be coerced to type 'double'

>


Thanks a lot!!!

Alessandra
Reply | Threaded
Open this post in threaded view
|

Re: mode(x) <- "double"

Dimitri Liakhovitski
Can you give an example of your .txt file that you are reading in?

On Wed, Apr 29, 2009 at 1:38 PM, aledanda <[hidden email]> wrote:

>
> Hi,
> I need your help!!
> I imported a big coloumn vector from a txt file but it results as mode
> :"list" I want to change it in numeric otherwise I can't do my analysis.
> This is what i get:
>
> mode (data) <- "double"
> Error in eval(expr, envir, enclos) :
>  (list) object cannot be coerced to type 'double'
>>
>
>
> Thanks a lot!!!
>
> Alessandra
> --
> View this message in context: http://www.nabble.com/mode%28x%29-%3C--%22double%22-tp23296727p23296727.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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.
>



--
Dimitri Liakhovitski
MarketTools, Inc.
[hidden email]

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: mode(x) <- "double"

aledanda
In reply to this post by aledanda
SOLVED:

I imported again the data like this:

data <- scan ("data.txt")

Thanks Phil Spector!

Alessandra

aledanda wrote
Hi,
I need your help!!
I imported a big coloumn vector from a txt file but it results as mode :"list" I want to change it in numeric otherwise I can't do my analysis. This is what i get:

mode (data) <- "double"
Error in eval(expr, envir, enclos) :
 (list) object cannot be coerced to type 'double'

>


Thanks a lot!!!

Alessandra
Reply | Threaded
Open this post in threaded view
|

Re: mode(x) <- "double"

Giovanni Petris
In reply to this post by aledanda

>
> Hi,
> I need your help!!
> I imported a big coloumn vector from a txt file but it results as mode
> :"list" I want to change it in numeric otherwise I can't do my analysis.

How did you "import" the data? What function did you use?

> This is what i get:
>
> mode (data) <- "double"
> Error in eval(expr, envir, enclos) :
>  (list) object cannot be coerced to type 'double'
> >
>

Maybe unlist(data), but to get a more precise answer you have to tell
us how you read the data in R

Best,
Giovanni


>
> Thanks a lot!!!
>
> Alessandra
> --
> View this message in context: http://www.nabble.com/mode%28x%29-%3C--%22double%22-tp23296727p23296727.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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.
>
>

--

Giovanni Petris  <[hidden email]>
Associate Professor
Department of Mathematical Sciences
University of Arkansas - Fayetteville, AR 72701
Ph: (479) 575-6324, 575-8630 (fax)
http://definetti.uark.edu/~gpetris/

______________________________________________
[hidden email] 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.