Learn R Programming

RQDA (version 0.3-0)

write.FileList: Import a batch of files to the source table

Description

If importing a single file to the project, you can do it by clicking import button in the Files Tab. Sometimes, you want to import a batch of files quickly, you can do it by command. write.FileList can be used to import a batch of files into the source table in the *.rqda file. addFilesFromDir can add all files from a directory into *.rqda.

Usage

write.FileList(FileList, encoding = .rqda$encoding, con = .rqda$qdacon, ...)

addFilesFromDir(dir, pattern = "*.txt$")

Arguments

FileList

A list. Each element of the list is the file content, and the names(FileList) are the respective file name.

encoding

Don't change this argument.

con

Don't change this argument.

dir

Path of a directory where plain files are located.

pattern

Argument passed to list.files; only files matching this pattern are imported.

is not used.

Value

This function is used for the side-effects. No value is return.

Details

The file content will be converted to UTF-8 character before being written to *.rqda. The original content can be in any suitable encoding, so you can inspect the content correctly; In other words,the better practices is to used the corresponding encoding (you can get a hint by localeToCharset function) to save the imported files.

Examples

Run this code
# NOT RUN {
Files <- list("File name one"="content of first File.",
              "File name two"="content of the second File.")
write.FileList(Files) ## Please launch RQDA(), and open a project first.
# }

Run the code above in your browser using DataLab