

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Which function should be used to load a package in R, require or library?
The main difference between require and library is that require was designed to use inside functions and library is used to load packages. If a package is not available then library throws an error on the other hand require gives a warning message.
Using library
> library(xyz) Error in library(xyz) : there is no package called ‘xyz’
Using require
require(xyz) Loading required package: xyz Warning message: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : there is no package called ‘xyz’
Here we can see that the library shows an error and require gives a warning message, since warnings are mostly avoided and we tend to move further hence require is not recommended because further steps will throw an error or warning again.
- Related Questions & Answers
- How can scikit-learn library be used to load data in Python?
- Which equals operator (== vs ===) should be used in JavaScript?
- Which MySQL Datatype should be used for storing BloodType?
- Which library can be used to interact with database in JSP?
- Which equals operator (== vs ===) should be used in JavaScript comparisons
- Which Measurement Unit should be used in CSS to set letter spacing
- Which SciPy package is used to implement Clustering?
- Among id, name, xpath and css, which locator should be used?
- Explain the scenario in which CURSOR should be used over a standalone SELECT statement?
- How to load classes at runtime from a folder or Java package
- How can Tensorflow be used to load the dataset which contains stackoverflow questions using Python?
- MySQL isn’t inserting binary data properly? Which datatype should be used?
- How should strace be used on Linux?
- Which MySQL function can be used to append values of a column with single quotes?
- How can BeautifulSoup package be used to parse data from a webpage in Python?
Advertisements