Code Monkey home page Code Monkey logo

fr's Introduction

Hello! 👋

I am an Associate Professor of Pediatrics at Cincinnati Children’s Hospital Medical Center and the University of Cincinnati College of Medicine interested in geoinformatics, environmental and population health, and fairness in precision medicine. My research is focused on understanding the heterogeneous effects of environmental exposures and community characteristics on childhood psychiatric and neurobehavioral health outcomes. I am also interested in developing new methods and technologies to support environmental and population health research, including statistical computing tools for geocoding and geomarker assessment, high resolution spatiotemporal air pollution exposure assessment models, and causal inference machine learning methods.

fr's People

Contributors

cole-brokamp avatar

Watchers

 avatar  avatar

fr's Issues

R version 4.2.2 errors running example

docker run --rm -it ghcr.io/rocker-org/r-ver:4.2.2

install.packages("remotes")
remotes::install_github("cole-brokamp/[email protected]", repos = "https://packagemanager.rstudio.com/all/__linux__/focal/latest")
library(fr)
as_fr_tdr(mtcars)

returns

Error in `map2()`:
ℹ In index: 1.
ℹ With name: mpg.
Caused by error in `validator()`:
! trying to get slot "name" from an object (class "fr_field") that is not an S4 object 
Run `rlang::last_trace()` to see where the error occurred.
Warning message:
! `name` was not supplied, but was guessed
ℹ specify with `as_fr_tdr(mtcars, name = "my_name")` 

Release fr 0.5.0

First release:

Prepare for release:

  • git pull
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • git push
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('minor')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted 🎉
  • Add preemptive link to blog post in pkgdown news menu
  • usethis::use_github_release()
  • usethis::use_dev_version(push = TRUE)
  • usethis::use_news_md()
  • Finish blog post
  • Tweet

getting started vignette

Frictionless Tabular-Data-Resource

Convert a data frame into a frictionless tabular-data-resource (i.e., fr_tdr object) with as_fr_tdr(). Here, we create some metadata based on ?mtcars:

d_fr <-
  mtcars |>
  tibble::as_tibble() |>
  as_fr_tdr(name = "mtcars",
            version = "0.9.1",
            title = "Motor Trend Car Road Tests",
            homepage = "https://rdrr.io/r/datasets/mtcars.html",
            description = "The data was extracted from the 1974 Motor Trend US magazine, and comprises fuel consumption and 10 aspects of automobile design and performance for 32 automobiles (1973–74 models).")

Print the fr_tdr object to view all of the table-specific metadata descriptors and the underlying data frame:

d_fr

Use str() or pillar::glimpse() to view all field- and table-specific descriptors:

pillar::glimpse(d_fr)
str(d_fr, max.level = 1)

Use fr_desc() to get a list of descriptors, excluding the list of fields:

fr_desc(d_fr)

Add a metadata descriptor for one of the fields in the tabular data resource by using the @ or S7::prop accessor functions from the {S7} package:

d_fr@fields$cyl@title <- "Number of cylinders"
S7::prop(d_fr@fields$gear, "title") <- "Number of forward gears"

d_fr@fields[c("cyl", "gear")]

## d_fr[c("cyl", "gear")]

Add a name metadata descriptor for each field in the fr_tdr object

# TODO

the_tdr <- c(fr_desc(d_fr), list(fields = lapply(d_fr@fields, fr_desc)))

str(the_tdr)

Using str() provides a useful overview of the structure of a fr_tdr object, including all field-specific metadata, table-specific metadata, and the underlying @value data vector:

str(d_fr)

Use fr_schema() to extract the metadata for each field in a list. Pair this with listviewer for an interactive list viewer:

fr_schema(d_fr) |>
    listviewer::jsonedit(mode = "view")

Accessor functions work as they do with data frames and tibbles, but return a fr_field or td_tdr object:

d_fr[["disp"]] |> class()

d_fr$disp |> class()

d_fr["disp"] |> class()

fr_field objects can be used mostly anywhere that the underlying data frame can be used.

lm(mpg ~ cyl + disp + wt, data = d_fr)

Explicitly drop the Frictionless attributes and extract just the underlying data frame with as_data_frame() or as_tibble():

tibble::as_tibble(d_fr)

summary(d_fr)

summary(as_data_frame(d_fr))

An fr_tdr object is essentially a list of fr_fields with table-specific metadata descriptors.

Create a list of fr_fields using fr_field() and use it to create a fr_tdr object:

# TODO add example for list approach

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.