So keep in mind I started using R for two days now, and for our first assignment we have to create a function, and I'm planning on just doing basic encryption kind of thing.
This is what I have so far:
g <- c("Hello, this is a test, do you understand?")
convert <- function(a) {
gsub("H","$",a)
gsub("e","f",a)
gsub("l","*",a)
gsub("o","7",a)
}
convert(g)
See the problem is this outputs:
"Hell7, this is a test, d7 y7u undertstand?"
How would I get the multiple gsub
s to work?