Skip to content

Commit

Permalink
Merge pull request #103 from tianshu129/develop
Browse files Browse the repository at this point in the history
V2.0.1
  • Loading branch information
tianshu129 authored Mar 6, 2022
2 parents 9ff85d9 + df32cb0 commit 2773833
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 22 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: foqat
Type: Package
Title: Field Observation Quick Analysis Toolkit
Version: 2.0.0
Version: 2.0.1
Author: Tianshu Chen
Maintainer: Tianshu Chen <[email protected]>
Description: Tools for quickly processing and analyzing
Expand Down
22 changes: 13 additions & 9 deletions R/geom_ts.r
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
#' @param pcc vector, colors of points. The default vaule is NULL. The default vaule is NULL.
#' @param aff fill color of areas. The default vaule is NULL.
#' @param bff fill color of bars. The default vaule is NULL.
#' @param ana logical value, the way to handle NA values for areas. If you select FALSE, NA value will be replaced by 0.
#' @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.
#'
#' @export
#' @examples
Expand Down Expand Up @@ -54,7 +58,7 @@ 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){
lcc=NULL, pcc=NULL, aff=NULL, bff=NULL, ana=TRUE, apos='stack', bna=TRUE, bpos='identity'){
#命名时间列#################################
names(df)[1]="Datetime"

Expand Down Expand Up @@ -84,8 +88,8 @@ lcc=NULL, pcc=NULL, aff=NULL, bff=NULL){
###因子排序
df_yl_alist$variable=factor(df_yl_alist$variable,levels=fc_yl_alist)
###NA值用0
df_yl_alist[is.na(df_yl_alist)]=0
p=p+geom_area(data=df_yl_alist, aes(x = Datetime,y = value, fill = variable), position = 'stack')
if(ana==FALSE){df_yl_alist[is.na(df_yl_alist)]=0}
p=p+geom_area(data=df_yl_alist, aes(x = Datetime,y = value, fill = variable), position = apos)
}

##if area in right
Expand All @@ -101,8 +105,8 @@ lcc=NULL, pcc=NULL, aff=NULL, bff=NULL){
###因子排序
df_yr_alist$variable=factor(df_yr_alist$variable,levels=fc_yr_alist)
###NA值用0
df_yr_alist[is.na(df_yr_alist)]=0
p=p+geom_area(data=df_yr_alist, aes(x = Datetime,y = value*ryl/ryr, fill = variable), position = 'stack')
if(ana==FALSE){df_yr_alist[is.na(df_yr_alist)]=0}
p=p+geom_area(data=df_yr_alist, aes(x = Datetime,y = value*ryl/ryr, fill = variable), position = apos)
}

#if(!exists("yl_alist")){yl_alist=NULL}
Expand Down Expand Up @@ -137,8 +141,8 @@ lcc=NULL, pcc=NULL, aff=NULL, bff=NULL){
###因子排序
df_yl_blist$variable=factor(df_yl_blist$variable,levels=fc_yl_blist)
###NA值用0
df_yl_blist[is.na(df_yl_blist)]=0
p=p+geom_bar(data=df_yl_blist, aes(x = Datetime,y = value, fill = variable), stat = 'identity')
if(bna==FALSE){df_yl_blist[is.na(df_yl_blist)]=0}
p=p+geom_bar(data=df_yl_blist, aes(x = Datetime,y = value, fill = variable), stat = bpos)
}

##if area in right
Expand All @@ -154,8 +158,8 @@ lcc=NULL, pcc=NULL, aff=NULL, bff=NULL){
###因子排序
df_yr_blist$variable=factor(df_yr_blist$variable,levels=fc_yr_blist)
###NA值用0
df_yr_blist[is.na(df_yr_blist)]=0
p=p+geom_bar(data=df_yr_blist, aes(x = Datetime,y = value*ryl/ryr, fill = variable), stat = 'identity')
if(bna==FALSE){df_yr_blist[is.na(df_yr_blist)]=0}
p=p+geom_bar(data=df_yr_blist, aes(x = Datetime,y = value*ryl/ryr, fill = variable), stat = bpos)
}

