I write a function in R as following, but I could not use it in a vectorize way (the second part of the code below). I am wondering how can I make this function vectorize
normalize=function(browser){ if (browser=="Chrome" | browser=="Firefox" | browser=='Safari' | grepl('IE',browser)){ browser }else{ "Others" } } data$browser_n<-normalize(data$browser) // not working (data is a data frame)