Reputation: 381
I tried to call a zip file using fread as like this
data<-("www/608.zip")
test<- fread('gunzip -cq data')
It showed this error does not exist or is non-readable
But it will work if I call
test<- fread('gunzip -cq www/608.zip')
On my script each time value of data will change so I used If command for choosing data as like this
data<-reactive({
if (input$list == 'all')
{
"www/6.zip"
}
else{
if (input$list == 'hkj')
{
"www/6.zip"
}
Upvotes: 1
Views: 212
Reputation: 887241
We can also use glue
data <- "www/608.zip"
fread(cmd = glue::glue("gunzip -cq {data}"))
Upvotes: 1
Reputation: 121
If you want to read the file path you can use paste0
to create the string
data <- "www/608.zip"
test <- fread(cmd = paste0("gunzip -cq ", data))
fread
suggest to use cmd argument for security reasons.
Upvotes: 1
Reputation:
I think it should work as follows:
data <- "www/608.zip"
test <- fread(cmd = paste("gunzip -cq", data))
i.e. you have to create a command string with paste()
first and then pass it as cmd
argument to fread()
.
Upvotes: 2