dplyr - Ignore first four characters from tibble in R -


this question has answer here:

i have tibble want remove first 4 letters. unable it. tried substr() , substring() tend merge rows.

here's data:

dput(a) structure(list(value = c("abc-efgh-1234ijk-45k", "ijk-lokk-tiu" )), .names = "value", row.names = c(na, -2l), class = c("tbl_df",  "tbl", "data.frame")) 

expected output:

"efgh-1234ijk-45k" "lokk-tiu" 

here's tried:

try #1:

substr(as.data.frame.array(a),4,nchar(as.data.frame.array(a))) 

but output is:

"t(`c(\"abc-efgh-ijk\", \"ijk-lokk-tiu\")` = 1:2)" 

try#2:

stringr::str_sub((as.data.frame.array(a)),start = 4, end = nchar((as.data.frame.array(a)))) 

the output is:

"t(`c(\"abc-efgh-ijk\", \"ijk-lokk-tiu\")` = 1:2)" 

i'd appreciate help.

this should work you

substr(a$value,5,nchar(a$value)) 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -