https://github.com/cran/season
Raw File
Tip revision: 9e054890fe969261939be9b26eeea9f5650f1a55 authored by Adrian Barnett on 21 March 2022, 07:30:11 UTC
version 0.3.15
Tip revision: 9e05489
nochars.R
# nochars.R
# remove letters and characters from a string

nochars<-function(text){
   alphabet<-c('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
               'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
               "\\(","\\)","\\.")
   n<-length(alphabet)
   compressed<-gsub(alphabet[1],"",text);
   for (i in 2:n){
      compressed<-gsub(alphabet[i],"",compressed)
   }
   return(compressed)
}

# example
nochars(text='adrian.(0)')
back to top