In R trying to write a function that takes the word MarsuPial and results in marsupiaL.
current code
mycap <- function(mystr = "") {
mystr <- tolower(mystr)
a <- substr(mystr, 1, 1)
b <- substr(mystr, 2, nchar(mystr))
paste(tolower(a), b, sep = "")
}
You can use
substr<-
to capitalise the last character.