R

A Scientist's Guide to R: Step 3.1 - data visualization with ggplot2+

1 TL;DR 2 Introduction 3 Setup 4 ggplot2 basics 5 aesthetic customization 5.1 titles/labels 5.2 fill 5.3 colour/color 5.4 reordering factors 5.5 colour palettes 5.6 colourblind-friendly palettes 5.7 size 5.8 shape 5.9 linetype 5.10 alpha (transparency/opacity) 5.11 jittering to reduce overplotting 5.12 coordinates 5.12.1 coord_flip() 5.12.2 coord_cartesian() 5.13 guides (legends) 5.14 x & y axis modifications 5.14.1 scale_x_continuous()/scale_y_continuous() 5.14.2 scale_x_discrete()/scale_y_discrete() 5.

A Scientist's Guide to R: Step 3.0 - exploring data with elucidate

1 TL;DR 2 Introduction 3 Installation & Setup 4 Interrogating Data 4.1 checking for row copies() and dupes() 4.2 count()-ing unique values 4.3 describe()-ing missingness & extreme values 5 Descriptives 5.1 describe() a vector with summary statistics 5.2 grouped descriptions 5.3 describe_all() columns in a data frame 5.4 confidence intervals 6 To see, look 6.1 Anscombe’s lesson: numeric descriptions can be misleading 6.2 plot_*-ting data with elucidate 6.

A Scientist's Guide to R: Step 2.5 - dates & times

1 TL;DR 2 Introduction 2.1 load packages 3 date/time basics 4 which day is it? 5 reading dates 6 time zones 7 month names 8 extracting datetime components 9 days in a month 10 custom date formats 11 date calculations 11.1 correcting excel date-to-numeric conversions 12 planning a behavioural neuroscience experiment 12.1 turning the planning script into a function 13 Navigation 14 Notes 1 TL;DR Dates/times are the last type of data you’ll probably work with on a fairly regular basis.

A Scientist's Guide to R: Step 2.4 - forcats for factors

1 TL;DR 2 Introduction 2.1 load packages 2.2 import data 3 Factor basics 4 factors and data visualization 5 factors and modelling 6 Navigation 7 Notes 1 TL;DR Factors are one of the two remaining types of data you’ll encounter on a fairly regular basis. This post will show you how to use the forcats tidyverse package in R so you’ll know how to handle factors when you encounter them.

A Scientist's Guide to R: Step 2.3 - string manipulation and regex

1 TL;DR 2 Introduction 3 Regular expressions 4 Detecting pattern matches with str_detect(), str_which(), str_count(), and str_locate(). 5 Subsetting strings & data frames with str_subset(), str_sub(), str_match(), & str_extract(). 6 Combining and splitting strings using str_c(), str_flatten(), str_split(), & str_glue(). 7 Manage the lengths of strings using str_length(), str_pad(), str_trunc(), & str_trim() 8 Mutating strings with str_sub(), str_replace(), str_replace_all(), str_remove(), & str_remove_all() 9 You can modify the case of a string using str_to_lower(), str_to_upper(), str_to_title(), & str_to_sentence() 10 Example application: Using str_detect() or str_which() to subset with data frames 11 Navigation 12 Notes 1 TL;DR Being able to work with character strings is an essential skill in data analysis and science.

A Scientist's Guide to R: Step 2.2 - Joining Data with dplyr

1 TL;DR 2 Introduction 2.1 setup 3 left_join() 4 right_join() 5 full_join() 6 inner_join() 7 semi_join() 8 anti_join() 9 building data frames using bind_rows() or bind_cols() 9.1 add_row() 10 joining 3 or more data frames 11 merge() 12 Navigation 13 Notes 1 TL;DR Out in the real world you may often find yourself working with data from multiple sources. It will probably be stored in separate files and you’ll need to combine them before you can attempt to answer any of your research questions.

A Scientist's Guide to R: Step 2.1 Data Transformation - part 2

1 TL;DR 2 Introduction 2.1 “long” data, “wide” data, and “tidy” data 3 pivot_longer() 4 pivot_wider() 5 unite() 6 separate() 7 Navigation 8 Notes 1 TL;DR In the 5th post of the Scientist’s Guide to R series we explore using the tidyr package to reshape data. You’ll learn all about splitting and combining columns and how to do wide to long or long to wide transformations.

A Scientist's Guide to R: Step 2.1. Data Transformation - Part 1

1 TL;DR 2 Introduction 3 select() 3.1 Renaming Columns with select() or rename() 4 filter() 4.1 Subset Rows using Indices with slice() 5 mutate() 5.1 Recoding or Creating Indicator Variables using if_else(), case_when(), or recode() 6 summarise() 7 group_by() 8 Chaining Functions with the pipe operator (%>%) 9 Navigation 10 Notes 1 TL;DR The 4th post in the Scientist’s Guide to R series introduces data transformation techniques useful for wrangling/tidying/cleaning data.

A Scientist's Guide to R: Step 2.0. Basic Operations & Data Structures

1 TL;DR 2 Introduction 3 Basic Calculations 4 Logical Operators 5 Object Assignment 6 Basic Summary Statistics 7 Data Structures and Object Assignment 7.1 Numeric and Character Vectors 7.2 Logical Vectors 7.3 Factors 7.4 Matrices 7.5 Dataframes 7.6 Tibbles 8 Random Numbers and Sampling 9 Functions for Describing the Structural Information of Data Objects 10 The Global Environment 11 The Working Directory 12 Projects 13 Useful Keyboard Shortcuts (for R studio users) 13.

A Scientist's Guide to R: Step 1. Getting Data into R

1 TL;DR 2 Introduction 3 Installing and Loading R Packages 4 How to Get Your Data Into R 4.1 Comma Delimited (.csv) Files 4.2 Tab Delimited (.txt) Files 4.3 Files With Other Delimiting Characters (also .txt) 4.4 Microsoft Excel Files (.xlsx, .xls) 4.5 Files from SPSS, SAS, or Stata 4.6 Fixed Width Files (.txt, .gz, .bz2, .xz, .zip, etc.) 4.7 html/xml files 4.8 JavaScript Object Notation (JSON) Files 4.