#' quita_char_especiales
#'
#' remove special characters from text
#' .
#' @param tbla table with data. It has to have the variable that you want to clean.
#' @param campo name of the variable that you want to clean.
#' @keywords
#' @import stringi
#' @export
#' @examples
#'
quita_char_especiales<-function(tbla, campo){
tbla<-data.frame(tbla)
print('#######pasa nombres de campos a minuscula')
tbla[ ,campo]<-tolower(tbla[ ,campo])
tbla[ ,campo]<-gsub('[ \\/:?¿]', '_',tbla[ ,campo])
print('#######elimina tildes y ñ')
tbla[ ,campo]=stri_trans_general( tbla[ ,campo], "Latin-ASCII")#saca las tildes y las ñ
tbla[ ,campo]<-gsub('<', 'menor',tbla[ ,campo])
tbla[ ,campo]<-gsub('>', 'mayor',tbla[ ,campo])
tbla[ ,campo]<-gsub('=', 'igual',tbla[ ,campo])
tbla[ ,campo]<-gsub('\\+', 'mas',tbla[ ,campo])
tbla[ ,campo]<-gsub('-', '_',tbla[ ,campo])
tbla[ ,campo]<-gsub('&', '_',tbla[ ,campo])
tbla[ ,campo]<-gsub('\\.', '_',tbla[ ,campo])
tbla[ ,campo]<-gsub('[( )]', '_',tbla[ ,campo])
#gsub('[( )]', '','alknsdja(asa)')
return(tbla[,campo])
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.