I have a virtual machine with many TXT files. I usually use an ssh and pipe connection to be able to read the files. When I use the read.csv function there is no problem at the time of reading the files. Already when I use the fread function, the business does not work. First show the case that works!
# my directory with the plink intallation (plink.exe)
dir<- "C/Tools/Terminal/"
setwd(dir)
user <- 'XXXXXX'
password <- 'XXXX'
dir_file_machine <- '/media/projects/'
name_file <- 'XXXXXX.TXT'
capture_file <- pipe(paste0('plink -ssh ',
user,
'@123.45.678.901 -P 12 -pw ', #fictice
password,
' "cat ',
dir_file_machine,
name_file))
a <- read.csv(capture_file, sep = ";")
Now when I use the fread function the following error occurs ...
capture_file <- pipe(paste0('plink -ssh ',
user,
'@123.45.678.901 -P 12 -pw ', #fictional
password,
' "cat ',
dir_file_machine,
name_file))
a <- fread(capture_file, sep = ";")
Error in fread(capture_file) :
'input' must be a single character string containing a file name, a command, full path to a file, a URL starting 'http[s]://', 'ftp[s]://' or 'file://', or the input data itself
Any ideas?