R/getdata.R

Defines functions get_data

Documented in get_data

# Imports the data to be analyzed into a Dataframe (DF)
#' @title Import Happiness report 2019 Data
#' @description This function reads the data from a csv-file and returns it as a DataFrame-object.
#' @examples
#' To store the data in a variable
#' df = get_data()
#' @export
  get_data <- function() {


    hap_data<- read.csv(system.file("extdata", "happinessreport2019.csv", package="happiness"))
     #since there is no missing data I can directly use it without handling for na values.

     colnames(hap_data)<- c("rank","country","score","gdp","social","lifexp","freedom","generosity","corruption")

     # usethis::use_data(hap_data, overwrite = TRUE)

    return(hap_data)
}
DebanjaliBasu/happiness documentation built on Feb. 18, 2020, 9:34 p.m.