Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
devmotion committed Jun 29, 2020
1 parent cf51bc4 commit 55a8a4d
Show file tree
Hide file tree
Showing 7 changed files with 213 additions and 46 deletions.
20 changes: 8 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: CI

on:
- push
- pull_request
push:
branches:
- master
pull_request:

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
Expand All @@ -10,13 +14,12 @@ jobs:
matrix:
version:
- '1.0'
- '1.4'
- '1'
- 'nightly'
os:
- ubuntu-latest
- macOS-latest
- windows-latest
arch:
- x86
- x64
steps:
- uses: actions/checkout@v2
Expand All @@ -36,10 +39,3 @@ jobs:
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
with:
file: lcov.info
- uses: julia-actions/julia-uploadcoveralls@latest
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
38 changes: 15 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
# Documentation: http://docs.travis-ci.com/user/languages/julia
language: julia
notifications:
email: false
julia:
- 1.0
- 1.4
- nightly
branches:
only:
- master
os:
- linux
- osx
- windows
arch:
- x64
julia:
- 1.0
- 1
- nightly
cache:
directories:
- ~/.julia/artifacts
jobs:
fast_finish: true
matrix:
allow_failures:
- julia: nightly
fast_finish: true
notifications:
email: false
after_success:
- |
julia -e '
using Pkg
Pkg.add("Coverage")
using Coverage
Codecov.submit(process_folder())'
- |
julia -e '
using Pkg
Pkg.add("Coverage")
using Coverage
Coveralls.submit(process_folder())'
- if [[ $TRAVIS_JULIA_VERSION = 1 ]] && [[ $TRAVIS_OS_NAME = linux ]]; then
julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())';
julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder())';
fi
16 changes: 9 additions & 7 deletions CITATION.bib
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@misc{PalmerPenguins.jl,
author = {David Widmann <dev+git@devmotion.de>},
title = {PalmerPenguins.jl},
url = {https://github.com/devmotion/PalmerPenguins.jl},
version = {v0.1.0},
year = {2020},
month = {6}
@article{PalmerPenguins.jl-2014,
title = {Ecological Sexual Dimorphism and Environmental Variability within a Community of Antarctic Penguins (Genus Pygoscelis)},
author = {Gorman KB and Williams TD and Fraser WR},
journal = {PLoS ONE},
year = {2014},
volume = {9(3)},
number = {e90081},
pages = {-13},
url = {https://doi.org/10.1371/journal.pone.0090081},
}
10 changes: 9 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ uuid = "8b842266-38fa-440a-9b57-31493939ab85"
authors = ["David Widmann <[email protected]>"]
version = "0.1.0"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataDeps = "124859b0-ceae-595e-8997-d05f6a7a8dfe"

[compat]
CSV = "0.7.1"
DataDeps = "0.7.2"
julia = "1"

[extras]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
test = ["DataFrames", "Tables", "Test"]
58 changes: 57 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,62 @@
# PalmerPenguins
# PalmerPenguins.jl <a href='https://allisonhorst.github.io/palmerpenguins'><img src='man/figures/logo.png' align="right" height="138.5" /></a>

[![Build Status](https://github.com/devmotion/PalmerPenguins.jl/workflows/CI/badge.svg)](https://github.com/devmotion/PalmerPenguins.jl/actions)
[![Build Status](https://travis-ci.com/devmotion/PalmerPenguins.jl.svg?branch=master)](https://travis-ci.com/devmotion/PalmerPenguins.jl)
[![Coverage](https://codecov.io/gh/devmotion/PalmerPenguins.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/devmotion/PalmerPenguins.jl)
[![Coverage](https://coveralls.io/repos/github/devmotion/PalmerPenguins.jl/badge.svg?branch=master)](https://coveralls.io/github/devmotion/PalmerPenguins.jl?branch=master)

Load the [Palmer penguins dataset](https://allisonhorst.github.io/palmerpenguins/) in Julia.

## Overview

The [Palmer penguins dataset](https://allisonhorst.github.io/palmerpenguins/) by Allison
Horst, Alison Hill, and Kristen Gorman is a dataset for data exploration & visualization,
as an alternative to the Iris dataset.

The dataset contains data for 344 penguins. There are 3 different species of penguins in
this dataset, collected from 3 islands in the Palmer Archipelago, Antarctica.

Data were collected and made available by
[Dr. Kristen Gorman](https://www.uaf.edu/cfos/people/faculty/detail/kristen-gorman.php)
and the [Palmer Station, Antarctica LTER](https://pal.lternet.edu/), a member of the
[Long Term Ecological Research Network](https://lternet.edu/).

Data are available by
[CC-0](https://creativecommons.org/share-your-work/public-domain/cc0/) license in
accordance with the [Palmer Station LTER Data Policy](http://pal.lternet.edu/data/policies)
and the
[LTER Data Access Policy for Type I data](https://lternet.edu/data-access-policy/).

More information about the dataset is available in
[its official documentation](https://allisonhorst.github.io/palmerpenguins/).

## Usage

The dataset can be loaded by

```julia-repl
julia> using PalmerPenguins
julia> table = PalmerPenguins.load()
```

This will download the dataset once using [DataDeps.jl](https://github.com/oxinabox/DataDeps.jl),
displaying the information above and making it available for future use. The function
`PalmerPenguins.load()` returns a
[`CSV.File`](https://juliadata.github.io/CSV.jl/stable/#CSV.File) object that supports the
[Tables.jl](https://github.com/JuliaData/Tables.jl) interface. For instance, it can be
converted to a
[`DataFrame`](https://juliadata.github.io/DataFrames.jl/stable/man/getting_started/#The-DataFrame-Type-1)
by executing

```julia-repl
julia> using DataFrames
julia> df = DataFrame(table)
```

## Bibliography

Gorman KB, Williams TD, Fraser WR (2014) Ecological Sexual Dimorphism and Environmental
Variability within a Community of Antarctic Penguins (Genus Pygoscelis). PLoS ONE 9(3):
e90081. https://doi.org/10.1371/journal.pone.0090081
50 changes: 49 additions & 1 deletion src/PalmerPenguins.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,53 @@
module PalmerPenguins

# Write your package code here.
import CSV
import DataDeps

const DEPNAME = "PalmerPenguins"
const LINK = "https://cdn.jsdelivr.net/gh/allisonhorst/palmerpenguins@f13c212d42c1341167368dc225df191c5a6029b9/data-raw/"
const DATA = "penguins.csv"
const INFO =
"""
Dataset: The Palmer penguins dataset
Authors: Allison Horst, Alison Hill, Kristen Gorman
Website: https://allisonhorst.github.io/palmerpenguins/index.html
The Palmer penguins dataset is a dataset for data exploration & visualization, as an
alternative to the Iris dataset.
The dataset contains data for 344 penguins. There are 3 different species of penguins in
this dataset, collected from 3 islands in the Palmer Archipelago, Antarctica.
Data were collected and made available by
[Dr. Kristen Gorman](https://www.uaf.edu/cfos/people/faculty/detail/kristen-gorman.php)
and the [Palmer Station, Antarctica LTER](https://pal.lternet.edu/), a member of the
[Long Term Ecological Research Network](https://lternet.edu/).
Data are available by
[CC-0](https://creativecommons.org/share-your-work/public-domain/cc0/) license in
accordance with the [Palmer Station LTER Data Policy](http://pal.lternet.edu/data/policies)
and the
[LTER Data Access Policy for Type I data](https://lternet.edu/data-access-policy/).
Please include this citation if you plan to use this database:
[Gorman et al., 2014]
Gorman KB, Williams TD, Fraser WR (2014) Ecological Sexual Dimorphism and Environmental
Variability within a Community of Antarctic Penguins (Genus Pygoscelis). PLoS ONE 9(3):
e90081. https://doi.org/10.1371/journal.pone.0090081
"""

function load()
file = DataDeps.@datadep_str DEPNAME * "/" * DATA
return CSV.File(file; missingstring="NA")
end

function __init__()
DataDeps.register(DataDeps.DataDep(
DEPNAME,
INFO,
LINK * DATA,
"97d467baa3522040aa892fa7f2ff57b5195be5fef3cceca3f78a6b1a6e32d7a2",
))
end

end
67 changes: 66 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,71 @@
using PalmerPenguins
using CSV
using DataFrames
using Tables
using Test

# Always accept download in CI tests
ENV["DATADEPS_ALWAYS_ACCEPT"] = true

@testset "PalmerPenguins.jl" begin
# Write your tests here.
@testset "load" begin
table = PalmerPenguins.load()

# Check some properties
@test table isa CSV.File
@test length(table) == 344
@test Tables.columnnames(Tables.columns(table)) == [
:species,
:island,
:bill_length_mm,
:bill_depth_mm,
:flipper_length_mm,
:body_mass_g,
:sex,
]

# Check first row
firstrow = first(table)
@test firstrow.species == "Adelie"
@test firstrow.island == "Torgersen"
@test firstrow.bill_length_mm == 39.1
@test firstrow.bill_depth_mm == 18.7
@test firstrow.flipper_length_mm == 181
@test firstrow.body_mass_g == 3750
@test firstrow.sex == "male"
end

@testset "DataFrames" begin
df = DataFrame(PalmerPenguins.load())

# Check some properties
@test df isa DataFrame
@test nrow(df) == 344
@test names(df) == [
"species",
"island",
"bill_length_mm",
"bill_depth_mm",
"flipper_length_mm",
"body_mass_g",
"sex",
]
@test eltype(df[!, :species]) === String
@test eltype(df[!, :island]) === String
@test eltype(df[!, :bill_length_mm]) === Union{Missing,Float64}
@test eltype(df[!, :bill_depth_mm]) === Union{Missing,Float64}
@test eltype(df[!, :flipper_length_mm]) === Union{Missing,Int}
@test eltype(df[!, :body_mass_g]) === Union{Missing,Int}
@test eltype(df[!, :sex]) === Union{Missing,String}

# Check first row
firstrow = df[1, :]
@test firstrow.species == "Adelie"
@test firstrow.island == "Torgersen"
@test firstrow.bill_length_mm == 39.1
@test firstrow.bill_depth_mm == 18.7
@test firstrow.flipper_length_mm == 181
@test firstrow.body_mass_g == 3750
@test firstrow.sex == "male"
end
end

0 comments on commit 55a8a4d

Please sign in to comment.