Skip to content

Commit 55a8a4d

Browse files
committed
Initial version
1 parent cf51bc4 commit 55a8a4d

7 files changed

Lines changed: 213 additions & 46 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
name: CI
2+
23
on:
3-
- push
4-
- pull_request
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
59
jobs:
610
test:
711
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }}
@@ -10,13 +14,12 @@ jobs:
1014
matrix:
1115
version:
1216
- '1.0'
13-
- '1.4'
17+
- '1'
1418
- 'nightly'
1519
os:
16-
- ubuntu-latest
17-
- macOS-latest
1820
- windows-latest
1921
arch:
22+
- x86
2023
- x64
2124
steps:
2225
- uses: actions/checkout@v2
@@ -36,10 +39,3 @@ jobs:
3639
${{ runner.os }}-
3740
- uses: julia-actions/julia-buildpkg@latest
3841
- uses: julia-actions/julia-runtest@latest
39-
- uses: julia-actions/julia-processcoverage@v1
40-
- uses: codecov/codecov-action@v1
41-
with:
42-
file: lcov.info
43-
- uses: julia-actions/julia-uploadcoveralls@latest
44-
env:
45-
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}

.travis.yml

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,26 @@
11
# Documentation: http://docs.travis-ci.com/user/languages/julia
22
language: julia
3-
notifications:
4-
email: false
5-
julia:
6-
- 1.0
7-
- 1.4
8-
- nightly
3+
branches:
4+
only:
5+
- master
96
os:
107
- linux
118
- osx
12-
- windows
13-
arch:
14-
- x64
9+
julia:
10+
- 1.0
11+
- 1
12+
- nightly
1513
cache:
1614
directories:
1715
- ~/.julia/artifacts
18-
jobs:
19-
fast_finish: true
16+
matrix:
2017
allow_failures:
2118
- julia: nightly
19+
fast_finish: true
20+
notifications:
21+
email: false
2222
after_success:
23-
- |
24-
julia -e '
25-
using Pkg
26-
Pkg.add("Coverage")
27-
using Coverage
28-
Codecov.submit(process_folder())'
29-
- |
30-
julia -e '
31-
using Pkg
32-
Pkg.add("Coverage")
33-
using Coverage
34-
Coveralls.submit(process_folder())'
23+
- if [[ $TRAVIS_JULIA_VERSION = 1 ]] && [[ $TRAVIS_OS_NAME = linux ]]; then
24+
julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())';
25+
julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Coveralls.submit(process_folder())';
26+
fi

