given to you by others • Data you collect yourself This week Next week Fieldwork, physical datasheets, surveys, data from figures – data that have NOT been coded, where you can design the spreadsheet yourself Data that have already been coded and stored in a table
clean it up When loading data, take four steps: 1. Did it load correctly? 2. Are data types what they should be? 3. Numbers: Are there impossible values? 4. Factors: Are factor levels correct?
TRUE if NA is present filter returns only rows that meet the criteria above We are saying: Give me rows with an NA, where it’s NA if it is NOT a number We have discovered two problem rows, ID 62 and 306.
new variable tl (i.e. overwrite the old variable called tl). If tl is 2O8, then assign it a value of 208. If tl is ANYTHING ELSE, assign it a value of tl (i.e. don’t change it) Repeat the process for 215f, changing it to 215 Turn this variable back into a number
error detection missed this, because we were looking for NA’s When “56e8” is converted to a numeric, it doesn’t return NA like other letters (This is why it’s good to retain an unchanged version)
Yes Is 1 year a plausible age for a trout in this study? Need more info 1 year may be plausible – but not for a fish this big. Age 1 is an impossible value here.
Broken.csv) • Clean it up • Four steps: 1. Did it load correctly? 2. Are data types what they should be? 3. Numbers: Are there impossible values? 4. Factors: Are factor levels correct? • See: FISH6002-Week5_Activity.R to get started If you’re stuck: FISH6002- Week5Solution.R (but try yourself first) At end: Compare the dataframe you produce to the CLEAN version (InchLake2-clean.csv) Are differences explainable?