Skip to content

Commit

Permalink
Merge pull request #65 from selkamand/64-rename-relocate-testinputcsv
Browse files Browse the repository at this point in the history
feat: added lazybirdwatcher & simplified paths
  • Loading branch information
selkamand authored Oct 22, 2024
2 parents f370b61 + a31aa3a commit 4e059e0
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 6 deletions.
2 changes: 1 addition & 1 deletion R/gg1d.R
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ choose_colours <- function(data, palettes, plottable, ndistinct, coltype, colour
#' @return ggiraph interactive visualisation
#'
#' @examples
#' path_gg1d <- system.file("testdata/testinput.csv", package = "gg1d")
#' path_gg1d <- system.file("example.csv", package = "gg1d")
#' df <- read.csv(path_gg1d, header = TRUE, na.strings = "")
#' gg1d(df, col_id = "ID", col_sort = "Glasses")
#'
Expand Down
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ For examples of interactive gg1d plots see the [gg1d gallery](https://selkamand.
library(gg1d)
# Read data
path_gg1d <- system.file("testdata/testinput.csv", package = "gg1d")
path_gg1d <- system.file("example.csv", package = "gg1d")
df <- read.csv(path_gg1d, header = TRUE, na.strings = "")
# Plot data, sort by Glasses
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ gallery](https://selkamand.github.io/gg1d/articles/gallery.html)
library(gg1d)

# Read data
path_gg1d <- system.file("testdata/testinput.csv", package = "gg1d")
path_gg1d <- system.file("example.csv", package = "gg1d")
df <- read.csv(path_gg1d, header = TRUE, na.strings = "")

# Plot data, sort by Glasses
Expand Down
46 changes: 46 additions & 0 deletions inst/birdwatching.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Birdwatcher,Day,Magpies
Robert,Weekday,1
Robert,Weekday,4
Robert,Weekday,1
Robert,Weekday,2
Robert,Weekend,NA
Robert,Weekday,2
Robert,Weekday,3
Robert,Weekend,1
Robert,Weekday,2
Robert,Weekend,NA
Robert,Weekend,1
Robert,Weekday,3
Robert,Weekday,3
Robert,Weekend,1
Robert,Weekend,NA
Robert,Weekday,2
Robert,Weekend,1
Robert,Weekday,2
Robert,Weekday,1
Robert,Weekend,NA
Robert,Weekday,1
Robert,Weekend,1
Robert,Weekday,1
Robert,Weekday,4
Robert,Weekend,NA
Catherine,Weekday,1
Catherine,Weekday,1
Catherine,Weekend,1
Catherine,Weekday,2
Catherine,Weekday,2
Catherine,Weekend,6
Catherine,Weekday,1
Catherine,Weekday,1
Catherine,Weekend,2
Catherine,Weekday,1
Catherine,Weekday,1
Catherine,Weekend,2
Catherine,Weekday,4
Catherine,Weekday,1
Catherine,Weekend,1
Catherine,Weekday,1
Catherine,Weekday,1
Catherine,Weekend,1
Catherine,Weekday,1
Catherine,Weekday,1
File renamed without changes.
2 changes: 1 addition & 1 deletion man/gg1d.Rd

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

27 changes: 25 additions & 2 deletions vignettes/gallery.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,13 @@ gg1d(
)
```

### gg1d example (artificial) data
## Artificial Data

### Inbuilt gg1d example

```{r message=FALSE, fig.height = 6}
# Read data
path_gg1d <- system.file("testdata/testinput.csv", package = "gg1d")
path_gg1d <- system.file("example.csv", package = "gg1d")
df <- read.csv(path_gg1d, header = TRUE, na.strings = "")
# Plot data, sort by Glasses
Expand All @@ -100,3 +102,24 @@ gg1d(
legend_nrow = 2
)
```

### Lazy Birdwatcher

The simulated "Lazy Birdwatcher" dataset records magpie observations by Robert and Catherine. Robert doesn't birdwatch on weekends, resulting in missing data for him on those days. This pattern of missingness, dependent on both person and day, is hard to detect using one-dimensional EDA tools like skimr or two-dimensional tools like ggpairs from the GGally package, as they don't capture multi-variable interactions contributing to the missingness.

```{r message=FALSE, fig.height = 4}
# Read Data
path_lazy_birdwatcher <- system.file("birdwatching.csv", package = "gg1d")
df_lazy_birdatcher <- read.csv(path_lazy_birdwatcher)
# Plot Dataset by Number of Magpies Observed
gg1d(
df_lazy_birdatcher,
col_sort = "Magpies",
show_legend = TRUE,
palettes = list(
Birdwatcher = c(Robert = "#E69F00", Catherine = "#999999"),
Day = c(Weekday = "#999999" ,Weekend = "#009E73")
)
)
```

0 comments on commit 4e059e0

Please sign in to comment.