-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sp functions were moved to another package, sp2.
- Loading branch information
Showing
72 changed files
with
1,312 additions
and
667 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,3 +1,5 @@ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ | ||
^\.travis\.yml$ | ||
^appveyor\.yml$ | ||
^LICENSE\.md$ |
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,35 +1,32 @@ | ||
Package: Ipaper | ||
Type: Package | ||
Title: Paper writing tools | ||
Version: 0.1.3 | ||
Version: 0.1.4.9000 | ||
Authors@R: person("Dongdong", "Kong", email = "[email protected]", | ||
role = c("aut", "cre")) | ||
Description: Download papers batchly using DOIs from many database. And some practical functions. | ||
License: MIT + file LICENSE | ||
License: GPL-3 | ||
LazyData: TRUE | ||
import: | ||
RoxygenNote: 6.1.0 | ||
Suggests: testthat, | ||
Suggests: | ||
testthat (>= 2.1.0), | ||
knitr, | ||
rmarkdown | ||
LinkingTo: | ||
Rcpp, RcppArmadillo | ||
Imports: | ||
httr, | ||
xml2, | ||
httr, xml2, jsonlite, | ||
magrittr, | ||
stringr, purrr, | ||
jsonlite, | ||
maptools, | ||
sp, | ||
rgdal, | ||
lubridate, | ||
data.table, | ||
openxlsx, readxl, | ||
plyr, | ||
reshape2, | ||
graphics, methods, | ||
Rcpp, | ||
parallel, | ||
doParallel | ||
parallel, doParallel, | ||
foreach, plyr | ||
Remotes: | ||
kongdd/foreach, | ||
kongdd/plyr | ||
VignetteBuilder: knitr | ||
RoxygenNote: 6.1.1 | ||
Roxygen: list(markdown = TRUE) |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,24 @@ | ||
#' @title Ipaper | ||
#' @name Ipaper | ||
#' @aliases Ipaper-package | ||
#' @docType package | ||
#' @keywords download paper DOI | ||
#' | ||
#' @importFrom stringr str_extract | ||
#' @importFrom jsonlite fromJSON read_json | ||
#' @importFrom purrr is_empty map transpose | ||
#' @importFrom methods as | ||
#' @importFrom data.table data.table | ||
#' @importFrom graphics rect | ||
#' @import httr xml2 magrittr plyr | ||
#' | ||
#' @keywords internal | ||
"_PACKAGE" | ||
|
||
# The following block is used by usethis to automatically manage | ||
# roxygen namespace tags. Modify with care! | ||
## usethis namespace: start | ||
## usethis namespace: end | ||
# ' @useDynLib Ipaper, .registration = TRUE | ||
# ' @importFrom Rcpp sourceCpp | ||
NULL |
This file was deleted.
Oops, something went wrong.
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,28 @@ | ||
#' Add n-day flag | ||
#' | ||
#' To aggregated data into n-day (e.g. 8-day, 16-day) like MODIS product, a | ||
#' n-day flag is need. | ||
#' | ||
#' @param d data.frame or data.table | ||
#' @param days Integer number or vector, can't have duplicated value. | ||
#' | ||
#' @examples | ||
#' date = seq.Date(as.Date("2010-01-01"), as.Date("2010-12-31"), by = "day") | ||
#' d <- data.frame(date) | ||
#' dnew <- add_dn(d, days = c(8, 16)) | ||
#' @importFrom lubridate ymd year yday | ||
#' @export | ||
add_dn <- function(d, days = 8){ | ||
if (class(d$date) != 'Date') | ||
d$date %<>% ymd() | ||
|
||
d %<>% plyr::mutate(d, year = year(date), doy = yday(date)) | ||
|
||
days <- floor(days) | ||
for (i in seq_along(days)){ | ||
day <- days[i] | ||
# d$d8 = ceiling(d$doy/8) | ||
eval(parse(text = sprintf("d$d%d <- ceiling(d$doy/%d)", day, day))) | ||
} | ||
return(d) | ||
} |
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,2 @@ | ||
#' @export | ||
chunk <- function(x,n) split(x, cut(seq_along(x), n, labels = FALSE)) |
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,13 @@ | ||
#' contain | ||
#' find assigned pattern variable names | ||
#' @param d A data.frame vector, or list | ||
#' @param pattern string used to match `names(d)` | ||
#' | ||
#' @examples | ||
#' df <- data.frame(year = 2010, day = 1:3, month = 1, site = "A") | ||
#' contain(df, "year|month|day") | ||
#' @rdname tools | ||
#' @export | ||
contain <- function(d, pattern = "NDVI|EVI") { | ||
names(d) %>% .[grep(pattern, .)] | ||
} |
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,9 @@ | ||
#' fprintf | ||
#' Print sprintf result into console, just like C style fprintf function | ||
#' @param fmt a character vector of format strings, each of up to 8192 bytes. | ||
#' @param ... other parameters will be passed to `sprintf` | ||
#' | ||
#' @examples | ||
#' cat(fprintf("%s\n", "Hello phenofit!")) | ||
#' @export | ||
fprintf <- function(fmt, ...) cat(sprintf(fmt, ...)) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.