An Introduction to the Tidyverse
There is one package in particular that is not only tremendously useful but has also has had an enormous impact on the greater data science community. This is the Tidyverse package. The Tidyverse is actually a collection of packages, containing other packages such as ggplot2, dplyr, and tidyr. So when we install and load the Tidyverse package we are actually installing and loading all of the packages within its scope.
We have already pre-installed the Tidyverse package in our coding environment,
so only the output from the library(tidyverse)
is going to print out,
let's see what we get here:
Let's examine what is printed out above. At the start of the first line it says Attaching packages, and at the end of this line it says tidyverse 1.3.2. The numbers here indicate the package version number that we learned about in the Packages lesson.
In the Attaching packages section it lists the packages and their
versions that are being brought in, such as ggplot2
at version 3.4.0 and dplyr
at version 1.0.10.
In the next section it says that there are some conflicts. The first conflict is
dplyr::filter() masks stats::filter()
What this is saying is that there is already a function called
filter
that was brought in from the stats
package. The stats
package is one of the packages
that comes pre-installed and loaded in every R session.
Since there are now two functions with the same function,
if we use filter
, then it will use the one from
the dplyr
package, that's what the masking means.
We can still use the one in the stats
package, we would
just need to refer to it's namespace when calling it, so we woul
need to call it as stats::filter
.
dplyr::lag() masks stats::lag()
The second conflict is is the same issue as the first one, the
lag
function in the dplyr
package
will be the one called if we use lag
, but we
can still use the one in the stats
package
if we call it as stats::lag
.