Open main menu

kogic.kr β

Simple functions

Revision as of 13:28, 27 November 2018 by S (talk | contribs)

Contents

Split the elements of a character vector and select a element

Input

x <- "AAA@BBB"

Code

split_pick <- function(x , Div_str, Pick_num){

    return(as.character(as.data.table(strsplit(x, Div_str))[Pick_num])) 

}
split_pick(x, "@", 2)

Output

"BBB"