My dataset in csv format (available here) is as follows:
I tried to import the data into R with the following document:
library(tidyverse)
data <- read_csv("<Path to file>\\Sample.csv")
When I tried to extract column with data$
, I get the error:
Error in gsub(reStrip, "", completions, perl = TRUE) :
input string 4 is invalid UTF-8
Column D of my data contains both numbers and special characters * and the Pilcrow symbol. The number in the last last row for this column is 66.1 but is followed by #. Similarly, column I contains * and the Pilcrow symbol.
I want to clean the data so that for Column D and I, rows with * and the Pilcrow symbol are replaced with NA. In addition, "66.1 #" is converted to "66.1".
I would like to know how I could import the csv file into R and clean it to the desired format in R. Preferable with tidyverse.