search_results_import {act} | R Documentation |
Import search results
Description
Search results will be imported from an Excel '.xlsx' file or a comma separated values '.csv' file into a search object.
Usage
search_results_import(
path,
revertReplacements = TRUE,
sheetNameXLSX = "data",
encodingCSV = "UTF-8",
separatorCSV = ";"
)
Arguments
path |
Character string; path to file from where data will be loaded. |
revertReplacements |
Logical, when exporting search results from act, '=' at the beginning of lines are replaced by '.=", and in numbers the decimal separator '.' is replaced by a ",". If |
sheetNameXLSX |
Character string, set the name of the excel sheet containing the data. |
encodingCSV |
Character string; text encoding in the case of CVS files. |
separatorCSV |
Character; single character that is used to separate the columns in CSV files. |
Value
Search object.
Examples
library(act)
# Search
mysearch <- act::search_new(examplecorpus, pattern="yo")
nrow(mysearch@results)
# Create temporary file path
path <- tempfile(pattern = "searchresults", tmpdir = tempdir(),
fileext = ".xlsx")
# It makes more sense, however, to you define a destination folder
# that is easier to access on your computer:
## Not run:
path <- tempfile(pattern = "searchresults",
tmpdir = "PATH_TO_AN_EXISTING_FOLDER_ON_YOUR_COMPUTER",
fileext = ".xlsx")
## End(Not run)
# Save search results
act::search_results_export(s=mysearch, path=path)
# Do your coding of the search results somewhere outside of act
# ...
# Load search results
mysearch.import <- act::search_results_import(path=path)
nrow(mysearch.import@results)
[Package act version 1.3.1 Index]