importData(file = "", format = NULL, drop = NULL, keep = NULL, control = NULL, stringsAsFactors = default.stringsAsFactors(), check.names = TRUE)
file | a character string containing the name of the file to read. The file extension determines the file format unless the format argument is supplied. |
format | a character string specifying the format of file. It must be one of the values from the FormatTag column in the stattranFileFormats data set. Typically, this argument is not required because if it is not supplied, the file extension on the file argument determines the format. |
drop | a character vector of variable names in file that are not included in the data frame created. All other columns are imported. If drop is specified, the keep argument cannot be used. |
keep | a character vector of column names from file that are imported. Only the columns listed are included in the data frame created. If keep is specified, the drop argument cannot be used. |
control | a named list of control options for the StatTransfer library. Typically, this is created in a call to stattran.control. |
stringsAsFactors |
a logical flag. If TRUE,
then imported character data columns are converted factors whose levels
are the unique strings in the column.
Note that as of version 5.2 of Spotfire Enterprise Runtime for R, default.stringsAsFactors() returns FALSE instead of the previous TRUE unless the user has execututed options(stringsAsFactors=TRUE) earlier in the session. This matches the same change in version 4.0.0 of open-source R. |
check.names | a logical flag. If TRUE (the default), then variable names are changed to legal object names by substituting . for illegal characters such as blanks, parentheses, or commas. (See make.names for details.) |
tf01 <- paste0(tempfile(), ".csv") df01 <- data.frame(x = 1:5, c = letters[11:15], d = seq.Date(as.Date("2011-05-23"), by=1, length.out=5)) n <- exportData(df01, file=tf01) importData(tf01)## Not run: # Read the sheet Helena from the CityIncome.xlsx file: importData("CityIncome.xlsx", control=list("table" = "Helena")) ## End(Not run)
## Not run: # Set "miss" in numeric columns to missing (NA): importData("nyc_rats.csv", control=list("num-miss-rd"="miss")) ## End(Not run)