Resource Image

Importing Data into R

Author(s): Rachel Hartnett

Oklahoma State University

1574 total view(s), 964 download(s)

0 comment(s) (Post a comment)

Summary:
This short swirl lesson on importing data is designed to 1) get a basic understanding in how tables are read into R and some common issues and 2) develop an individual set of instructions for students to use later to import a table on their own.

Licensed under CC Attribution-ShareAlike 4.0 International according to these terms

Version 1.0 - published on 10 May 2019 doi:10.25334/Q4W161 - cite this

Description

The focus of this swirl lesson is to provide scaffolding to help students learn to import data into R from a .csv file. The lesson includes a dataset modified from the Dryad Digital Repository (https://doi.org/10.5061/dryad.6jr5797). Students are required to format the provided .csv file and import the edited file into R by following the lesson. The assessment for this lesson asks for an annotated R script that would allow anyone to upload the table into R studio. This lesson is designed to be completed under an hour (the majority of students took ~20-35 minutes during an implementation of a previous version of this lesson). Modifications and/or additions that include several different issues involved in correctly formatting a data table would be welcome!

Notes

A previous version of this lesson (unpublished) was implemented in the classroom using the table from http://www.intro2r.info/unit2/importing-data.html. The main implementation issue for students was not knowing how to change the format of cells in Excel from 'Currency' to 'General'. An overview of basic excel skills was not provided, but would be encouraged before this lesson. The current version of the lesson uses a modified dataset from data dryad (https://doi.org/10.5061/dryad.6jr5797). This final lesson was not implemented in the classroom, but the issues of formatting were seen as a bigger issue for my students in a separate activity where students were required to make their own table in excel to import (the a further assessment step in the course). The powerpoint attached was enough information to guide students to the correct formatting practices. See implementation notes for more details.

Cite this work

Researchers should cite this work as follows: