Read columns of a csv file using shell or pipe inside R - Windows -


i'm looking way of reading few columns csv file r using shell() or pipe.

i found thread explains how accomplish on linux: quicker way read single column of csv file

on linux works adding what argument:

a <-as.data.frame(scan(pipe("cut -f1,2 -d, main.csv"),                        what=list("character","character"),sep= ",")) 

however doesn't seem work on windows.

when using pipe("cut -f1 -d, main.csv") connection gets opened doesn't return anything.

what functions/syntax need use in order make work on windows.

is possible accomplish using shell()?

thanks,

diego

make sure cut on path - in rtools. works me:

# check cut availble sys.which("cut")  # create test data lines <- "a,b,c 1,2,3 4,5,6" cat(lines, file = "in.csv")  # read df <- read.csv(pipe("cut -f1,2 -d, in.csv")) 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -