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

How to handle numeric values in Y/N variable in R

$
0
0

@idvarma wrote:

Hi Team,
I have a data set with Y/N values and also a numeric value. How to handle those unexpected values.
Data is as below.

OWN_OCCUPIED
Y
N
N
12
Y
Y

Y
Y

The above has one missing value and numeric. I want those two replace with ‘NA’. How is this possible in R. I tried as below but couldn’t find the solution

e <- c()
i = 1

while(i <= nrow(df2)){
e[i] <- df2[i,3]
if(e[i] ==‘Y’){
print(“Accepted”)
}
else if(e[i] == ‘N’){
print(“ACCEPTED”)
}
else
print(“Reject”)
i = i+1
}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles