How to Create a Unit Object with the grid Package in R
In this article, we are going to discuss how to create a unit object with a grid package in R programming language.
The unit describes the quantity of particular data present in a vector/dataframe/list. Here we will get data units in required formats using the unit() function. It is available in the grid package, thus it has to be imported to the workspace.
we can get the units by using unit() function
- data is the input data
- unit_name is the type of unit
Given below are implementations for the same.
Example: R program to create a vector with 15 values and display units in centimeter
Example: R program to get the units in inch