diff --git a/.github/workflows/pkgdown.yaml b/.github/workflows/pkgdown.yaml new file mode 100644 index 0000000..63cbb18 --- /dev/null +++ b/.github/workflows/pkgdown.yaml @@ -0,0 +1,35 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/master/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + release: + types: [published] + workflow_dispatch: + +name: pkgdown + +jobs: + pkgdown: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-pandoc@v1 + + - uses: r-lib/actions/setup-r@v1 + with: + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v1 + with: + extra-packages: pkgdown + needs: website + + - name: Deploy package + run: | + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)' diff --git a/DESCRIPTION b/DESCRIPTION index 72cecf9..f0122dd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: foqat Type: Package Title: Field Observation Quick Analysis Toolkit -Version: 2.0.1 +Version: 2.0.2 Author: Tianshu Chen Maintainer: Tianshu Chen Description: Tools for quickly processing and analyzing @@ -16,7 +16,8 @@ Description: Tools for quickly processing and analyzing 2. Ozone Formation Potential (OFP): , Zhang et al.(2021) . 3. Aerosol Formation Potential (AFP): Wenjing Wu et al. (2016) . 4. TUV model: . -URL: https://github.com/tianshu129/foqat +URL: https://github.com/tianshu129/foqat, + https://tianshu129.github.io/foqat/ BugReports: https://github.com/tianshu129/foqat/issues Depends: R (>= 3.5.0) Imports: lubridate, magrittr, dplyr, plyr, stats, stringr, utils, @@ -25,6 +26,10 @@ Imports: lubridate, magrittr, dplyr, plyr, stats, stringr, utils, License: GPL-3 | file LICENSE Encoding: UTF-8 LazyData: true -RoxygenNote: 7.1.1 +RoxygenNote: 7.1.2 NeedsCompilation: no Packaged: 2021-08-17 16:44:03 UTC; Administrator +Suggests: + knitr, + rmarkdown +VignetteBuilder: knitr diff --git a/R/geom_ts.r b/R/geom_ts.r index 15f5d91..5f9eae8 100644 --- a/R/geom_ts.r +++ b/R/geom_ts.r @@ -12,10 +12,10 @@ #' @param plist vector, col index of species to be ploted by points.The default vaule is NULL. #' @param alist plist vector, col index of species to be ploted by areas. The default vaule is NULL. #' @param blist plist vector, col index of species to be ploted by bars. The default vaule is NULL. -#' @param llab text expression of legend labels of lines. The default vaule is NULL. -#' @param plab text expression of legend labels of points. The default vaule is NULL. -#' @param alab text expression of legend labels of areas. The default vaule is NULL. -#' @param blab text expression of legend labels of bars. The default vaule is NULL. +#' @param llab list of text expressions of legend labels of lines. The default vaule is NULL. +#' @param plab list of text expressions of legend labels of points. The default vaule is NULL. +#' @param alab list of text expressions of legend labels of areas. The default vaule is NULL. +#' @param blab list of text expressions of legend labels of bars. The default vaule is NULL. #' @param ltype vector, type of lines. The default vaule is NULL. #' @param pshape vector, shape of points. The default vaule is NULL. #' @param lsize vector, size of lines. The default vaule is NULL.The default vaule is 1. @@ -28,6 +28,11 @@ #' @param apos Position adjustment for areas, either as a string, or the result of a call to a position adjustment function. #' @param bna logical value, the way to handle NA values for bars. If you select FALSE, NA value will be replaced by 0. #' @param bpos Position adjustment for bars, either as a string, or the result of a call to a position adjustment function. +#' @param yl_limit two numeric values, specifying the lower limit and the upper limit of the scale in left y axis. +#' @param yr_limit two numeric values, specifying the lower limit and the upper limit of the scale in right y axis. +#' @param yl_breaks a numeric vector of positions for breaks in left y axis. +#' @param yr_breaks a numeric vector of positions for breaks in right y axis. +#' @param yl_minor_breaks a numeric vector of positions for minor breaks in left y axis. #' #' @export #' @examples @@ -58,16 +63,139 @@ yllab=NULL, yrlab=NULL, xlab=NULL, llist=NULL, plist=NULL, alist=NULL, blist=NULL, llab=NULL, plab=NULL, alab=NULL, blab=NULL, ltype=NULL, pshape=NULL, lsize=1, psize=1, -lcc=NULL, pcc=NULL, aff=NULL, bff=NULL, ana=TRUE, apos='stack', bna=TRUE, bpos='identity'){ +lcc=NULL, pcc=NULL, aff=NULL, bff=NULL, ana=TRUE, apos='stack', bna=TRUE, bpos='identity', +yl_limit=NULL, yr_limit=NULL, +yl_breaks= waiver(), yr_breaks= waiver(), yl_minor_breaks = waiver()){ #命名时间列################################# names(df)[1]="Datetime" - #副轴数值范围确定################################# - ryl=abs(max(df[,yl],na.rm = TRUE)-min(df[,yl],na.rm = TRUE)) + #按照上下限替换超出范围的数据################################# + ##左侧如果输入了yl_limit + if(length(yl_limit)!=0){ + ###如果左侧有点线,超过范围的替换 + if(length(intersect(llist,yl))!=0|length(intersect(plist,yl))!=0){ + if(length(yl_limit)!=0){ + yllp=c(intersect(llist,yl),intersect(plist,yl)) + df[,yllp][df[,yllp]>yl_limit[2]]=NA#upper + df[,yllp][df[,yllp]yl_limit[2]]=NA#upper + df[,yla][df[,yla]yl_limit[2]),yla]=NA#upper + df[which(rowSums(df[,yla], na.rm=TRUE)yl_limit[2]]=NA#upper + df[,yla][df[,yla]yl_limit[2]]=NA#upper + df[,ylb][df[,ylb]yl_limit[2]),ylb]=NA#upper + df[which(rowSums(df[,ylb], na.rm=TRUE)yl_limit[2]]=NA#upper + df[,ylb][df[,ylb]yr_limit[2]]=NA#upper + df[,yrlp][df[,yrlp]yr_limit[2]]=NA#upper + df[,yra][df[,yla]yr_limit[2]),yra]=NA#upper + df[which(rowSums(df[,yra], na.rm=TRUE)yr_limit[2]]=NA#upper + df[,yra][df[,yra]yr_limit[2]]=NA#upper + df[,yrb][df[,yrb]yr_limit[2]),ylb]=NA#upper + df[which(rowSums(df[,yrb], na.rm=TRUE)yr_limit[2]]=NA#upper + df[,yrb][df[,yrb] + %\VignetteIndexEntry{my-vignette} + %\VignetteEngine{knitr::rmarkdown} + %\VignetteEncoding{UTF-8} +--- + +```{r, include = FALSE} +knitr::opts_chunk$set( + collapse = TRUE, + comment = "#>" +) +``` + +```{r setup} +library(foqat) +```