Remove first character from a string

r, regex

Solution

Try:

> mylist <- list("XN5634_er", "X123_er", "NX45")
> gsub("^X", '', mylist)
[1] "N5634_er" "123_er"   "NX45" 

Problem

Is there a way to remove or replace with `""`, the `"X"` from the beginning of words? Ex: XN5634_er X123_er NX45 Desired output: N5634_er 123_er NX45 Totally I have about 14.000 words. I used ``` gsub("X", '', mylist, fixed = T) ``` but `X` is removed from `NX45` too.

Original source