install.packages()

Sometimes, I use install.packages() followed by library(some name) to get in some data sets. At other times, I git to do install.packages(“specificname’) to get in the data set. What’s the difference?
Thanks.

I think we need a FAQ: How to do a minimal reproducible example ( reprex ) for beginners

You use for install the packages. Not for load data set.

If you want a specific data set of a library, first you need load this library and next the data set.
If you dont load the library the data set dont appear available.

install.packages('faraway')
library(faraway)
data(seeds) # data set of this library.
seeds

# germ moisture covered
# 1    22        1      no
# 2    41        3      no
# 3    66        5      no
# 4    82        7      no
# 5    79        9      no
# 6     0       11      no
> install.packages()
Error in utils::install.packages() : no packages were specified

If your scripts have install.packages() with nothing in the brackets, then its just a waste of text, as it achieves nothing.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.