Skip to content
Prev 383284 / 398502 Next

A simple string alienation problem

Hi

attachement did not went through, only limited attachement types are allowed - see Posting guide.

I am not sure if R is the best possibility to remove some characters. If " is at the end of all your strings
structure(list(V1 = c("adfvadfg\"", "sdfasd\"", "vafdv\"", "hjk/tiuk\""
)), class = "data.frame", row.names = c(NA, -4L))
combination of sapply, apply and substr could remove trailing ".
V1        
[1,] "adfvadfg"
[2,] "sdfasd"  
[3,] "vafdv"   
[4,] "hjk/tiuk"
And splitting acccording to / is simpler but it ends in list
$adfvadfg
[1] "adfvadfg"

$sdfasd
[1] "sdfasd"

$vafdv
[1] "vafdv"

$`hjk/tiuk`
[1] "hjk"  "tiuk"

Changing to data frame you could find yourself, I believe it is mentioned several times on Stackexchange, simple as.data.frame is not a best option.

Cheers
Petr