I'm trying to convert this:
> j[1:5]
NA06985 NA06991 NA06993 NA06994 NA07000
Into this:
c("NA06985","NA06991","NA06993", "NA06994", "NA07000")
I've tried using as.character but it gives me:
> as.character(j[1:5])
[1] "10" "10" "10" "10" "10"
Help please! -Josh
EDIT: Okay so I think I figured it out. After doing class(j) I found that it was of type data.frame. So I converted to as.matrix and it worked..hooray!
Okay so I think I figured it out. After doing class(j) I found that it was of type data.frame. So I converted to as.matrix and it worked..hooray!
paste(j[1:5])
This works for strings, factors, numerics, pretty much anything that can be displayed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With