-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,9 @@ library(dplyr) | |
library(EML) | ||
library(gapminder) | ||
|
||
## could also be done: | ||
|
||
# attributes -------------------------------------------------------------- | ||
|
||
attributes <- frame_data( | ||
~attributeName, ~formatString, ~definition , ~unit, ~numberType, ~attributeDefinition, | ||
"country" , NA, "country", NA, NA, "name of country", | ||
|
@@ -14,12 +16,15 @@ attributes <- frame_data( | |
"gdpPercap" , NA, NA, "number", "real", "GDP per capita" | ||
) | ||
|
||
## what units can we use? consult | ||
## what units can we use? consult: | ||
# standardUnits <- get_unitList() | ||
# standardUnits$units | ||
# View(standardUnits$units) | ||
|
||
## now for the factors: | ||
|
||
# factors ----------------------------------------------------------------- | ||
|
||
## there are no factors in this dataset, but this is where you would put them! | ||
|
||
attributeList <- set_attributes(as.data.frame(attributes), | ||
col_classes = c("character", "character", | ||
|
@@ -28,7 +33,10 @@ attributeList <- set_attributes(as.data.frame(attributes), | |
## as many col_classes as there are rows in attributes | ||
## note that you need to coerce attributes back to data.frame | ||
|
||
glimpse(attributes) | ||
|
||
# dataTable: putting it together ------------------------------------------ | ||
|
||
|
||
|
||
readr::write_csv(gapminder, "data/gapminder.csv") | ||
physical <- set_physical("data/gapminder.csv") | ||
|
@@ -39,10 +47,28 @@ dataTable <- new("dataTable", | |
physical = physical, | ||
attributeList = attributeList) | ||
|
||
|
||
# person ------------------------------------------------------------------ | ||
|
||
|
||
|
||
R_person <- as.person("John Doe <[email protected]") | ||
ownername <-as(R_person, "creator") | ||
|
||
|
||
contact <- | ||
new("contact", | ||
individualName = ownername@individualName, | ||
electronicMail = ownername@electronicMailAddress, | ||
# address =, | ||
organizationName = "Gapminder", | ||
phone = "000-000-0000") | ||
|
||
|
||
|
||
# coverage ---------------------------------------------------------------- | ||
|
||
|
||
coverage <- | ||
set_coverage(begin = '1952-01-01', end = '2007-01-01', | ||
geographicDescription = "The world", | ||
|
@@ -51,13 +77,8 @@ coverage <- | |
altitudeMin = 0, altitudeMaximum = 2000, | ||
altitudeUnits = "meter") | ||
|
||
contact <- | ||
new("contact", | ||
individualName = ownername@individualName, | ||
electronicMail = ownername@electronicMailAddress, | ||
# address =, | ||
organizationName = "Gapminder", | ||
phone = "000-000-0000") | ||
|
||
# combining everything: dataset ------------------------------------------- | ||
|
||
|
||
dataset <- new("dataset", | ||
|