Hello,

Try the following.

gsub("^0+", "", as.character(nCourse))


Hope this helps,

Rui Barradas

Em 01-09-2013 21:41, Robert Lynch escreveu:
I have a variable that is course #
nCourse <-
as.factor(c("002A","002B","002C","007A","007B","007C","101","118A","118B","118C"))

And I would like to get rid of the leading zeros, and have the following
set
("2A","2B","2C","7A","7B","7C","101","118A","118B","118C") to paste()
together with the department, "B","P","C" (bio, phys, & chem etc)

I am stuck trying to figure out regular expressions, they are new to me.

Thank You very much

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to