I have to read a CSV file which has some comment lines(start with #) along with data rows. fread
function is used to read this CSV file.
config <- fread("Configuration.csv")
In this file number of lines are not fixed they might be changed. How to read the CSV without these comment lines.
Thanks in Advance!!!
You can try to clean the data using grep before, not after:
config <- fread("grep -v '^#' Configuration.csv")
UPDATED:
If the aim of using fread() is to convert the data to data.table only, you can use read.table() instead with default comment.char="#" and then convert the result into data.table:
config <- as.data.table(read.table(header = TRUE, "Configuration.csv"))
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