Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

How to convert from category to numeric

$
0
0

@KumarP wrote:

str(data)
Classes ‘tbl_df’, ‘tbl’ and ‘data.frame’: 227745 obs. of 37 variables:
county : chr "Buskerud" "Buskerud" "Oslo" "Oslo" ... age_group : chr “24-34” “65+” “55-64” “24-34” …
gender : int 2 2 2 2 2 2 2 2 2 2 ... life_phase : chr “Småbarnsfamilie” “SeniorEnslig” “MiddelaldrendeEnslig” “UngdomStudent” …
drivetime : int 30 30 30 30 30 30 30 30 30 30 ... couple_pair : chr “P” “E” “E” “E” …
kids : int 1 0 0 0 1 0 0 0 0 1 ... house_type : chr “Eneboliger” “Rekkehus, kjedehus og andre småhus” “Tomannsboliger” “Store boligbygg (blokk)” …
$ car_type : chr “VAN_SEGMENT” “B_SMAABILER” “D_MELLOMKLASSEN” “U_NONE” …

char_var <- c(“county”,“age_group”,“life_phase”,“couple_pair”,“house_type”,“car_type”)
class(char_var)

I have 6 char variables out of 37.need to convert those char variables into numeric. and include in my dataframe.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles