We have three kinds of values in R that could cause us a problem if we are not careful.
- NA stands for not available; usually happens when we don't have value present in our column.
- NaN stands for not a number; value that can't be used in calculations.
- Inf stands for infinity and we can get it if we divide some number with 0.
With is.finite(), we can check is some value finite and function is.infinite() does it in reversed way.
With function is.nan() we can check is our value NaN or not.
With function is.na() we can check is our value na or not; if we want to ignore na value, we can use function na.omit() and if we want to replace all of na values from single column with 0, we can do it in this way.
data$column[is.na(data$column)] <- 0
For video tutorial, check the link below.
No comments:
Post a Comment