Saturday 29 August 2020

factor in R

factor:
Numerical counterpart of character value is called factor
The factor function is used to create a factor. 
The only required argument to factor is a vector of values which will be returned as a vector of factor values..

#factor:numerical counterpart of character value is called factor

journey_type<-c("train","bus","flight","bus","flight","train")
 journey_type 
 journey_typefact<-as.factor(journey_type)
journey_typefact
class(journey_typefact)
as.integer(journey_typefact) 

#as.integer is displaying how our values as 1,2 and 3 are
#bus is 1, flight is 2 and train is 3 as due to alphabetic order as b come first so 1 and so on..

2 comments:

  1. We provide Classroom training on IBM Certified Data Science at Hyderabad for the individuals who believe hand-held training. We teach as per the Indian Standard Time (IST) with In-depth practical Knowledge on each topic in classroom training, 80 – 90 Hrs of Real-time practical training classes. There are different slots available on weekends or weekdays according to your choices. We are also available over the call or mail or direct interaction with the trainer for active learning.
    For any queries feel free to Call/WhatsApp us on +91-9951666670 or mail at info@innomatics.in
    data science training in hyderabad
    Data Science Course in Hyderabad

    ReplyDelete
  2. You don't realize how quickly technology is changing. Data science is highly technical and is therefore in high demand. A career in data science will open up many lucrative job opportunities. So, if you have been wanting to start your career in Data Science, now is the best time to enroll in a data science program with one of the best data science training institute in noida.

    ReplyDelete

apply function in R

1) apply function: It takes 3 arguments matrix,margin and function.. Example: m<-matrix(c(1,2,3,4),nrow=2,ncol=2) m #1 indicates it is ap...