'factor function turning output to N/A

I have a very large data-set that contains reviews from Tripadvisor. I am running a Naive Bayes model to predict whether or not a review is helpful.

A review could be classified as helpful if the number of helpful reviews is > 0.

I am running into the issue that when I attempt to change my helpful_reviews to factor, it changes all my values to NA (See screenshot). Could someone tell me how to fix this?

Also, how should I best go about changing values above 1 (which are also helpful reviews) to 1, so I only have 0's and 1's?

Sample data: dfReviewSample <- c(1,2,2,5,3,3,4,2,5,4,6,7,7,0,9,0,9,0)

Screenshot of output

dfReview <- read.csv("reviews_final.csv", row.names = 1)
dfReview$review_body <- NULL
#dfReview$helpful_votes = dfReview$helpful_votes > 0
#ifelse(dfReview$helpful_votes >= 1, dfReview$helpful_votes == 1, dfReview$helpful_votes 
==0)
dfReview$helpful_votes <- factor(dfReview$helpful_votes,
                             levels = c("No", "Yes"))
View(dfReview)
r


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source