I have multiple CSV files to upload to RStudio. Based on Google search, I have found many ways to upload these files. I want all the csv files to be in one data frame and change some column type to char. I am trying method below:
library(tidyverse)
library(readr)
myfiles = list.files(path="~/csvreports", pattern="*.csv", full.names=TRUE)
do.call(rbind, lapply(myfiles,
function(x) read.csv
(x, col_types = cols(`Plugin ID` = col_character(),
CVSS = col_character(),
Port = col_character())))
)
However I get this error:
source('~/r4ds/uploadcsv.R')
Error in read.table(file = file, header = header, sep = sep, quote = quote, :
unused argument (col_types = list(cols = list(Plugin ID = list(), CVSS = list(), Port = list()),
default = list()))
My question other than how to fix this is, is this the best method to achieve what I wanted?
Is it better to have it in one data frame or each file as one data frame?
Thanks