CITATION.bib

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
@misc{PalmerPenguins.jl,
2-
author = {David Widmann <dev+git@devmotion.de>},
3-
title = {PalmerPenguins.jl},
4-
url = {https://github.com/devmotion/PalmerPenguins.jl},
5-
version = {v0.1.0},
6-
year = {2020},
7-
month = {6}
1+
@article{PalmerPenguins.jl-2014,
2+
title = {Ecological Sexual Dimorphism and Environmental Variability within a Community of Antarctic Penguins (Genus Pygoscelis)},
3+
author = {Gorman KB and Williams TD and Fraser WR},
4+
journal = {PLoS ONE},
5+
year = {2014},
6+
volume = {9(3)},
7+
number = {e90081},
8+
pages = {-13},
9+
url = {https://doi.org/10.1371/journal.pone.0090081},
810
}

Project.toml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@ uuid = "8b842266-38fa-440a-9b57-31493939ab85"
33
authors = ["David Widmann <dev+git@devmotion.de>"]
44
version = "0.1.0"
55

6+
[deps]
7+
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
8+
DataDeps = "124859b0-ceae-595e-8997-d05f6a7a8dfe"
9+
610
[compat]
11+
CSV = "0.7.1"
12+
DataDeps = "0.7.2"
713
julia = "1"
814

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

1220
[targets]
13-
test = ["Test"]
21+
test = ["DataFrames", "Tables", "Test"]

README.md

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,62 @@
1-
# PalmerPenguins
1+
# PalmerPenguins.jl <a href='https://allisonhorst.github.io/palmerpenguins'><img src='man/figures/logo.png' align="right" height="138.5" /></a>
22

33
[![Build Status](https://github.com/devmotion/PalmerPenguins.jl/workflows/CI/badge.svg)](https://github.com/devmotion/PalmerPenguins.jl/actions)
44
[![Build Status](https://travis-ci.com/devmotion/PalmerPenguins.jl.svg?branch=master)](https://travis-ci.com/devmotion/PalmerPenguins.jl)
55
[![Coverage](https://codecov.io/gh/devmotion/PalmerPenguins.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/devmotion/PalmerPenguins.jl)
66
[![Coverage](https://coveralls.io/repos/github/devmotion/PalmerPenguins.jl/badge.svg?branch=master)](https://coveralls.io/github/devmotion/PalmerPenguins.jl?branch=master)
7+
8+
Load the [Palmer penguins dataset](https://allisonhorst.github.io/palmerpenguins/) in Julia.
9+
10+
## Overview
11+
12+
The [Palmer penguins dataset](https://allisonhorst.github.io/palmerpenguins/) by Allison
13+
Horst, Alison Hill, and Kristen Gorman is a dataset for data exploration & visualization,
14+
as an alternative to the Iris dataset.
15+
16+
The dataset contains data for 344 penguins. There are 3 different species of penguins in
17+
this dataset, collected from 3 islands in the Palmer Archipelago, Antarctica.
18+
19+
Data were collected and made available by
20+
[Dr. Kristen Gorman](https://www.uaf.edu/cfos/people/faculty/detail/kristen-gorman.php)
21+
and the [Palmer Station, Antarctica LTER](https://pal.lternet.edu/), a member of the
22+
[Long Term Ecological Research Network](https://lternet.edu/).
23+
24+
Data are available by
25+
[CC-0](https://creativecommons.org/share-your-work/public-domain/cc0/) license in
26+
accordance with the [Palmer Station LTER Data Policy](http://pal.lternet.edu/data/policies)
27+
and the
28+
[LTER Data Access Policy for Type I data](https://lternet.edu/data-access-policy/).
29+
30+
More information about the dataset is available in
31+
[its official documentation](https://allisonhorst.github.io/palmerpenguins/).
32+
33+
## Usage
34+
35+
The dataset can be loaded by
36+
37+
```julia-repl
38+
julia> using PalmerPenguins
39+
40+
julia> table = PalmerPenguins.load()
41+
```
42+
43+
This will download the dataset once using [DataDeps.jl](https://github.com/oxinabox/DataDeps.jl),
44+
displaying the information above and making it available for future use. The function
45+
`PalmerPenguins.load()` returns a
46+
[`CSV.File`](https://juliadata.github.io/CSV.jl/stable/#CSV.File) object that supports the
47+
[Tables.jl](https://github.com/JuliaData/Tables.jl) interface. For instance, it can be
48+
converted to a
49+
[`DataFrame`](https://juliadata.github.io/DataFrames.jl/stable/man/getting_started/#The-DataFrame-Type-1)
50+
by executing
51+
52+
```julia-repl
53+
julia> using DataFrames
54+
55+
julia> df = DataFrame(table)
56+
```
57+
58+
## Bibliography
59+
60+
Gorman KB, Williams TD, Fraser WR (2014) Ecological Sexual Dimorphism and Environmental
61+
Variability within a Community of Antarctic Penguins (Genus Pygoscelis). PLoS ONE 9(3):
62+
e90081. https://doi.org/10.1371/journal.pone.0090081

src/PalmerPenguins.jl

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,53 @@
11
module PalmerPenguins
22

3-
# Write your package code here.
3+
import CSV
4+
import DataDeps
5+
6+
const DEPNAME = "PalmerPenguins"
7+
const LINK = "https://cdn.jsdelivr.net/gh/allisonhorst/palmerpenguins@f13c212d42c1341167368dc225df191c5a6029b9/data-raw/"
8+
const DATA = "penguins.csv"
9+
const INFO =
10+
"""
11+
Dataset: The Palmer penguins dataset
12+
Authors: Allison Horst, Alison Hill, Kristen Gorman
13+
Website: https://allisonhorst.github.io/palmerpenguins/index.html
14+
15+
The Palmer penguins dataset is a dataset for data exploration & visualization, as an
16+
alternative to the Iris dataset.
17+
18+
The dataset contains data for 344 penguins. There are 3 different species of penguins in
19+
this dataset, collected from 3 islands in the Palmer Archipelago, Antarctica.
20+
21+
Data were collected and made available by
22+
[Dr. Kristen Gorman](https://www.uaf.edu/cfos/people/faculty/detail/kristen-gorman.php)
23+
and the [Palmer Station, Antarctica LTER](https://pal.lternet.edu/), a member of the
24+
[Long Term Ecological Research Network](https://lternet.edu/).
25+
26+
Data are available by
27+
[CC-0](https://creativecommons.org/share-your-work/public-domain/cc0/) license in
28+
accordance with the [Palmer Station LTER Data Policy](http://pal.lternet.edu/data/policies)
29+
and the
30+
[LTER Data Access Policy for Type I data](https://lternet.edu/data-access-policy/).
31+
32+
Please include this citation if you plan to use this database:
33+
[Gorman et al., 2014]
34+
Gorman KB, Williams TD, Fraser WR (2014) Ecological Sexual Dimorphism and Environmental
35+
Variability within a Community of Antarctic Penguins (Genus Pygoscelis). PLoS ONE 9(3):
36+
e90081. https://doi.org/10.1371/journal.pone.0090081
37+
"""
38+
39+
function load()
40+
file = DataDeps.@datadep_str DEPNAME * "/" * DATA
41+
return CSV.File(file; missingstring="NA")
42+
end
43+
44+
function __init__()
45+
DataDeps.register(DataDeps.DataDep(
46+
DEPNAME,
47+
INFO,
48+
LINK * DATA,
49+
"97d467baa3522040aa892fa7f2ff57b5195be5fef3cceca3f78a6b1a6e32d7a2",
50+
))
51+
end
452

553
end

test/runtests.jl

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,71 @@
11
using PalmerPenguins
2+
using CSV
3+
using DataFrames
4+
using Tables
25
using Test
36

7+
# Always accept download in CI tests
8+
ENV["DATADEPS_ALWAYS_ACCEPT"] = true
9+
410
@testset "PalmerPenguins.jl" begin
5-
# Write your tests here.
11+
@testset "load" begin
12+
table = PalmerPenguins.load()
13+
14+
# Check some properties
15+
@test table isa CSV.File
16+
@test length(table) == 344
17+
@test Tables.columnnames(Tables.columns(table)) == [
18+
:species,
19+
:island,
20+
:bill_length_mm,
21+
:bill_depth_mm,
22+
:flipper_length_mm,
23+
:body_mass_g,
24+
:sex,
25+
]
26+
27+
# Check first row
28+
firstrow = first(table)
29+
@test firstrow.species == "Adelie"
30+
@test firstrow.island == "Torgersen"
31+
@test firstrow.bill_length_mm == 39.1
32+
@test firstrow.bill_depth_mm == 18.7
33+
@test firstrow.flipper_length_mm == 181
34+
@test firstrow.body_mass_g == 3750
35+
@test firstrow.sex == "male"
36+
end
37+
38+
@testset "DataFrames" begin
39+
df = DataFrame(PalmerPenguins.load())
40+
41+
# Check some properties
42+
@test df isa DataFrame
43+
@test nrow(df) == 344
44+
@test names(df) == [
45+
"species",
46+
"island",
47+
"bill_length_mm",
48+
"bill_depth_mm",
49+
"flipper_length_mm",
50+
"body_mass_g",
51+
"sex",
52+
]
53+
@test eltype(df[!, :species]) === String
54+
@test eltype(df[!, :island]) === String
55+
@test eltype(df[!, :bill_length_mm]) === Union{Missing,Float64}
56+
@test eltype(df[!, :bill_depth_mm]) === Union{Missing,Float64}
57+
@test eltype(df[!, :flipper_length_mm]) === Union{Missing,Int}
58+
@test eltype(df[!, :body_mass_g]) === Union{Missing,Int}
59+
@test eltype(df[!, :sex]) === Union{Missing,String}
60+
61+
# Check first row
62+
firstrow = df[1, :]
63+
@test firstrow.species == "Adelie"
64+
@test firstrow.island == "Torgersen"
65+
@test firstrow.bill_length_mm == 39.1
66+
@test firstrow.bill_depth_mm == 18.7
67+
@test firstrow.flipper_length_mm == 181
68+
@test firstrow.body_mass_g == 3750
69+
@test firstrow.sex == "male"
70+
end
671
end

0 commit comments

Comments
 (0)