# Drop NA values in an imported xlxs document with R

I have the attached document. I've imported an xlxs document into R. I would like to get rid of all rows containing NA. I've tried the following but it isn't working.

# install packages Note# tidyverse installs packages for dplyr and ggplot2
install.packages("tidyverse")

#open the library
library(tidyverse)

setwd("~/Documents/UofL/Data_Science/CECS_635/week_3/")

un1 %>% drop_na(un,)


its should be working

data_set<-na.omit(un)


If want to handle NA's to mean or median:

na.mean(un, option = "mean")


I was able to get the application to drop the NA values by converting the xlsx file to a csv file. Once the csv was uploaded into R, I was able to omit the NA rows.

# to remove the NA values I converted the xlsx file to csv

united_nations <- read_csv("UnitedNations.csv", col_names = TRUE)

# used the na.omit option to remove rows with NA
united_nations = na.omit(united_nations)


Or in a data frame:

mydata <- data.frame(c(1,2,NA,3))
mydata <- mydata[complete.cases(mydata),]