I have a rather baffling problem:
I have imported a data table (with both float and string valued entries) from a database using RODBC, but when I try to select a column (with text values), it gets coerced into integers. Is there any way to make it remain a string valued column?
> myvect <- mydat$NummerpladeTyper
> myvect[1:5]
[1] Hvid Hvid Hvid Hvid Hvid
Levels: Brugt gul Gul hvid Hvid
> str(myvect)
Factor w/ 6 levels "","Brugt","gul",..: 6 6 6 6 6 6 6 6 6 6 ...
> typeof(myvect)
[1] "integer"
I would want it to retain the levels "Brugt", "gul", "Gul", "hvid", "Hvid" instead of coercing "Hvid" into 6 etc.
Thanks!