R tip. Use wrapr::match_order() to align data.
R tip: first organize your tasks in terms of data, values, and desired transformation of values, not initially in terms of concrete functions or code. I know I write a lot about coding in R. But it is in the service of supporting statistics, analysis, predictive analytics, and data science. […]
Here is an R tip. Want to re-map a column of values? Use a named vector as the mapping.
Another R tip. Need to replace a name in some R code or make R code re-usable? Use wrapr::let().
R tip: use stringsAsFactors = FALSE. R often uses a concept of factors to re-encode strings. This can be too early and too aggressive. Sometimes a string is just a string. It is often claimed Sigmund Freud said “Sometimes a cigar is just a cigar.”
If you are working with predictive modeling or machine learning in R this is the R tip that is going to save you the most time and deliver the biggest improvement in your results. R Tip: Use the vtreat package for data preparation in predictive analytics and machine learning projects. […]
Here is an R tip. Use loop indices to avoid for()-loops damaging classes. Below is an R annoyance that occurs again and again: vectors lose class attributes when you iterate over them in a for()-loop. d <- c(Sys.time(), Sys.time()) print(d) #>  "2018-02-18 10:16:16 PST" "2018-02-18 10:16:16 PST" for(di in […]
Another R tip. Use vector(mode = "list") to pre-allocate lists. result <- vector(mode = "list", 3) print(result) #> [] #> NULL #> #> [] #> NULL #> #> [] #> NULL The above used to be critical for writing performant R code (R seems to have greatly improved incremental list […]
R tip: get out of the habit of calling View() directly. View() only works correctly in interactive environments, not currently in RMarkdown contexts. It is better to call something else that safely dispatches to View(), or to something else depending if you are in an interactive or non-interactive session. The […]
I think this is the R Tip that is going to be the most controversial yet. Its potential pitfalls include: it is a style prescription (which makes it different than and less immediately useful than something of the nature of R Tip: Force Named Arguments), and it is heterodox (this […]