How to remove all variables from a session in R?
MACHINE LEARNING RECIPES DATA CLEANING PYTHON DATA MUNGING PANDAS CHEATSHEET     ALL TAGS

How to remove all variables from a session in R?

How to remove all variables from a session in R?

This recipe helps you remove all variables from a session in R

0

Recipe Objective

Variables are used to store data in any programming language. They are the named spaces in the memory which can referenced and manipulated later in the code.

This recipe specifically deals with how to remove all variables from the session

Step 1: Assigning three variables

Assigning values with three different data types to variables

a = 'hello' b = 3.5 c = as.integer(8.9)

We use cat() function to print the variables to check whether assignment was done or not

cat(a,b,c)
hello 3.5 8

Step 2: removing variables

We use rm() function to remove variables while the arguement "list = ls()" will make sure all of the variables are removed from the list. ls() gives the list of all the variables in the session. This would also remove functions assigned in the session.

rm(list = ls())

To check whether the variable is removed or not, we use cat() function

cat(a)
Error in cat(a): object 'a' not found
Traceback:

1. cat(a)
cat(b)
Error in cat(b): object 'b' not found
Traceback:

1. cat(b)
cat(c)
Error in cat(c): argument 1 (type 'builtin') cannot be handled by 'cat'
Traceback:

1. cat(c)

Hence, we can conclude that all the variables have been removed in the session

Relevant Projects

Census Income Data Set Project - Predict Adult Census Income
Use the Adult Income dataset to predict whether income exceeds 50K yr based on census 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.

Customer Churn Prediction Analysis using Ensemble Techniques
In this machine learning churn project, we implement a churn prediction model in python using ensemble techniques.

Data Science Project - Instacart Market Basket Analysis
Data Science Project - Build a recommendation engine which will predict the products to be purchased by an Instacart consumer again.

Resume parsing with Machine learning - NLP with Python OCR and Spacy
In this machine learning resume parser example we use the popular Spacy NLP python library for OCR and text classification.

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.

Identifying Product Bundles from Sales Data Using R Language
In this data science project in R, we are going to talk about subjective segmentation which is a clustering technique to find out product bundles in sales data.

NLP and Deep Learning For Fake News Classification in Python
In this project you will use Python to implement various machine learning methods( RNN, LSTM, GRU) for fake news classification.

Machine Learning Project to Forecast Rossmann Store Sales
In this machine learning project you will work on creating a robust prediction model of Rossmann's daily sales using store, promotion, and competitor data.

Build a Similar Images Finder with Python, Keras, and Tensorflow
Build your own image similarity application using Python to search and find images of products that are similar to any given product. You will implement the K-Nearest Neighbor algorithm to find products with maximum similarity.