#if(!exists("yl_blist")){yl_blist=NULL}
Expand Down
6 changes: 3 additions & 3 deletions R/loh.R
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ loh <- function(df, unit = "ppbv", t = 25, p = 101.325, stcd=FALSE, sortd =TRUE,
Con_ugm_group=data.frame(Time=df[,1], Alkanes=NA, Alkenes_exclude_BVOC=NA, BVOC=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
loh_df_group=data.frame(Time=df[,1], Alkanes=NA, Alkenes_exclude_BVOC=NA, BVOC=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
}else{
Con_ppbv_group=data.frame(Time=df[,1], Alkanes=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
Con_ugm_group=data.frame(Time=df[,1], Alkanes=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
loh_df_group=data.frame(Time=df[,1], Alkanes=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
Con_ppbv_group=data.frame(Time=df[,1], Alkanes=NA, Alkenes=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
Con_ugm_group=data.frame(Time=df[,1], Alkanes=NA, Alkenes=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
loh_df_group=data.frame(Time=df[,1], Alkanes=NA, Alkenes=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
}

#sum up columns
Expand Down
6 changes: 3 additions & 3 deletions R/ofp.R
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ ofp <- function(df, inunit = "ppbv", outunit = "ppbv", t = 25, p = 101.325, stcd
Con_ugm_group=data.frame(Time=df[,1], Alkanes=NA, Alkenes_exclude_BVOC=NA, BVOC=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
ofp_df_group=data.frame(Time=df[,1], Alkanes=NA, Alkenes_exclude_BVOC=NA, BVOC=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
}else{
Con_ppbv_group=data.frame(Time=df[,1], Alkanes=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
Con_ugm_group=data.frame(Time=df[,1], Alkanes=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
ofp_df_group=data.frame(Time=df[,1], Alkanes=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
Con_ppbv_group=data.frame(Time=df[,1], Alkanes=NA, Alkenes=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
Con_ugm_group=data.frame(Time=df[,1], Alkanes=NA, Alkenes=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
ofp_df_group=data.frame(Time=df[,1], Alkanes=NA, Alkenes=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
}

#sum up columns
Expand Down
6 changes: 3 additions & 3 deletions R/vocct.R
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ vocct <- function(df, unit = "ppbv", t = 25, p = 101.325, stcd=FALSE, sortd =TRU
Con_ppbv_group=data.frame(Time=df[,1], Alkanes=NA, Alkenes_exclude_BVOC=NA, BVOC=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
Con_ugm_group=data.frame(Time=df[,1], Alkanes=NA, Alkenes_exclude_BVOC=NA, BVOC=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
}else{
Con_ppbv_group=data.frame(Time=df[,1], Alkanes=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
Con_ugm_group=data.frame(Time=df[,1], Alkanes=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
Con_ppbv_group=data.frame(Time=df[,1], Alkanes=NA, Alkenes=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
Con_ugm_group=data.frame(Time=df[,1], Alkanes=NA, Alkenes=NA, Alkynes=NA, Aromatic_Hydrocarbons=NA, Oxygenated_Organics=NA, Other_Organic_Compounds=NA, Unknown=NA)
}

#sum up columns
Expand Down Expand Up @@ -216,7 +216,7 @@ vocct <- function(df, unit = "ppbv", t = 25, p = 101.325, stcd=FALSE, sortd =TRU
Con_ugm = Con_ugm,
Con_ugm_stat = Con_ugm_stat,
Con_ugm_group = Con_ugm_group,
Con_ugm_group_mean = Con_ugm_group_stat,
Con_ugm_group_stat = Con_ugm_group_stat,
Con_ppbv = Con_ppbv,
Con_ppbv_stat = Con_ppbv_stat,
Con_ppbv_group = Con_ppbv_group,
Expand Down
14 changes: 13 additions & 1 deletion man/geom_ts.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/trs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2773833

Please sign in to comment.