# Write you function here! 
square_it <- function(n_vector){
    if(class(n_vector) !='numeric'){
        return('Not a numeric vector!')
    }else{
        return(n_vector**2)
    }
}

square_it(c(3,4,5,6,7))


get_vowels <- function(string) {
  vector_string = strsplit(string, "")[[1]]
  #print(vector_string)
 
  for (letter in vector_string) {
    if (letter %in% c('a','e','i','o','u')) {
      print('Found a vowel!')
    }
  }
}
class(get_vowels('word'))



extract_vowels <- function(word){
    vector1 <- strsplit(word,"")[[1]]
    i=1
    list_of_vewels=0
    for(letter in vector1){
        if(letter %in% c('a','e','i','o','u')){
            list_of_vewels[i] = letter
            i=i+1
        }
    }
    return(list_of_vewels)
}
extract_vowels('mAgic')

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: