(1) Write R code to install the package named "MASS" only if the package is not already installed on the machine. Then attach that package to your current workspace to use it in your programming.
Your code below
(2) Write R code to find what datasets are available only for
the MASS package
by creating a file named "R data sets".
Your code below
(3) Write R code to bring up the documentation page for the "Boston" dataset.
Your code below
(4) Write R code to print how many rows and columns are in this data set?
Your code below
1)
packages = c( "MASS")
## if the package is already installed, then load or install&load
package.check <- lapply(
packages,
FUN = function(x) {
if (!require(x, character.only = TRUE)) {
install.packages(x, dependencies = TRUE)
library(x, character.only = TRUE)
}
}
)
print("Done")
2) To list all the datasets in the MASS
data(package="MASS")
3).I am not usre how to do this comment. But if you are looking for the summany of teh R code,
summary(Boston)
4)
dim(Boston)
this will return the dimension of the dataset,
ie column and rows
Get Answers For Free
Most questions answered within 1 hours.