Library of alternativeFunction() in R

25 Views Asked by At

I am trying to read 2 different types of files, using the alternativeFunction(). So if the first file in .txt format could not be found, I could try with the second type in .csv format, but R tells me that the function is not found. Does anyone know the library I have to install?

File <- try(read.table('File.txt',sep=c(',','|'), header=TRUE))

Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file 'File.txt': No such file or directory

if("try-error" %in% class(File)) alternativeFunction(File <- read_csv('File.csv'))

Error in alternativeFunction(File <- read_csv("File.csv")) : could not find function "alternativeFunction"

0

There are 0 best solutions below