firstever firstever - 5 months ago 63
R Question

Set delimiter for rxImport

I am currently trying to use the rxImport:

mycsv <- file.path(dataDir, "TAQ_TNQ_OPR_DER_ALL_01M_20130403_01.txt")
output<-file.path(dataDir, "data.xdf")
rxImport(inData = mycsv, outFile = output, overwrite = TRUE,)

However I need the delimiter on my file is set to '|'.

In standard file read in R:

data<-read.table(FILENAME, sep = "|", VERBOSE = TRUE,)

I can set the delimiter. How do I do this with rxImport?


You define the characteristics of your text input file (i.e. csv) using RxTextData.

Try something like this:

input <- RxTextData("inputfile.csv", delimiter = "|")
rxImport(input, outfile = "mydata.xdf")