PADP 7120 Chapter Notes - Chapter 2: Subset

22 views2 pages

Document Summary

Lecture 2 : data manipulation & summary statistics: accessing & manipulating variables, load a data set. Note what r names of the dataset in the global environment : 2 methods accessing a dataset (1) $ method. Use formula dataset to create a new variable from a variable within the dataset. Ex. dataset of gubernatorial election called gagovdata: new variable = dataset&variable in dataset , vote share = gagovdata/gagovdata. votes (2) attach method. Easier method but confusing with multiple datasets loaded with similar variable names. Ex. adding vote share variable & its data to gagovdata dataset: gagovdata = data. frame(gagovdata, vote share, to identify subsets of variables data. Each observation of each variable in r can be accessed via an index number: variable[observation #, ex. vote share of person 2. Vote share [2: variable [row, column, ex. all of column 3 of the gagovdata dataset. **a blank can be left to indicate all of the rows/columns be included)

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents