Git Product home page Git Product logo

wxsumr's Introduction

wxsumR

Code for R package for calculating annual summary statistics of site-specific climate data. Largely an R implementation of the Stata package available at https://github.com/jdavidm/weather_command.

Dependencies

  • dplyr (>= 0.8.3),
  • lubridate (>= 1.7.4),
  • stringr (>= 1.3.1),
  • tidyr (>= 1.0.0)

Installation

Development version

The latest version is available through GitHub (you'll need the devtools package to install):

# install.packages("devtools")
devtools::install_github("jcoliver/wxsumR")
# to include vignette with devtools installation, pass build_vignettes = TRUE
# devtools::install_github("jcoliver/wxsumR", build_vignettes = TRUE)

wxsumr's People

Contributors

jcoliver avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

themacfreezie

wxsumr's Issues

Update dry_interval to use rle function

The base::rle function might offer an alternative approach that does not require string manipulation gymnastics. The function below finds the longest stretch of 0s in a vector, x, but could be modified to find values above/below a threshold.

# Create a function that will find maximum length of specific values
rle_max_lengths <- function(x, value = 0) {
  # Do run length calculations
  run_length <- rle(x)
  # Find which of the runs are the value of interest
  is_value <- run_length$values == value
  max_length <- 0
  # Only try extracting values if there was at least one
  if (any(is_value)) {
    # Pull out all lengths of value of interest
    value_lengths <- run_length$lengths[is_value]
    # Find the maximum length of all runs of value of interest
    max_length <- max(value_lengths)
  }
  return(max_length)
}

Check dry_interval behavior

When period = "mid", and all days are below rain_cutoff, dry_interval returns 0 (according to documentation). Should this instead return the actual number of days, since it was, technically, the longest stretch of dry days?

Update README

  • instructions for installing vignette aren't complete
  • include a minimal example

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.