fix_countries: fix_countries

Description Usage Arguments Details Value Examples

Description

Checks that the country in which the location (given by the columns LATITUDE and LONGITUDE) is the same with the value from COUNTRY column. If there are differences, the value from the COUNTRY column is updated.

Usage

1

Arguments

dff

A dataframe containing NOAA Earthquake data

Details

To determine the location's country, we use the coords2country function. If the function coords2country return NA, we don't update the value from the COUNTRY column.

Value

A date frame with the values from COUNTRY corrected

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
dfnew <- load_data()
dfnew <- dplyr::mutate(dfnew, LATITUDE=as.numeric(LATITUDE))
dfnew <- dplyr::mutate(dfnew, LONGITUDE=as.numeric(LONGITUDE))
dfnew <- dplyr::mutate(dfnew, EQ_PRIMARY=as.numeric(EQ_PRIMARY))
dfnew <- dplyr::mutate(dfnew, DEATHS=as.numeric(DEATHS))
dfnew <- fix_na_latitude(dfnew)
dfnew <- fix_na_longitude(dfnew)
dfnew <- fix_na_lon_na_lat(dfnew)
dfnew <- dplyr::mutate(dfnew, DataEQ=convert_data(YEAR, MONTH, DAY))
test <- fix_countries(dfnew)

constantin345/NOOA documentation built on May 16, 2019, 7:09 p.m.