-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xli branch update #6
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1f97c45
Merge pull request #4 from glmgen/main
zhoumo2716 0bfdc26
merge
zhoumo2716 87263e6
Merge branch 'xli-branch' of https://github.com/glmgen/tvdenoising in…
zhoumo2716 baa6d41
update
zhoumo2716 42e2e4a
version control
zhoumo2716 0f6a117
Update DESCRIPTION
zhoumo2716 c8d4119
add github workflow
zhoumo2716 7a2dac6
Update R-CMD-check.yaml
zhoumo2716 14ba0b5
Update README.md
zhoumo2716 1968c45
Update README.md
zhoumo2716 6a245ea
Update R-CMD-check.yaml
zhoumo2716 995474b
Update R-CMD-check.yaml
zhoumo2716 f0c4dca
Update R-CMD-check.yaml
zhoumo2716 73ab9ce
Update .github/workflows/R-CMD-check.yaml
zhoumo2716 258647a
Update .github/workflows/R-CMD-check.yaml
zhoumo2716 c00756c
Update .github/workflows/R-CMD-check.yaml
zhoumo2716 80987cd
Update test-tvdenoising.R
zhoumo2716 a166667
Merge branch 'xli-branch' of https://github.com/glmgen/tvdenoising in…
zhoumo2716 dc26e40
update error
zhoumo2716 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
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,2 +1,5 @@ | ||
^LICENSE\.md$ | ||
^README\.Rmd$ | ||
^.*\.Rproj$ | ||
^\.Rproj\.user$ | ||
^\.github$ |
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 @@ | ||
*.html |
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,53 @@ | ||
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples | ||
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help | ||
on: | ||
push: | ||
branches: [main, master] | ||
pull_request: | ||
branches: [main, master] | ||
|
||
name: R-CMD-check.yaml | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
R-CMD-check: | ||
runs-on: ${{ matrix.config.os }} | ||
|
||
name: ${{ matrix.config.os }} (${{ matrix.config.r }}) | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- {os: macos-latest, r: 'release'} | ||
- {os: windows-latest, r: 'release'} | ||
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} | ||
- {os: ubuntu-latest, r: 'release'} | ||
- {os: ubuntu-latest, r: 'oldrel-1'} | ||
|
||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
R_KEEP_PKG_SOURCE: yes | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: r-lib/actions/setup-pandoc@v2 | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
with: | ||
r-version: ${{ matrix.config.r }} | ||
http-user-agent: ${{ matrix.config.http-user-agent }} | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
with: | ||
extra-packages: any::rcmdcheck | ||
needs: check | ||
|
||
- uses: r-lib/actions/check-r-package@v2 | ||
with: | ||
upload-snapshots: true | ||
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' | ||
|
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,15 @@ | ||
# tests/testthat.R | ||
# This file is part of the standard setup for testthat. | ||
# It is recommended that you do not modify it. | ||
# | ||
# Where should you do additional test configuration? | ||
# Learn more about the roles of various files in: | ||
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview | ||
# * https://testthat.r-lib.org/articles/special-files.html | ||
|
||
library(testthat) | ||
library(tvdenoising) | ||
|
||
test_check("tvdenoising") | ||
|
||
|
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,16 @@ | ||
# tvdenoising handles incorrect input properly | ||
|
||
Code | ||
tvdenoising(y, lambda) | ||
Condition | ||
Error in `tvdenoising()`: | ||
! is.numeric(lambda) & (length(lambda) == 1) is not TRUE | ||
|
||
--- | ||
|
||
Code | ||
tvdenoising(y, 1, weights) | ||
Condition | ||
Error in `tvdenoising()`: | ||
! length(weights) == length(y) is not 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# tests/testthat/test-tvdenoising.R | ||
|
||
test_that("tvdenoising works correctly with no weights", { | ||
y <- c(1, 2, 3, 5, 8, 13, 21) | ||
lambda <- 1 | ||
result <- tvdenoising(y, lambda) | ||
expected_result <- c(2, 2, 3, 5, 8, 13, 20) | ||
expect_type(result, "double") | ||
expect_length(result, length(y)) | ||
expect_equal(result, expected_result, tolerance = 1e-6) | ||
}) | ||
|
||
|
||
test_that("tvdenoising works correctly with weights", { | ||
y <- c(1, 2, 3, 5, 8, 13, 21) | ||
lambda <- 1 | ||
|
||
weights <- c(1, 3, 3, 2, 5, 6, 2) | ||
result <- tvdenoising(y, lambda, weights) | ||
expect_type(result, "double") | ||
expect_length(result, length(y)) | ||
expected_result <- c(2,2,3,5,8,13,20.5) | ||
expect_equal(result, expected_result, tolerance = 1e-6) | ||
}) | ||
|
||
|
||
test_that("tvdenoising with uniform weights 1 matches unweighted version", { | ||
y <- c(1, 2, 3, 5, 8, 13, 21) | ||
lambda <- 1 | ||
uniform_weights1 <- rep(1, length(y)) | ||
result_no_weights <- tvdenoising(y, lambda) | ||
result_with_weights1 <- tvdenoising(y, lambda, uniform_weights1) | ||
expect_equal(result_no_weights, result_with_weights1, tolerance = 1e-6) | ||
}) | ||
|
||
test_that("tvdenoising with uniform weights 2", { | ||
y <- c(1, 2, 3, 5, 8, 13, 21) | ||
lambda <- 1 | ||
uniform_weights2 <- rep(2, length(y)) | ||
expected_result <- c(1.5, 2, 3, 5, 8, 13, 20.5) | ||
result_with_weights2 <- tvdenoising(y, lambda, uniform_weights2) | ||
expect_equal(expected_result, result_with_weights2, tolerance = 1e-6) | ||
}) | ||
|
||
|
||
|
||
test_that("tvdenoising handles incorrect input properly", { | ||
y <- c(1, 2, 3, 5, 8, 13, 21) | ||
lambda <- "not a number" | ||
|
||
# when lambda is not numeric | ||
expect_snapshot(error = TRUE, tvdenoising(y, lambda)) | ||
|
||
# when weights length does not match y | ||
weights <- c(1, 2) | ||
expect_snapshot(error = TRUE, tvdenoising(y, 1, weights)) | ||
}) | ||
|
||
|
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,17 @@ | ||
Version: 1.0 | ||
|
||
RestoreWorkspace: Default | ||
SaveWorkspace: Default | ||
AlwaysSaveHistory: Default | ||
|
||
EnableCodeIndexing: Yes | ||
UseSpacesForTab: Yes | ||
NumSpacesForTab: 2 | ||
Encoding: UTF-8 | ||
|
||
RnwWeave: Sweave | ||
LaTeX: pdfLaTeX | ||
|
||
BuildType: Package | ||
PackageUseDevtools: Yes | ||
PackageInstallArgs: --no-multiarch --with-keep.source |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line here will actually run all the tests as well.