How to install packages through cran in R?
MACHINE LEARNING RECIPES DATA CLEANING PYTHON DATA MUNGING PANDAS CHEATSHEET     ALL TAGS

How to install packages through cran in R?

How to install packages through cran in R?

This recipe helps you install packages through cran in R

0

Recipe Objective

R packages consists of a collection of R functions, data sets and compiled code which adds value to the existing R-functionalities. They are stored in the 'library' directory in R-environment and developed by the community. For Example, "dplyr" is one of the commonly used packages in R which adds further functionalities with respect to working with dataframes.

There already exists some default packages in the local directory 'library' on your machine when you install R. We can see all the default packages by using code : 'library()'. If we want to add a new package, we can use three ways to do it:

  1. Directly from CRAN repository;
  2. From .zip file on your local machine;
  3. Via devtools package

This recipe demonstrates the installation and loading of a package directly from CRAN repository. CRAN repository is an official repository consiting of different R-packages and web servers maintained by the R community

Step 1: Installing packages

We use the command " install.packages("name of the package") " to install directly from CRAN repository. Below shows the code for installation of "dplyr".

install.packages("dplyr")

After running the command, we might recieve some messages which is based on the OS, dependencies installed and the status of the package.

If you want to install more than 1 package, just write them in a character vector in the command specified below:

install.packages(c("ggplot2","MASS"))

Step 2: Loading a package

We use the function "library()" to load the package. It is essential to load the package before we can use it in your code.

library(MASS)

Relevant Projects

Ecommerce product reviews - Pairwise ranking and sentiment analysis
This project analyzes a dataset containing ecommerce product reviews. The goal is to use machine learning models to perform sentiment analysis on product reviews and rank them based on relevance. Reviews play a key role in product recommendation systems.

Customer Market Basket Analysis using Apriori and Fpgrowth algorithms
In this data science project, you will learn how to perform market basket analysis with the application of Apriori and FP growth algorithms based on the concept of association rule learning.

Time Series Forecasting with LSTM Neural Network Python
Deep Learning Project- Learn to apply deep learning paradigm to forecast univariate time series data.

Data Science Project in Python on BigMart Sales Prediction
The goal of this data science project is to build a predictive model and find out the sales of each product at a given Big Mart store.

Build a Music Recommendation Algorithm using KKBox's Dataset
Music Recommendation Project using Machine Learning - Use the KKBox dataset to predict the chances of a user listening to a song again after their very first noticeable listening event.

Learn to prepare data for your next machine learning project
Text data requires special preparation before you can start using it for any machine learning project.In this ML project, you will learn about applying Machine Learning models to create classifiers and learn how to make sense of textual data.

Build an Image Classifier for Plant Species Identification
In this machine learning project, we will use binary leaf images and extracted features, including shape, margin, and texture to accurately identify plant species using different benchmark classification techniques.

Expedia Hotel Recommendations Data Science Project
In this data science project, you will contextualize customer data and predict the likelihood a customer will stay at 100 different hotel groups.

Mercari Price Suggestion Challenge Data Science Project
Data Science Project in Python- Build a machine learning algorithm that automatically suggests the right product prices.

Demand prediction of driver availability using multistep time series analysis
In this supervised learning machine learning project, you will predict the availability of a driver in a specific area by using multi step time series analysis.