Skip to content

Commit

Permalink
Initial drat release (#12)
Browse files Browse the repository at this point in the history
* Use Additional_repositories.
* Prune Imports.
* Use cran comments.
* Update site.
* Suggest lattice to fix error on rhub
* Buildignore revdep
* Update examples
  • Loading branch information
maurolepore authored Jan 30, 2019
1 parent 9e16915 commit 7b5e38b
Show file tree
Hide file tree
Showing 38 changed files with 194 additions and 366 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
^revdep$
^cran-comments\.md$
^Rplots\.pdf$
^README\.Rmd$
^LICENSE\.md$
Expand Down
15 changes: 6 additions & 9 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: fgeo.krig
Title: Analyze Soils Data
Version: 0.0.0.9007
Version: 1.0.0
Authors@R:
c(person(given = "Mauro",
family = "Lepore",
Expand All @@ -21,10 +21,9 @@ Depends:
R (>= 3.2)
Imports:
fgeo.tool,
fgeo.x,
geoR,
glue,
MASS,
purrr,
rlang,
stats,
tibble
Expand All @@ -33,17 +32,15 @@ Suggests:
dplyr,
ggplot2,
knitr,
purrr,
lattice,
rmarkdown,
spelling,
stringr,
testthat,
tidyr
VignetteBuilder:
knitr
Remotes:
forestgeo/fgeo.tool@*release,
forestgeo/fgeo.x@*release
Additional_repositories: https://forestgeo.github.io/drat/
Encoding: UTF-8
Language: en-US
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 6.1.1
3 changes: 2 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ S3method(as_tibble,krig_lst)
S3method(print,krig_lst)
S3method(summary,krig_lst)
export(as_tibble)
export(assert_is_installed)
export(krig)
export(krig_auto_params)
export(krig_breaks)
import(geoR)
importFrom(MASS,boxcox)
importFrom(glue,glue)
importFrom(fgeo.tool,assert_is_installed)
importFrom(rlang,"%||%")
importFrom(rlang,abort)
importFrom(rlang,eval_tidy)
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# fgeo.krig (development version)

* Work in progress.

# fgeo.krig 1.0.0 (GitHub and drat release)

* Initial release.
8 changes: 1 addition & 7 deletions R/as_tibble.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,7 @@
#'
#' as_tibble(krig)
#'
#' df <- as.data.frame(krig)
#' head(df)
#' class(df$var)
#'
#' df2 <- as.data.frame(krig, stringsAsFactors = FALSE)
#' head(df2)
#' class(df2$var)
#' head(as.data.frame(krig, stringsAsFactors = FALSE))
#' @family methods for fgeo generics
#' @export
as_tibble.krig_lst <- function(x, .id = "var", item = "df", ...) {
Expand Down
6 changes: 5 additions & 1 deletion R/imports-reexports.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#' @import geoR
#' @importFrom MASS boxcox
#' @importFrom stats nls rnorm var nls.control predict resid
#' @importFrom glue glue
#' @importFrom rlang abort inform warn expr eval_tidy expr_label %||%
#' @importFrom tibble as_tibble tibble
NULL

#' @export
tibble::as_tibble

#' @importFrom fgeo.tool assert_is_installed
#' @export
#' @keywords internal
fgeo.tool::assert_is_installed
15 changes: 7 additions & 8 deletions R/krig.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,22 @@
#'
#' @examples
#' library(fgeo.tool)
#'
#'
#' # Using automated parameters
#' summary(krig(soil_fake, var = "c"))
#'
#'
#' # Now using custom parameters (arbitrary but based on automated kriging params)
#' params <- list(
#' model = "circular", range = 100, nugget = 1000, sill = 46000, kappa = 0.5
#' )
#'
#'
#' # Also using not one but multiple soil variables
#' vars <- c("c", "p")
#' custom <- krig(soil_fake, vars, params = params, quiet = TRUE)
#' summary(custom)
#'
#'
#' as_tibble(custom, name = "soil_var")
#'
#'
#' tail(as_tibble(custom, item = "df.poly"))
#' @export
krig <- function(soil,
Expand Down Expand Up @@ -227,8 +227,8 @@ GetKrigedSoil <- function(df.soil,
#'
#' @export
krig_auto_params <- function(geodata,
trend = "cte",
breaks = krig_breaks(2, 320, 30)) {
trend = "cte",
breaks = krig_breaks(2, 320, 30)) {
vg <- variog(geodata, breaks = breaks, pairs.min = 5, trend = trend)
varModels <- c("exponential", "circular", "cauchy", "gaussian")
minValue <- NULL
Expand Down Expand Up @@ -407,7 +407,6 @@ krig_one <- function(soil,
use_ksline = TRUE,
quiet = FALSE) {
krig_msg <- function() {

plotdim <- plotdim %||% fgeo.tool::guess_plotdim(soil)
message("\nvar: ", var, "Using: gridsize = ", gridsize)

Expand Down
30 changes: 18 additions & 12 deletions R/krig_ksline.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ krig_ksline <- function(geodata, coords = geodata$coords, data = geodata$data,
messages.screen <- messages
}
locations <- .check.locations(locations)
if (length(unique(locations[, 1])) == 1 | length(unique(locations[
,
2
])) == 1) {
if (length(unique(locations[, 1])) == 1 |
length(unique(locations[, 2])) == 1) {
krige1d <- TRUE
} else {
krige1d <- FALSE
Expand Down Expand Up @@ -109,7 +107,8 @@ krig_ksline <- function(geodata, coords = geodata$coords, data = geodata$data,
xmati <- cbind(rep(1, ni), locations[, 2])
}
else {
xmat <- cbind(rep(1, n), coords[, 1], coords[
xmat <- cbind(rep(1, n), coords[, 1], coords
[
,
2
])
Expand All @@ -125,7 +124,8 @@ krig_ksline <- function(geodata, coords = geodata$coords, data = geodata$data,
}
if (m0 == "kt" & trend == 2) {
if (d == 1) {
xmat <- cbind(rep(1, n), coords[, 2], (coords[
xmat <- cbind(rep(1, n), coords[, 2], (coords
[
,
2
])^2)
Expand All @@ -135,16 +135,19 @@ krig_ksline <- function(geodata, coords = geodata$coords, data = geodata$data,
)
}
else {
xmat <- cbind(rep(1, n), coords[, 1], coords[
xmat <- cbind(rep(1, n), coords[, 1], coords
[
,
2
], (coords[, 1])^2, (coords[, 2])^2, coords[
], (coords[, 1])^2, (coords[, 2])^2, coords
[
,
1
] * coords[, 2])
xmati <- cbind(
rep(1, ni), locations[, 1],
locations[, 2], (locations[, 1])^2, (locations[
locations[, 2], (locations[, 1])^2, (locations
[
,
2
])^2, locations[, 1] * locations[, 2]
Expand Down Expand Up @@ -320,7 +323,8 @@ krig_ksline <- function(geodata, coords = geodata$coords, data = geodata$data,
if (d == 1) {
xmati <- cbind(rep(1, ni), locations[, 2])
} else {
xmati <- cbind(rep(1, ni), locations[
xmati <- cbind(rep(1, ni), locations
[
,
1
], locations[, 2])
Expand All @@ -333,10 +337,12 @@ krig_ksline <- function(geodata, coords = geodata$coords, data = geodata$data,
locations[, 2]^2
)
} else {
xmati <- cbind(rep(1, ni), locations[
xmati <- cbind(rep(1, ni), locations
[
,
1
], locations[, 2], (locations[, 1])^2, (locations[
], locations[, 2], (locations[, 1])^2, (locations
[
,
2
])^2, locations[, 1] * locations[, 2])
Expand Down
4 changes: 2 additions & 2 deletions R/summary.krig_lst.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
#' This method helps you to visualize the output of `krig()` (which outputs
#' objects of class "krig_lst"). It is similar to [utils::str()] but a little
#' cleaner. version of `str()`.
#'
#'
#' @param object The result of `krig()`.
#' @inheritDotParams base::summary
#'
#'
#' @family methods for common generics
#'
#' @return Prints a cleaner version of `str()` and returns its input invisibly.
Expand Down
Binary file removed Rplots.pdf
Binary file not shown.
25 changes: 25 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Test environments

* local windows 10 x64, R 3.5.2
* ubuntu 14.04 (on travis-ci), R 3.5.1
* win-builder (devel and release)

## R CMD check results

1.0.0

NOTE
New submission
Strong dependencies not in mainstream repositories:
fgeo.tool
Availability using Additional_repositories specification:
fgeo.tool yes https://forestgeo.github.io/drat/

NOTE
Examples with CPU or elapsed time > 5s
user system elapsed
as_tibble.krig_lst 2.732 0.144 8.169

## Downstream dependencies

TODO
5 changes: 4 additions & 1 deletion docs/CODE_OF_CONDUCT.html

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

5 changes: 4 additions & 1 deletion docs/CONTRIBUTING.html

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

5 changes: 4 additions & 1 deletion docs/ISSUE_TEMPLATE.html

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

5 changes: 4 additions & 1 deletion docs/LICENSE.html

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

5 changes: 4 additions & 1 deletion docs/SUPPORT.html

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

5 changes: 4 additions & 1 deletion docs/articles/index.html

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

Loading

0 comments on commit 7b5e38b

Please sign in to comment.