Skip to content

Commit

Permalink
add mkdir, touch; tidy file structure
Browse files Browse the repository at this point in the history
  • Loading branch information
kongdd committed Sep 4, 2021
1 parent bad59f2 commit c37d33c
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 88 deletions.
2 changes: 0 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ Depends:
import:
RoxygenNote: 6.1.0
Imports:
lattice,
xml2,
ggplot2,
jsonlite,
magrittr,
Expand Down
10 changes: 4 additions & 6 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export(last)
export(listk)
export(llply_par)
export(make_date)
export(make_datetime)
export(make_dt)
export(map)
export(mapvalues)
Expand All @@ -88,6 +89,7 @@ export(match2)
export(melt_list)
export(melt_tree)
export(merge_pdf)
export(mkdir)
export(mutate)
export(obj.size)
export(options_update)
Expand All @@ -109,7 +111,6 @@ export(set_dimnames)
export(set_font)
export(set_names)
export(setwd_clip)
export(sf_rect)
export(showfig)
export(smerge)
export(split_data)
Expand All @@ -118,10 +119,10 @@ export(stat_sd)
export(str_year)
export(subl)
export(tabular)
export(touch)
export(transpose)
export(unique_length)
export(upper_envelope)
export(url_filezilla)
export(which.isnull)
export(which.na)
export(which.notna)
Expand Down Expand Up @@ -174,6 +175,7 @@ importFrom(jsonlite,read_json)
importFrom(jsonlite,write_json)
importFrom(lubridate,days_in_month)
importFrom(lubridate,make_date)
importFrom(lubridate,make_datetime)
importFrom(lubridate,yday)
importFrom(lubridate,year)
importFrom(lubridate,ymd)
Expand Down Expand Up @@ -211,7 +213,3 @@ importFrom(utils,modifyList)
importFrom(utils,object.size)
importFrom(utils,str)
importFrom(utils,write.table)
importFrom(xml2,read_xml)
importFrom(xml2,xml_find_all)
importFrom(xml2,xml_find_first)
importFrom(xml2,xml_text)
15 changes: 0 additions & 15 deletions R/RcppExports.R

This file was deleted.

16 changes: 14 additions & 2 deletions R/cmd_func.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,28 @@ dir.show <- function (path = getwd()) {
# FUN(file = file, width = width, height = height, ...)
# }

#' check_dir
#' mkdir
#'
#' @param path character vectors
#'
#' @importFrom foreach %do%
#' @export
check_dir <- function(path){
mkdir <- function(path){
for (path_i in unique(path)) {
if (!dir.exists(path_i)) {
dir.create(path_i, recursive = TRUE)
}
}
path
}

#' @rdname mkdir
#' @export
check_dir <- mkdir

#' @keywords internal
#' @export
touch <- function(file) {
mkdir(dirname(file))
writeLines("", file)
}
File renamed without changes.
File renamed without changes.
5 changes: 4 additions & 1 deletion R/reexports.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,13 @@ data.table::is.data.table
#' @export
data.table::as.data.table

#' @importFrom lubridate make_date days_in_month
#' @importFrom lubridate make_date make_datetime days_in_month
#' @export
lubridate::make_date

#' @export
lubridate::make_datetime

#' @export
lubridate::days_in_month

Expand Down
3 changes: 1 addition & 2 deletions R/tools.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ cut_plevels <- function(x, pvalue = c(0.01, 0.05, 0.1), verbose = FALSE) {
c(-rev(.), 0, .)

levels_num <- cut(1, pvalue2) %>%
levels() %>%
{
levels() %>% {
c(rev(.[1:np]), rev(.[-(1:np)])) %>% rev()
}
levels_str <- c(
Expand Down
11 changes: 0 additions & 11 deletions R/tools_external_apps.R

This file was deleted.

23 changes: 0 additions & 23 deletions R/tools_sp.R
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@

#' sf_rect
#'
#' @examples
#' \dontrun{
#' xlim = c(112, 115)
#' ylim = c(21, 23)
#' range <- c(xlim, ylim)
#' poly = sf_rect(range)
#' write_sf(poly, "poly.shp")
#' }
#' @export
sf_rect <- function(range, crs = st_crs(4326)){
xlim = range[1:2]
ylim = range[3:4]
coors = matrix(c(xlim, rev(xlim), xlim[1], rep(ylim, each = 2), ylim[1]), ncol = 2)
pts = list(coors)
p <- st_polygon(list(coors)) #%T>% plot()
st_sfc(p, crs = crs)
}

# st_bbox(c(112, 115, 21, 23) %>% set_names(c("xmin", "xmax", "ymin", "ymax")), crs = st_crs(4326))

#' write_sp2rgb
#'
#' @param grid SpatialGridPixels or SpatialGridDataFrame object
Expand Down
1 change: 1 addition & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ install.packages("../Ipaper_0.1.5.9000.tar.gz", repos = NULL, type = "source", d
### Base tools

* `code`, `smerge`, `subl`, `github`: open app at assigned directory
* `mkdir`, `touch`
* `dir.show`: open at assigned directory in explorer
* `runningId`: print the running ID in the console
* `fprintf`: c style `fprintf`
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ After install, run `Ipaper::key_blind()` to make those shortcuts work.
### Base tools

- `code`, `smerge`, `subl`, `github`: open app at assigned directory
- `mkdir`, `touch`
- `dir.show`: open at assigned directory in explorer
- `runningId`: print the running ID in the console
- `fprintf`: c style `fprintf`
Expand Down
Binary file removed data/grid_avhrr.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion man/apply_3d.Rd

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

2 changes: 1 addition & 1 deletion man/ggplot2-ggproto.Rd

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

9 changes: 6 additions & 3 deletions man/check_dir.Rd → man/mkdir.Rd

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

3 changes: 2 additions & 1 deletion man/reexports.Rd

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

20 changes: 0 additions & 20 deletions man/sf_rect.Rd

This file was deleted.

0 comments on commit c37d33c

Please sign in to comment.