Learn R Programming

RQDA (version 0.1-6)

SearchFiles: Search files

Description

Search files according to the pattern.

Usage

SearchFiles(pattern, content = FALSE, Widget = NULL, is.UTF8 = FALSE)

Arguments

pattern
The criterion of search, see examples section for examples.
content
When it is TRUE, the content of files fitting the pattern will be returned as well.
Widget
The name of a gtable widget. If it is not NULL, the file names fitting the pattern will pushed to that gtable widget using svalue method. One useful value is .rqda$fnames_rqda, so the file names will be pushed to the Files Tab of RQDA.
is.UTF8
If the coding of pattern is UTF-8. If you are not sure, always use FLASE.

Value

  • A data frame with variables:
  • idThe file id.
  • nameThe file name.
  • fileThe file content. Only return when content is TRUE.

Details

This function use select statment of sql to search files (from source database table). The pattern is the WHERE clause (without the keyword WHERE). For more information, please refer to the website of SQLite syntax. All data in *.rqda use UTF-8 encoding, so the encoding of pattern matters. It will be converted to UTF-8 if it is not (is.UTF8=FALSE).

References

http://www.sqlite.org/lang_expr.html

See Also

gtable, localeToCharset

Examples

Run this code
SearchFiles("file like '%keyword%'") ## search for files who contain the word of "keyword"
SearchFiles("file like 'keyword%'") ## search for files whose conent begin with the word of "keyword"
SearchFiles("name like '%keyword'") ## search for files whose name end with the word of "keyword"
SearchFiles("name like '%keyword one' and file like '%keyword tow%' ") ## combined conidtions

Run the code above in your browser using DataLab