Learn R Programming

openintro (version 2.4.0)

lizard_habitat: Field data on lizards observed in their natural habitat

Description

Data on here lizard was observed and the level of sunlight. The data are collected on Sceloporus occidentalis (western fence lizards) by Stephen C. Adolph in 1983 (in desert and mountain sites) and by Dee Asbury in 2002-3 (in valley site).

Usage

lizard_habitat

Arguments

Format

A data frame with 332 observations on the following 2 variables.

site

Site of lizard observation: desert, mountain, or valley.

sunlight

Sunlight level at time of observation: sun (lizard was observed perching in full sunlight), partial (lizard was observed perching with part of its body in the sun, part in the shade), shade(lizard was observed perching in the shade).

Examples

Run this code
library(ggplot2)

# Frequencies
table(lizard_habitat)

# Stacked bar plots
ggplot(lizard_habitat, aes(y = site, fill = sunlight)) +
  geom_bar(position = "fill") +
  labs(x = "Proportion")

Run the code above in your browser using DataLab