Description Usage Arguments Value Examples
View source: R/numberForLevelsAddTable.R View source: R/numbersForLevelsAddTable.R
numberForLevelsAddTable takes as input a data.frame object (dfData
), a character vector containg column names (dfColNameVec
), a list of numeric vectors (vecList
), a name for the output data.frame object (outputDfName
) and the storage path (outputDir
). The output is a data.frame object and a .xlsx file containing new columns with numbered levels. The outputs are stored at the location specified by the storage path.
1 | numberForLevelsAddTable(dfData, dfColNameVec, vecList, outputDfName, outputDir)
|
dfData |
a data.frame object. Note that this is not a character string but the data.frame object itself. The parameter passed to the function should be without quotes (" "). |
dfColNameVec |
a string or a vector of class character indicating the name(s) of the column(s) of |
vecList |
a numeric vector or a list of numeric vectors. Each vector contains numbers that are to be assigned to the levels of the respective column. The number of vectors in the list should be equal to the number of column names in |
outputDfName |
a character string indicating the name of the output data.frame object |
outputDir |
a character string indicating the storage path for the output .xlsx file |
numberForLevelsAddTable returns a data.frame object and an xlsx file containing a column for each column in dfColNameVec
. In every new column the entries of the corresponding original column are replaced by numbers (as specified by vecList
) assigned to the levels for each column. Additionally, it also prints the output data.frame object in the console window.
1 2 3 4 5 6 7 8 9 10 | numberForLevelsAddTable(mainTable,c("col1","col2"),
list(c(0,4,3),c(0,1,1.5,2,3)),
"newTabName","D:/FolderName/")
numberForLevelsAddTable(warpbreaks,c("wool","tension"),
list(c(1:2),c(1,5,10)),
"df_numberForLevelsAddTable",
"D:/Work/")
numberForLevelsAddTable(iris,"Species",c(1:3),
"df_numberForLevelsAddTable2",
"D:/Work/")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.