Coercion in R 

Coercion :

Coercion includes type conversion . Type conversion means change of one type of data into another type of data. We have to type of coercion occurs :

1. Implicit Coercion

2. Explicit Coercion

Contact at TJT@TechnicalJockey.com , if you are looking for an Instructor Based Online Training !

Explicit Coercion :

In explicit coercion , we can change one data type to another data type by applying function.

We create an object "x" which stores integer values from 1 to 6.

x<-0:6

We can check data type of "x" object.

class(x)

We used as.numeric() to change integer data type to numeric data type.

z<-as.numeric(x)

We check data type of z. It shows "numeric" data type.

class(z)

We can also change character data to numeric data as:

We also changed logical data to character data.

We also changed integer data to Logical data as:

When we changed numeric or integer to logical data , it will store 0 as FALSE and other values as TRUE. You can see here also .

Some exceptions of explicit coercion :-

We are converting character data type to numeric data type. It will show NA . It will show missing in out object. It will not change character data to numeric because it includes values "a" which cannot be changed to numeric data.

 

Implicit Coercion :

When type conversion occurs by itself in R.

We input numeric and character data in an object . R converts numeric data to character data by itself.

We input logical and numeric data in an object . Logical data convert to numeric data implicitly.

Contact at TJT@TechnicalJockey.com , if you are looking for an Instructor Based Online Training !

 

Subscribe to our mailing list

* indicates required

Looking for Corporate Training ? Reach out to us at Akriti.Lal@instrovate.com

Reach out to us if you are looking for Corporate Training to Build The Next Generation Analytical Workforce with an in-depth understanding of  Exploratory Data Analysis , Data Visualisation, Data Analytics , AI First , Machine Learning & Deep Learning Training & Consulting helping them to take Data Informed Decision at each stage of the business. 

We understand that At the present times , the Entire Industry is in a Tranformation stage with the Softwares  being rebuilt with Artificial Intelligence Capabilities .

We need SMART WORKFORCE for the SMART SOFTWARES to reap the maximum return . 

 

Whatsapp at +91-9953805788 or email at - akriti.lal@instrovate.com if you would like to know more . 

 

  • Corporate Tableau Training in Gurgaon
  • Corporate Data Analytics Training in Gurgaon
  • Corporate Microsoft Power BI Training in Gurgaon
  • Corporate Microstrategy Training in Gurgaon
  • Corporate Google Data Studio Training in Gurgaon
  • Corporate Python Training in Gurgaon
  • Corporate Advance Analytics in R Programming Training in Gurgaon
  • Corporate Machine Learning Training in Gurgaon
  • Corporate Deep Learning Training in Gurgaon
  • Corporate Data Visualization Training in Gurgaon

 

Address

Instrovate Technologies

Noida, Gurgaon

 

akriti.lal@instrovate.com 

Hit Your Refresh Button To Rise Higher
Print Print | Sitemap
All rights reserved @ Instrovate Technologies
GSTIN : 09AAECI6862K1Z1

Terms Of Services    Privacy Policy    Disclaimer     Refund Policy    


Call

E-mail