I have a variable that displays distance in km but r is reading it as a factor. When I attempt to change it using as.numeric it seems that it just orders them. I've also tried as.numeric(as.character) and didn't seem to come to the solution.
Asked
Active
Viewed 22 times
0
-
1can you show `dput` of few rows of dataset and your expected output – akrun Apr 23 '20 at 22:52
-
Welcome to SO, instant_query! This question is extremely poor in the sense that we have no idea of your data structure and your demonstration of code is meager. Please make this question *reproducible*. This includes sample code you've attempted (including listing non-base R packages, and any errors/warnings received), sample *unambiguous* data (e.g., `dput(head(x))` or `data.frame(x=...,y=...)`), and intended output. Refs: https://stackoverflow.com/q/5963269, [mcve], and https://stackoverflow.com/tags/r/info. – r2evans Apr 23 '20 at 22:55
-
Imagine that you walk into a professor's office and say "this doesn't work". They might first ask *"what have you tried?"*, to which you respond by showing your code. Then they might say *"what data are you using?"*, to which you respond by giving a sample of data. They might then ask *"what is it about this output that you think is incorrect?"*, to which you respond by explaining what is wrong or showing them a frame with your expected output. We aren't (all) professors, but I think the methodology of how-to-ask on SO is similar. – r2evans Apr 23 '20 at 22:57