When importing data using readxl into R (i don't have the other version requiring java as it won't install), using col_names = false, the data will import as characters instead of numbers - which means I can't actually do any functions on them. Similarly, using writexl when creating a table, making col_names = false also turns numbers into text. I can't seem to find a workaround for this (I can't seem to find a function where I can create custom column names so I tried converting the characters into numbers using:
databook[] <- lapply(databook, function(x) as.numeric(as.character(x)))
this worked, however the row that had the specific column titles I wanted (which were letters only) disappeared. I had to import the table using col_names = FALSE because colmn 2 onwards all have the same title and so when r imports it they rename the column titles which I don't want. I tried specifying a particular set of rows on which to run the changes:
databook[2:13,] <- lapply(databook, function(x) as.numeric(as.character(x)))
However, this caused it to no longer convert the characters (using str(databook)
returned chr results instead of num). Furthermore, a random empty row was added in row 2, giving me 14 rows when the original table had 13.
I'd be grateful for any help fixing this.