
R: select() in both MAAS and dplyr causes problems
For those in tidyverse, dplyr has this handy function called select() that picks out just the variables based on the the column we need from a data frame.
Unfortunately, there’s also this other cool package called MASS which also has a function called select().
When I load both of these packages into my R session and just type select(), my code breaks because I am not sure R uses what I need.
This is where the magic of :: comes in. It allows us to specify which package's function to call.
For example, MASS::select() calls the select() from MASS, while dplyr::select() uses the select from dplyr.
In rare cases would there be duplicate function names in different packages, and if we encounter such cases, specifying the package is the way to solve it.
Leave R: select() in both MAAS and dplyr causes problems to:
Read more #programming posts
Best Posts From snippets
We have not curated any of snippets's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From snippets
- Understanding PWA Development: Do You Really Need Node.js?
- Creating a Simple Web Calculator with R and HTML: A Beginner's Guide Using Plumber
- Mastering Data Manipulation: Using `mutate()` in R Pipe Operations
- Extracting the First Three Characters from a DataFrame Column in R
- Mastering Column Binding in R: A Quick Guide to cbind()
- The logistic map in R
- Basic template to make a button to upload a file.
- OOP in R
- Render: Deploying your apps for free
- Octostudio: The activation of the behavior of sprite