Ad Code

Ticker

6/recent/ticker-posts

TCS Ievolve competncy ID - 5337 - Data Science Fresco Play Hands on - R basic Categorical to Numeric Variable

                                       

TCS Ievolve competncy ID - 5337 - Data Science

E0- Fresco Play Hands on - R basics - 5 Categorical to Numeric Variable

Ievolve course ID - 55101




Categorical to Numeric Variable

question -

1. Create a factor vector v1 using 10 random numbers without decimals.

2. Convert the factor vector to numeric vector v2.

3. Compare v1 and v2 element-wise. Store the comparison values (true or false) in a vector, and display them.

answer -

 v = sample (0:100 , 10, replace = TRUE)

v1 = factor(v)
v2 = as.numeric(levels(v1))[v1]
v1==v2

Post a Comment

0 Comments