-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4725209
commit 1c7d66a
Showing
18 changed files
with
115 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,30 @@ | ||
Package: rSPARCS | ||
Type: Package | ||
Title: Sites, Population, and Records Cleaning Skills | ||
Version: 0.1.0 | ||
Author: Wangjian Zhang, Bo Ye, Zhicheng Du, Ziqiang Lin, Jijin Yao, Yanan Jin, Wayne R. Lawrence | ||
Maintainer: Wangjian Zhang <wzhang27@albany.edu> | ||
Description: Data cleaning including 1) generating datasets for time-series and case-crossover analyses based on raw hospital records, 2)linking individuals to a areal map, 3)picking out cases living within a certain distance from a site, etc. For more information, please refer to Zhang W,etc. (2018) <doi: 10.1016/j.envpol.2018.08.030>. | ||
Version: 0.1.1 | ||
Authors@R: c( | ||
person("Wangjian", "Zhang", email="zhangwj227@mail.sysu.edu.cn",role = c("aut","cre")), | ||
person("Zhicheng", "Du", email = "duzhch5@mail.sysu.edu.cn", role = c("aut")), | ||
person('Xinlei', 'Deng', email = 'xinlei.deng@nih.gov', role = c('aut')), | ||
person('Ziqiang', 'Lin', email = 'linziqiang0314@jnu.edu.cn', role = c('aut')), | ||
person('Bo', 'Ye', email = 'yebowithyou2@gmail.com', role = c('aut')), | ||
person('Jijin', 'Yao', email = 'yaojj23@mail.sysu.edu.cn', role = c('aut')), | ||
person('Yanan', 'Jin', email = 'jinyn7@mail.sysu.edu.cn', role = c('aut')), | ||
person('Wayne', 'Lawrence', email = 'wayne.lawrence@nih.gov', role = c('aut'))) | ||
Maintainer: Wangjian Zhang <zhangwj227@mail.sysu.edu.cn> | ||
Description: Data cleaning including 1) generating datasets for time-series and case-crossover analyses based on raw hospital records, 2) linking individuals to an areal map, 3) picking out cases living within a buffer of certain size surrounding a site, etc. For more information, please refer to Zhang W,etc. (2018) <doi:10.1016/j.envpol.2018.08.030>. | ||
License: GPL-3 | ||
Encoding: UTF-8 | ||
LazyData: true | ||
Imports: data.table,spatialEco,geosphere,tigris,raster,sp,plyr | ||
Imports: data.table,sf,geosphere,tigris,raster,sp,plyr,dplyr,methods | ||
NeedsCompilation: no | ||
Packaged: 2020-11-15 21:06:41 UTC; LinLabAdmin | ||
Packaged: 2023-11-21 02:14:21 UTC; wzhan | ||
Author: Wangjian Zhang [aut, cre], | ||
Zhicheng Du [aut], | ||
Xinlei Deng [aut], | ||
Ziqiang Lin [aut], | ||
Bo Ye [aut], | ||
Jijin Yao [aut], | ||
Yanan Jin [aut], | ||
Wayne Lawrence [aut] | ||
Repository: CRAN | ||
Date/Publication: 2020-11-15 21:30:02 UTC | ||
Date/Publication: 2023-11-21 08:20:02 UTC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
fdd1ac18c91ae46bcabff7c0be80e97d *DESCRIPTION | ||
7fab5dacbcfdafd1c826ac1e1602cfd1 *NAMESPACE | ||
919de63a75e34619c560b2afeacd6006 *DESCRIPTION | ||
eab49ab3a8e010cb8a63859aa8227d06 *NAMESPACE | ||
94ff5404d00104143f040a252df33a0d *R/CXover.data.R | ||
ec506cc6ec38b021541e24ea28c2d779 *R/DBFgeocode.R | ||
84892ff6b39bb87f1dca8712341e589d *R/FIPS.name.R | ||
ab216426bc16c71407a1ab610681ce5a *R/case.series.R | ||
90f75890fc9bf8a732db1cedc5f1b978 *R/desc.comp.R | ||
0985ec7f024f15c0f8713ca884e059c6 *R/DBFgeocode.R | ||
194acf0cb5c4a46491da896efb0962bd *R/FIPS.name.R | ||
62779f4409aa6d24fbe743c673e1fcd4 *R/case.series.R | ||
1b1c7ed31a388220dbef65be80c00909 *R/desc.comp.R | ||
94753389fe82ef1c40c73e23ae5ac8ba *R/dupl.readm.R | ||
52dedc7741863639b316d85b4a3a5dd3 *R/exposure_lag.R | ||
57ad157b748a96f666592f99f952a0b1 *R/mediationking.R | ||
ebfee48932401739b07fb0bc2e862341 *R/pick.cases.R | ||
9c36851e2d19505224c38383b214d726 *R/raster_extract.R | ||
b7a1c8ea040bb6c756d47fea6f3dc53d *man/CXover.data.Rd | ||
ce7d624a49ae173b3ce7f29e1e8e1960 *R/raster_extract.R | ||
be46ce83d6da518244b1bb790fbe09e3 *man/CXover.data.Rd | ||
6e2eabbd39cd03cc539e3c9e5d92d069 *man/DBFgeocode.Rd | ||
f959d33d6b112cd0ea7eee7960d59da1 *man/FIPS.name.Rd | ||
01f074bdab28ca2eb634ed0f5a6008c6 *man/case.series.Rd | ||
d55ad0b449e3eb41daa18d5e6ef3116e *man/desc.comp.Rd | ||
4009cbd66cbf6593cc938c954f2c8c32 *man/dupl.readm.Rd | ||
84f439996a3b6cd9e09a8d17189ab3c2 *man/mediationking.Rd | ||
5dc0e3ba22311779a46f89d380e748e1 *man/pick.cases.Rd | ||
f94537c9268a551cc054a61d5d3b9144 *man/raster_extract.Rd | ||
8feac6ad96334d8f67890a2aa0928c8e *man/FIPS.name.Rd | ||
12736c16b2ea0b7c6ce2611df4cf1200 *man/case.series.Rd | ||
fa868574eba5c9faf2bd7b4e507bf281 *man/desc.comp.Rd | ||
5bd65175178a8066cbf67d70ae9b1da7 *man/dupl.readm.Rd | ||
3a67243c642d7ef5468b242d78fae94f *man/exposure_lag.Rd | ||
a9f2f92b9b476ce74971f16824f6aecd *man/mediationking.Rd | ||
43885c3c463d2e98b4973e1da02c2f50 *man/pick.cases.Rd | ||
b30c80b7ef4abeb7cde23abeddeeee32 *man/raster_extract.Rd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
exportPattern("^[[:alpha:]]+") | ||
importFrom("data.table","as.data.table") | ||
importFrom("data.table","as.data.table","setorderv") | ||
importFrom("geosphere","distGeo") | ||
importFrom("tigris","tracts") | ||
importFrom("raster","crs","extent","mask","extract", "crop","projection") | ||
importFrom("sp","coordinates","CRS","spTransform") | ||
importFrom("spatialEco","point.in.poly") | ||
importFrom("sf","st_as_sf","st_join") | ||
importFrom("stats", "IQR", "aov","glm","as.formula","binomial","lm","quantile" ,"chisq.test", "kruskal.test","median", "sd", "shapiro.test", "t.test", "wilcox.test") | ||
importFrom("plyr", "rbind.fill") | ||
importFrom("dplyr", "arrange") | ||
importFrom("methods", "as") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
exposure_lag<-function(data,var,maxlag,ID,Date,lag_suffix=c('_cu_lag','_si_lag')){ | ||
data=as.data.table(data) | ||
data=data.table::setorderv(data,c(ID,Date),c(1,1)) | ||
|
||
for (i in var) { | ||
for (lag in 1:maxlag) { | ||
data[,paste0(i,lag_suffix[2],lag)]=data[,stats::filter(get(i),c(rep(0,lag),1), sides=1),by=ID][,2]# single lag | ||
|
||
data[,paste0(i,lag_suffix[1],lag)]=data[,stats::filter(get(i),rep(1/(lag+1),(lag+1)), sides=1),by=ID][,2]# cumulative lag | ||
} | ||
} | ||
return(data) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
\name{exposure_lag} | ||
\alias{exposure_lag} | ||
\title{ | ||
Calculate Individual and Cumulative Lags for Exposure | ||
} | ||
\description{ | ||
Calculate individual and cumulative lag exposure for specific variables. Cumulative lag exposure was calculated by using moving average. | ||
} | ||
\usage{ | ||
exposure_lag(data,var,maxlag,ID,Date,lag_suffix) | ||
} | ||
\arguments{ | ||
\item{data}{A dataframe.} | ||
\item{var}{Variable names in the dataframe to specify variables to be used for the lag calculation.} | ||
\item{maxlag}{A number. The max day for calculating the lag exposure.} | ||
\item{ID}{A variable name. The exposure station ID.} | ||
\item{Date}{A variable name. A variable indicating the date of exposure measurement.} | ||
\item{lag_suffix}{A two-length vector indicating the cumulative lag or the individual lag. The first was the suffix for cumulative lag exposure. The second was for individual lag exposure. Default: c('_cu_lag','_si_lag')} | ||
} | ||
|
||
\value{ | ||
It returns a dataframe with calculated individual and cumulative lag exposures. 'var_cu_lag5' means the moving average from lag 0 to lag 5 days. 'var_si_lag5' means the exposure 5 days ago. | ||
} | ||
\references{ | ||
Deng X, Friedman S, Ryan I, et al. The independent and synergistic impacts of power outages and floods on hospital admissions for multiple diseases [published online ahead of print, 2022 Mar 5]. Sci Total Environ. 2022;828:154305. doi:10.1016/j.scitotenv.2022.154305 | ||
} | ||
\examples{ | ||
data=data.frame( | ||
ID=rep(1:5,each=5), | ||
Date=seq(as.Date('2022-01-01'),as.Date('2022-01-05'),by='1 day'), | ||
x=rnorm(25) | ||
) | ||
|
||
exposure_lag(data,var='x',maxlag=3,ID='ID',Date='Date') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters