Answers for "r remove everything before character"

R
0

r substitute string character until :

foo <- "TF_list_to_test10004/Nus_k0.345_t0.1_e0.1.adj:PKMYT1"

# Remove all before and up to ":":
gsub(".*:","",foo)

# Extract everything behind ":":
regmatches(foo,gregexpr("(?<=:).*",foo,perl=TRUE))
Posted by: Guest on May-30-2020
0

r remove all string before : in r data frame

> x <- 'aabb.ccdd'
> sub('.*', '', x)
[1] ""
> sub('bb.*', '', x)
[1] "aa"
> sub('.*bb', '', x)
[1] ".ccdd"
> sub('\..*', '', x)
[1] "aabb"
> sub('.*\.', '', x)
[1] "ccdd"
Posted by: Guest on May-30-2020

Code answers related to "r remove everything before character"

Browse Popular Code Answers by Language