identify_common_string {chillR} | R Documentation |
Identify shared leading or trailing character strings
Description
Compares all elements of a vector of numbers or character strings and returns TRUE if they are all the same, FALSE otherwise.
Usage
identify_common_string(strings, leading = TRUE)
Arguments
strings |
vector of strings to be evaluated. |
leading |
boolean variable indicating whether the function should look for common strings at the beginning (leading==TRUE) or end (leading==FALSE) of the strings. Default is TRUE. |
Value
if there is a leading (if leading==TRUE) or trailing (if leading==FALSE) string that all elements of strings have in common, this string is returned; NA otherwise.
Author(s)
Eike Luedeling
Examples
identify_common_string(c("Temp_01","Temp_02","Temp_03"))
identify_common_string(c("Temp_01","Temp_02","Temp_03"),leading=FALSE)
identify_common_string(c("file1.csv","file2.csv","file3.csv"),leading=FALSE)
[Package chillR version 0.75 Index]