From f74e0269388cec1628938a47db990a5809d4b6cd Mon Sep 17 00:00:00 2001 From: Saranjeet Kaur Date: Wed, 30 Oct 2024 00:04:23 +0000 Subject: [PATCH] update README --- README.Rmd | 33 ++++++++----------------- README.md | 72 +++++++++++++++++++++++++++++++----------------------- 2 files changed, 52 insertions(+), 53 deletions(-) diff --git a/README.Rmd b/README.Rmd index dacad00..6476750 100644 --- a/README.Rmd +++ b/README.Rmd @@ -43,36 +43,23 @@ This is a basic example which shows you how to solve a common problem: ```{r example} library(healthgpsrvis) -data_mean_weighted <- data.frame( - time = rep(seq(2020, 2055, by = 5), 3), - weighted_bmi = runif(24, 25, 38), - weighted_energyintake = runif(24, 1700, 2750), - weighted_fat = runif(24, 38, 120), - weighted_obesity = runif(24, 0.1, 0.7), - weighted_protein = runif(24, 46, 210), - weighted_sodium = runif(24, 874, 2768), - source = rep(c("Source_1", "Source_2", "Source_3"), each = 8) -) -plot_bmi <- riskfactors("bmi", data_mean_weighted) -plot_bmi -``` -What is special about using `README.Rmd` instead of just `README.md`? You can include R chunks like so: +# Get the path to the .rds file +filepath <- testthat::test_path("testdata", "data_ps3_reformulation") -```{r cars} -# summary(cars) -``` +# Read the .rds file +data <- readRDS(filepath) -You'll still need to render `README.Rmd` regularly, to keep `README.md` up-to-date. `devtools::build_readme()` is handy for this. +# Generate the weighted data +data_weighted <- gen_data_weighted(data) -You can also embed plots, for example: +# Generate the weighted data for the risk factors +data_weighted_rf_wide_collapse <- gen_data_weighted_rf(data_weighted) -```{r pressure, echo = FALSE} -# plot(pressure) +# Summarise the weighted data for the risk factors +summary(data_weighted_rf_wide_collapse) ``` -In that case, don't forget to commit and push the resulting figure files, so they display on GitHub and CRAN. -