Removing the first character from a string

Is there any way to remove or replace "" , "X" from the beginning of words?

Example:

XN5634_er
X123_er
Nx45

Required Conclusion:

N5634_er
123_er
Nx45

I have about 14,000 words in total. I used

 gsub("X", '', mylist, fixed = T) 

but X also removed from the NX45 .
Can anybody help me?

+6
source share
1 answer

Try:

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

All Articles