Skip to content

Commit

Permalink
spaces after commas
Browse files Browse the repository at this point in the history
  • Loading branch information
Joran Elias committed Feb 6, 2024
1 parent b4998d0 commit dc3b5b3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/testthat/test_stat_density_ridges.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,21 @@ test_that("alternative quantile function can be provided", {
})

test_that("unweighted densities are calculated correctly", {
df <- data.frame(x = rnorm(100),wts = runif(100))
df <- data.frame(x = rnorm(100), wts = runif(100))
df$wts <- df$wts / sum(df$wts)

gg_no_wts <- layer_data(ggplot(df, aes(x = x, y = 0)) + stat_density_ridges())
d_no_wts <- stats::density(df$x)

expect_equal(gg_no_wts$density,d_no_wts$y)
expect_equal(gg_no_wts$density, d_no_wts$y)
})

test_that("weighted densities are calculated correctly", {
df <- data.frame(x = rnorm(100),wts = runif(100))
df <- data.frame(x = rnorm(100), wts = runif(100))
df$wts <- df$wts / sum(df$wts)

gg_wts <- layer_data(ggplot(df, aes(x = x, y = 0, weight = wts)) + stat_density_ridges())
d_wts <- stats::density(df$x,weights = df$wts)
d_wts <- stats::density(df$x, weights = df$wts)

expect_equal(gg_wts$density,d_wts$y)
expect_equal(gg_wts$density, d_wts$y)
})

0 comments on commit dc3b5b3

Please sign in to comment.