11

I am tying to coerce from list form to numeric form. If it is of use, the list is originally drawn from a factor (and is 1x33 rows).

My list is defined by:

tmpseqsf[[1]]

which provides:

       TradeValue
1    72914431
2       25325
3       20139
4       ...

So based on other advice (Stackoverflow, etc) I use:

tmpx <-as.numeric(tmpseqsf[[1]])

but I get the error:

Error: (list) object cannot be coerced to type 'double'

And just confirming nothing has happened:

is.numeric(tmpseqsf[[1]])
[1] FALSE

Is there something I am completely missing?

Dale K
  • 25,246
  • 15
  • 42
  • 71
Tim
  • 113
  • 1
  • 1
  • 7

1 Answers1

17

If the values are of type factor, then you should convert them by as.numeric(as.character(unlist(tmpseqsf[[1]])))

ahly
  • 1,121
  • 7
  • 9