View source: R/parseCharInput.R
parseCharInput | R Documentation |
The "parseCharInput" function converts a comma-seperated string into a vector by splitting the string along the commas. If "convertToNumeric" is true, the elements of the string will be converted into numbers and a numeric vector will be returned.
parseCharInput(
input,
convertToNumeric = TRUE,
sort = FALSE,
expected,
msg = "wrong length",
checkdup = FALSE,
missingMsg = "Unknown",
checkProb = FALSE,
valid = FALSE
)
input |
(Required) The string to be processed |
convertToNumeric |
(Optional) A logical value. Should the input should be converted into numerics? TRUE by default |
sort |
(Optional) A logical value. Should the resulting vector be sorted. FALSE by default |
expected |
(Optional) The expected length of the output vector. No check is performed by default |
msg |
(Optional) Error message to print if the input is not of the correct length specified by "expected". Default is "Wrong length" |
checkdup |
(Optional) A logical value. Should an error be generated if there are any duplicated value? FALSE by default |
missingMsg |
(Optional) Error message to print if the input is missing. Default is "Unknown" |
checkProb |
(Optional) A logical value. Should the function check that the output vector sums to one? FALSE by default |
valid |
(Optional) A logical value. Should the |
A numeric vector or a character vector depending on the
convertToNumeric
flag.
Romain Francois
parseHashString
uses parseCharInput
sequentially.
## Not run:
parseCharInput( "1,2,4")
parseCharInput( "1,6,4", sort = TRUE )
## see also the unit tests for more examples
file.show( system.file( "Runit", "runit.supportfunctions.R" ,
package = "MSToolkit"))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.