I am just trying to convert a column of numbers, which R thinks are characters, to numerical values.
I have the following table:
> longtab=as.data.frame(table(long));head(longtab)
long Freq
1 189485 1
2 189486 1
3 189487 1
4 189488 1
5 189489 1
6 189490 1
I've created a new table from those data as follows:
> q=head(longtab);q
long Freq
1 189485 1
2 189486 1
3 189487 1
4 189488 1
5 189489 1
6 189490 1
When I test whether the "long" column is numeric, R tells me that it is not.
> is.numeric(q$long)
[1] FALSE
When I try to coerce "long" values to be numeric using as.numeric(), I get the following:
> as.numeric(q$long)
[1] 1 2 3 4 5 6
But these are the row numbers not the values in the "long" column. This seems like it should be a simple problem to fix but I am struggling and have been at this a while. Any help would be greatly appreciated.