0 votes
1 view
in R Programming by (50.5k points)
edited by
How can I change string variable datatype to integer datatype in a .csv data-set. For example:

The original data is ">200000" and I want to remove that '>" from the data. The desired output should be: 200000

1 Answer

0 votes
by (108k points)

I don't know about your data-set, so I will provide you the common solution.

In the below r programming code, the df is the data-frame on which I have imported my .csv data-set.

df$col[df$col == ">200000"] <- 200000

Or:

df$col <- replace(as.numeric(df$col), df$col == ">200000", "200000")

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...