.csv contains improper quoting and variable class


My .csv files have quoting like this:
""sp2" "ika2" "t114" "t115" "systbp2" "lenght" "weight" "bmi"". The beginning and ending shows backslashes in R.
When I import with Rio to a data.table the improper quoting warning goes of with quote = "", but the first column gender and last bmi are character columns and I need to merge columns with data.tables that gender as integer and bmi numeric. When I try to chance character class to integer and numeric, it turns out NULL.

What could be done? And what could be the purpose for beginning and ending quotes like this? I Have six tables that begin and end like this.

Desperately seeking for some ideas and help! :tired_face:

if your question is about turning character variables that represent numbers into numeric variables, then I recommend readr package, which has parse_number() function

Thank you, I will try that. Import with Rio package was nice, because it inhibited Excel corrupt laboratory values from turning to dates and other values when importing to R.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.