Skip to content

Commit

Permalink
version 0.1.4.9000
Browse files Browse the repository at this point in the history
sp functions were moved to another package, sp2.
  • Loading branch information
kongdd committed May 17, 2019
1 parent 49af17a commit b1e9fd2
Show file tree
Hide file tree
Showing 72 changed files with 1,312 additions and 667 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
^.*\.Rproj$
^\.Rproj\.user$
^\.travis\.yml$
^appveyor\.yml$
^LICENSE\.md$
27 changes: 12 additions & 15 deletions DESCRIPTION
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)
4 changes: 3 additions & 1 deletion Ipaper.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
NumSpacesForTab: 4
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

LineEndingConversion: Windows

BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
Expand Down
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

595 changes: 595 additions & 0 deletions LICENSE.md

Large diffs are not rendered by default.

37 changes: 14 additions & 23 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@

export(InitCluster)
export(Init_Check)
export(add_dn)
export(box_qtl)
export(df2sp)
export(chunk)
export(contain)
export(dir.show)
export(download_aria2)
export(download_httr)
export(ensemble_mean)
export(extractId)
export(fprintf)
export(getDOIs_endnote)
export(getPointsMODISTile)
export(get_grid)
export(get_sbatch)
export(getwd_clip)
export(ggplot_legend)
export(github)
export(gridSaveToPoly)
export(ifelse2)
export(killCluster)
export(listk)
export(makeVIDEO)
export(melt_list)
export(merge_pdf)
export(obj.size)
export(pal)
export(par_sbatch)
export(prj84)
export(rdist.earth)
export(read_json.gee)
export(read_jsons.gee)
export(readxlsx_ToList)
export(read_xlsx2list)
export(runningId)
export(setwd_clip)
export(src_AMS)
Expand All @@ -46,26 +46,29 @@ export(which.na)
export(which.notna)
export(write_fig)
export(write_fig2ps)
export(write_list2xlsx)
export(write_urls)
export(write_webfile)
export(writelist_ToXlsx)
import(httr)
import(magrittr)
import(openxlsx)
import(parallel)
import(plyr)
import(readxl)
import(xml2)
importFrom(Rcpp,sourceCpp)
importFrom(data.table,as.data.table)
importFrom(data.table,data.table)
importFrom(data.table,fwrite)
importFrom(data.table,is.data.table)
importFrom(data.table,setkeyv)
importFrom(doParallel,registerDoParallel)
importFrom(ggplot2,ggplot_gtable)
importFrom(graphics,rect)
importFrom(jsonlite,fromJSON)
importFrom(jsonlite,read_json)
importFrom(maptools,readShapePoly)
importFrom(lubridate,yday)
importFrom(lubridate,year)
importFrom(lubridate,ymd)
importFrom(methods,as)
importFrom(parallel,makeCluster)
importFrom(parallel,mclapply)
Expand All @@ -75,18 +78,6 @@ importFrom(purrr,map)
importFrom(purrr,reduce)
importFrom(purrr,transpose)
importFrom(reshape2,melt)
importFrom(rgdal,project)
importFrom(rgdal,writeOGR)
importFrom(sp,"coordinates<-")
importFrom(sp,"proj4string<-")
importFrom(sp,CRS)
importFrom(sp,GridTopology)
importFrom(sp,SpatialPixelsDataFrame)
importFrom(sp,SpatialPolygons)
importFrom(sp,coordinates)
importFrom(sp,over)
importFrom(sp,proj4string)
importFrom(stringr,str_extract)
importFrom(utils,URLdecode)
importFrom(utils,write.table)
useDynLib(Ipaper, .registration = TRUE)
24 changes: 24 additions & 0 deletions R/Ipaper-package.R
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
7 changes: 0 additions & 7 deletions R/RcppExports.R

This file was deleted.

28 changes: 28 additions & 0 deletions R/add_dn.R
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)
}
2 changes: 2 additions & 0 deletions R/chunk.R
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))
13 changes: 13 additions & 0 deletions R/contain.R
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, .)]
}
14 changes: 7 additions & 7 deletions R/excel.R
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#' @title writelist.xlsx
#' write_list2xlsx
#'
#' @description base function, write list x into fileName with each list in workbook,
#' write shapefile dbf table into excel *.xlsx
#' @details
#'
#' @param x List object to be saved, \code{x} should have names and can't be NULL.
#' @param x List object to be saved, `x` should have names and can't be NULL.
#' @param file xlsx file name
#' @param .progress name of the progress bar to use, see create_progress_bar.
#' @param rowNames a logical value indicating whether the row names are to
#' be written.
#'
#' @import openxlsx
#' @export
writelist_ToXlsx <- function (x, file, .progress = "text", rowNames = FALSE)
write_list2xlsx <- function (x, file, .progress = "text", rowNames = FALSE)
{
sheetNames <- names(x)
if (is.null(sheetNames))
Expand All @@ -33,17 +33,17 @@ writelist_ToXlsx <- function (x, file, .progress = "text", rowNames = FALSE)
saveWorkbook(wb, file, overwrite = TRUE)
}

#' readxlsx_ToList
#' read_xlsx2list
#'
#' If excel file hava many sheets, this function also works.
#'
#' @param file xlsx or xls file path
#' @param ... other parameters to \code{\link[readxl]{read_excel}}
#' @param ... other parameters to [readxl::read_excel()]
#'
#' @import openxlsx readxl
#' @importFrom plyr llply
#' @export
readxlsx_ToList <- function(file, ...){
read_xlsx2list <- function(file, ...){
cat(sprintf("[---- Reading File: %s ----]\n", file))
## judge whether it's xls or xlsx
# if file is *.xls use readxl::read_excel
Expand Down
9 changes: 9 additions & 0 deletions R/fprintf.R
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, ...))
39 changes: 0 additions & 39 deletions R/getPointsMODISTile.R

This file was deleted.

Loading

0 comments on commit b1e9fd2

Please sign in to comment.