tidyverse / magrittr

Improve the readability of R code with the pipe
https://magrittr.tidyverse.org
Other
957 stars 157 forks source link

Suggest alias for `Encoding<-` #257

Closed CGMossa closed 1 year ago

CGMossa commented 2 years ago

I've recently discovered base::Encoding, as it is sometimes needed when I want to parse latin-1 encoded variables. Thus I've discovered that magrittr does not have an alias for Encoding<-. This is particularly nice to have.

To that discussion, I think there these candidates for aliases:

> getNamespaceExports("base") %>% `[`(str_detect(., ".+-$"))
 [1] "is.na<-"          "colnames<-"       "<-"               "attr<-"          
 [5] "regmatches<-"     "[[<-"             "dimnames<-"       "class<-"         
 [9] ".rowNamesDF<-"    "units<-"          "$<-"              "<<-"             
[13] "split<-"          "@<-"              "storage.mode<-"   "body<-"          
[17] "length<-"         "[<-"              "environment<-"    "comment<-"       
[21] "mostattributes<-" "substring<-"      "substr<-"         "Encoding<-"      
[25] "rownames<-"       "dim<-"            "oldClass<-"       "parent.env<-"    
[29] "diag<-"           "row.names<-"      "attributes<-"     "levels<-"        
[33] "formals<-"        "names<-"          "mode<-"

Some of them already are added, and some of them one wouldn't want to add them anyways, but here they are.

lionel- commented 1 year ago

Since Encoding() is a rather low level function, it doesn't seem like a good fit for magrittr. Thanks for the suggestion though.