I need to create a function that returns the vector of unique values of a column of a dataframe. As input, i should mention the data frame and the column name. this is what i did :
Val_Uniques <- function(df, col) {
return(unique(df$col))
}
Val_Uniques(mytable, city)
the result is NULL, how can i fix it please ? I want to add a trycatchblock and print awarning message "the column does not exist" if the name of the column is wrong.
Thank you in advance