Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
356 changes: 356 additions & 0 deletions lib/node_modules/@stdlib/datasets/penguins/LICENSE

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions lib/node_modules/@stdlib/datasets/penguins/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Copyright (c) 2024 The Stdlib Authors.

Dataset is from Palmer Peguins Dataset (https://github.com/allisonhorst/palmerpenguins).

All messages were posted to public fora, were sent to the original author in the
knowledge that they may be made public, were sent by the original author, or
originated as newsletters from public news web sites.

Copyright for the text in the messages remains with the original senders.
257 changes: 257 additions & 0 deletions lib/node_modules/@stdlib/datasets/penguins/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
<!--

@license Apache-2.0

Copyright (c) 2024 The Stdlib Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->

# Palmer Penguins

> The [Palmer Penguins][palmer-penguins] data contains size measurements for three penguin species observed on three islands in the Palmer Archipelago Antarctica. Commonly used as an alternative to the [Iris dataset][iris-dataset].

<section class="intro">

</section>

<!-- /.intro -->

<section class="usage">

## Usage

```javascript
var dataset = require( '@stdlib/datasets/penguins' );
```

#### dataset()

Returns the [Palmer Penguins][palmer-penguins] public dataset.

```javascript
var data = dataset();
/* returns
[
{
'studyName': 'PAL0708',
'sampleNumber': 1,
'species': 'Adelie Penguin (Pygoscelis adeliae)',
'region': 'Anvers',
'island': 'Torgerse',
'stage': 'Adult, 1 Egg Stage',
'individualID': 'N1A1',
'clutchCompletion': true,
'dateEgg': '2007-11-11',
'culmenLength': 39.1,
'culmenDepth': 18.7,
'flipperLength': 181,
'bodyMass': 3750,
'sex': 'MALE',
'delta15N': null,
'delta13C': null,
'comments': 'Not enough blood for isotopes.'
},
...
]
*/
```

Each `array` element has the following fields:

- `studyName`: Sampling expedition from which data were collected.
- `sampleNumber`: An integer denoting the continuous numbering sequence for each sample.
- `species`: A string denoting whether the observation belongs to an Adelie, Chinstrap or a Gentoo Penguin.
- `region`: A string denoting the region of Palmer LTER sampling grid.
- `island`: Island name (Dream, Torgersen, or Biscoe) in the Palmer Archipelago (Antarctica).
- `stage`: A string denoting reproductive stage at sampling.
- `individualID`: A string denoting the unique ID for each individual in dataset.
- `clutchCompletion`: A boolean whether the study nest was observed with a full clutch, i.e., 2 eggs.
- `dateEgg`: The date when the study nest was observed with 1 egg.
- `culmenLength`: The length of the dorsal ridge of a bird's bill (millimeters).
- `culmenDepth`: The depth of the dorsal ridge of a bird's bill (millimeters).
- `flipperLength`: The length penguin flipper (millimeters).
- `bodyMass`: The penguin's body mass in grams.
- `sex`: The sex of the penguin.
- `delta15N`: The measure of the ratio of stable isotopes 15N:14N.
- `delta13C`: The measure of the ratio of stable isotopes 13C:12C.
- `comments`: Additional relevant information for the observation.

</section>

<!-- /.usage -->

<section class="examples">

## Examples

<!-- eslint no-undef: "error", @cspell/spellchecker: "off" -->

```javascript
var Plot = require( '@stdlib/plot' );
var dataset = require( '@stdlib/datasets/penguins' );

var data = dataset();

var speciesMapping = {
'Adelie Penguin (Pygoscelis adeliae)': 'adeliae',
'Gentoo penguin (Pygoscelis papua)': 'gentoo',
'Chinstrap penguin (Pygoscelis antarctica)': 'chinstrap'
};

// Extract Penguins data...
var x = [];
var y = [];
var species = [];

var speciesType;
var flipperLen;
var bodyMass;
var i;
for ( i = 0; i < data.length; i++ ) {
flipperLen = data[ i ].flipperLength;
bodyMass = data[ i ].bodyMass;
speciesType = data[ i ].species;
if ( flipperLen !== null && bodyMass !== null && speciesType !== null ) {
x.push( flipperLen );
y.push( bodyMass );
species.push( speciesMapping[ speciesType ] );
}
}

// Create a plot instance:
var opts = {
'lineStyle': 'none',
'symbols': 'closed-circle',
'xLabel': 'Flipper Length (mm)',
'yLabel': 'Body Mass (g)',
'title': 'Flipper Length & Body Mass for Adelie, Chinstrap & Gentoo Penguins'
};
var plot = new Plot( [ x ], [ y ], opts );

plot.width = 650;
plot.height = 480;
plot.colors = 'category20';
plot.labels = species;

// Render the plot:
console.log( plot.render( 'html' ) );
```

</section>

<!-- /.examples -->

* * *

<section class="cli">

## CLI

<section class="usage">

### Usage

```text
Usage: penguins [options]

Options:

-h, --help Print this message.
-V, --version Print the package version.
--format fmt Output format: 'csv' or 'ndjson'.
```

</section>

<!-- /.usage -->

<section class="notes">

### Notes

- The CLI supports two output formats: comma-separated values ([CSV][csv]) and newline-delimited JSON ([NDJSON][ndjson]). The default output format is [CSV][csv].

</section>

<!-- /.notes -->

<section class="examples">

### Examples

```bash
$ penguins
```

</section>

<!-- /.examples -->

</section>

<!-- /.cli -->

<section class="references">

## References

- 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: doi:10.1371/journal.pone.0090081.
- Palmer Station Antarctica LTER and K. Gorman, 2020. Structural size measurements and isotopic signatures of foraging among adult male and female Adélie penguins (Pygoscelis adeliae) nesting along the Palmer Archipelago near Palmer Station, 2007-2009 ver 5. Environmental Data Initiative: doi:10.6073/pasta/98b16d7d563f265cb52372c8ca99e60f.
- Palmer Station Antarctica LTER and K. Gorman. 2020. Structural size measurements and isotopic signatures of foraging among adult male and female Gentoo penguin (Pygoscelis papua) nesting along the Palmer Archipelago near Palmer Station, 2007-2009 ver 5. Environmental Data Initiative: doi:10.6073/pasta/7fca67fb28d56ee2ffa3d9370ebda689.
- Palmer Station Antarctica LTER and K. Gorman, 2020. Structural size measurements and isotopic signatures of foraging among adult male and female Chinstrap penguin (Pygoscelis antarcticus) nesting along the Palmer Archipelago near Palmer Station, 2007-2009 ver 6. Environmental Data Initiative: doi:10.6073/pasta/c14dfcfada8ea13a17536e73eb6fbe9e.

</section>

<!-- /.references -->

<!-- <license> -->

* * *

## License

The data files (databases) are licensed under an [Open Data Commons Public Domain Dedication & License 1.0][pddl-1.0] and their contents are licensed under a [Creative Commons Zero v1.0 Universal][cc0]. The software is licensed under [Apache License, Version 2.0][apache-license].

<!-- </license> -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">

</section>

<!-- /.related -->

<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="links">

[pddl-1.0]: http://opendatacommons.org/licenses/pddl/1.0/

[cc0]: https://creativecommons.org/publicdomain/zero/1.0

[apache-license]: https://www.apache.org/licenses/LICENSE-2.0

[csv]: https://tools.ietf.org/html/rfc4180

[ndjson]: http://specs.frictionlessdata.io/ndjson/

[palmer-penguins]: https://github.com/allisonhorst/palmerpenguins

[iris-dataset]: https://en.wikipedia.org/wiki/Iris_flower_data_set

</section>

<!-- /.links -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var bench = require( '@stdlib/bench' );
var isObjectArray = require( '@stdlib/assert/is-plain-object-array' );
var pkg = require( './../package.json' ).name;
var penguins = require( './../lib/browser.js' );


// MAIN //

bench( pkg+'::browser', function benchmark( b ) {
var data;
var i;
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
data = penguins();
if ( data.length === 0 ) {
b.fail( 'should have a length greater than 0' );
}
}
b.toc();
if ( !isObjectArray( data ) ) {
b.fail( 'should return an object array' );
}
b.pass( 'benchmark finished' );
b.end();
});
55 changes: 55 additions & 0 deletions lib/node_modules/@stdlib/datasets/penguins/benchmark/benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

'use strict';

// MODULES //

var bench = require( '@stdlib/bench' );
var IS_BROWSER = require( '@stdlib/assert/is-browser' );
var isObjectArray = require( '@stdlib/assert/is-plain-object-array' );
var pkg = require( './../package.json' ).name;
var penguins = require( './../lib' );


// VARIABLES //

var opts = {
'skip': IS_BROWSER
};


// MAIN //

bench( pkg, opts, function benchmark( b ) {
var data;
var i;
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
data = penguins();
if ( data.length === 0 ) {
b.fail( 'should have a length greater than 0' );
}
}
b.toc();
if ( !isObjectArray( data ) ) {
b.fail( 'should return an object array' );
}
b.pass( 'benchmark finished' );
b.end();
});
Loading
Loading