Skip to content

Convert factor to "double"?

3 messages · p.silva at gmx.net, Uwe Ligges

#
Hi!

I'm reading a tab-seperated CVS file with:
test1 <- read.table("data.txt", header=TRUE)

It's in the following format:

Date_Time qK qL vL vP  ...
0         30 22 110 88 ...
...

(BTW: It seems to me R shifts the column descriptions by one.)

Anyway, I would like to Fourier-transform one column. So I say:
Error in levels(x)[x] : invalid subscript type 'complex'

I guess this is some typing error but I don't know which function I have to use for conversion.

Some more Info about the data:
[1] 110 108 116 118 114 120 117 111 95  118
166 Levels: - 0 1 10 100 101 102 103 104 105 106 107 108 109 11 110 111 ... 99
[1] "factor"


I would appreciate any hints! Thanks in advance!

Best, Philip
--
#
p.silva at gmx.net wrote:
No, look into your data file first.
Obviously there is some "-" sign in your data file. You might want to 
fix that prior to importing the data. You cannot convert easily to 
numeric with artifacts like the string "-" in your data.

Uwe Ligges
#
Thanks a lot! This works now!

Philip Silva
--