Introduction to R Studio

Slides:



Advertisements
Similar presentations
Introduction to R Brody Sandel. Topics Approaching your analysis Basic structure of R Basic programming Plotting Spatial data.
Advertisements

Office Links - Sharing Data in Microsoft Office A Mixed Bag of Treasures Chester N. Barkan Registrar Long Island University, C.W.Post Campus.
Data Analysis using SPSS By Dr. Shaik Shaffi Ahamed Ph. D
Computer Basics Hit List of Items to Talk About ● What and when to use left, right, middle, double and triple click? What and when to use left, right,
Stata and logit recap. Topics Introduction to Stata – Files / directories – Stata syntax – Useful commands / functions Logistic regression analysis with.
Command Console Tutorial BCIS 3680 Enterprise Programming.
Baburao Kamble (Ph.D) University of Nebraska-Lincoln Data Analysis Using R Week2: Data Structure, Types and Manipulation in R.
Introduction to SPSS (For SPSS Version 16.0)
Adding Controls to User Forms. Adding Controls A user form isn’t much use without some controls We’re going to add controls and write code for them Note.
Introduction to R Statistical Software Anthony (Tony) R. Olsen USEPA ORD NHEERL Western Ecology Division Corvallis, OR (541)
McGraw-Hill© 2007 The McGraw-Hill Companies, Inc. All rights reserved. 1-1.
05/09/ Introducing Visual Basic Sequence Programming.
Introduction to Excel, Word and Powerpoint Developing Valuable Technology Skills! Shawn Koppenhoefer Training in Research in Reproductive Health/Sexual.
Introduction to SPSS Edward A. Greenberg, PhD
Objectives Understand what MATLAB is and why it is widely used in engineering and science Start the MATLAB program and solve simple problems in the command.
Productivity Programs Common Features and Commands.
Hands-on Introduction to R. We live in oceans of data. Computers are essential to record and help analyse it. Competent scientists speak C/C++, Java,
ISU Basic SAS commands Laboratory No. 1 Computer Techniques for Biological Research Animal Science 500 Ken Stalder, Professor Department of Animal Science.
R packages/libraries Data input/output Rachel Carroll Department of Public Health Sciences, MUSC Computing for Research I, Spring 2014.
A Simple Guide to Using SPSS ( Statistical Package for the Social Sciences) for Windows.
GISMO/GEBndPlan Overview Geographic Information System Mapping Object.
Introduction to JavaScript CS101 Introduction to Computing.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
1.Introduction to SPSS By: MHM. Nafas At HARDY ATI For HNDT Agriculture.
IS2802 Introduction to Multimedia Applications for Business Lecture 8: JavaScript and Cookies Rob Gleasure
Introduction to Matlab Module #10 Page 1 Introduction to Matlab Module #10 – Creating Graphical User Interfaces Topics 1.Overview of GUI Development using.
1 PEER Session 02/04/15. 2  Multiple good data management software options exist – quantitative (e.g., SPSS), qualitative (e.g, atlas.ti), mixed (e.g.,
Lecture 11 Introduction to R and Accessing USGS Data from Web Services Jeffery S. Horsburgh Hydroinformatics Fall 2013 This work was funded by National.
Editing and Debugging Mumps with VistA and the Eclipse IDE Joel L. Ivey, Ph.D. Dept. of Veteran Affairs OI&T, Veterans Health IT Infrastructure & Security.
Introduction to R and Data Science Tools in the Microsoft Stack Jamey Johnston.
Survey Training Pack Session 14 – Transferring CSPro, Access and Excel Files to SPSS.
SPSS For a Beginner CHAR By Adebisi A. Abdullateef
EMPA Statistical Analysis
Multi-Axis Tabular Loads in ANSYS Workbench
Release Numbers MATLAB is updated regularly
Working in the Forms Developer Environment
Performing statistical analyses using the Rshell processor
Downloading and Preparing a StudentVoice File for SPSS
Introduction to R.
Jonathan W. Duggins; James Blum NC State University; UNC Wilmington
Other Kinds of Arrays Chapter 11
Uploading and handling databases
Introduction With TimeCard users can tag SharePoint events with information that converts them into time sheets. This way they can report.
Transition from Classic Interface Phoenix Interface to
Working with Data in Windows
LINDSEY BREWER CSSCR (CENTER FOR SOCIAL SCIENCE COMPUTATION AND RESEARCH) UNIVERSITY OF WASHINGTON September 17, 2009 Introduction to SPSS (Version 16)
ECONOMETRICS ii – spring 2018
Chapter 1: Introduction to SAS
Lab 1 Introductions to R Sean Potter.
Exploring Microsoft® Access® 2016 Series Editor Mary Anne Poatsy
Hands-on Introduction to Visual Basic .NET
CIS16 Application Development Programming with Visual Basic
WEB PROGRAMMING JavaScript.
Use of Mathematics using Technology (Maltlab)
Windows xp PART 1 DR.WAFAA SHRIEF.
NORMA Lab. 5 Duplicating Object Type and Predicate Shapes
PHP.
Plotting Data with MATLAB
Logical Operations In Matlab.
Introduction C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell.
CSCI N207 Data Analysis Using Spreadsheet
Basics of R, Ch Functions Help Managing your Objects
CSCI N207 Data Analysis Using Spreadsheet
This is where R scripts will load
PHP an introduction.
Using R for Data Analysis and Data Visualization
Creating Additional Input Items
Group Boxes, Radio buttons and Checked List Boxes
Unit J: Creating a Database
3.2 Working with Data Scope of variables 29/07/2019.
Presentation transcript:

Introduction to R Studio Basic Features, Rudimentary Data Analysis, & Graphing Options

Organization 1. What is R Studio & Why should you use it? 2.Where to get R Studio 3. Layout of R Studio 4. Installing Packages 5. Loading Packages 6. Bringing Data into R Studio/Exporting Data 7. Data Types in R 8. Helpful Resources

1-A: What is R Studio? An alternative to base R Benefits of R Studio Friendlier user interface Open source, but paid option as well (not worth it for typical users) Same install process Benefits of R Studio Easier transition from Stata to R Multiple window views at once – Results, Code, Working Environment, and Graphs

1-B: What is R Studio? Benefits of R in General Open Source Means free Can make a working object out of anything Lets you save: Results Graphs This is really helpful – can add elements to graphs after you create them! Data frames Vectors Etc…

1-C: What is R Studio? An Important Note Citing R Studio & Packages If using R or R Studio for analyses that will be published, should always cite the version of R and the versions of the packages you have used Results can change across versions, not typical for versions of R, but fairly typical for package versions Is this a reason not to use R/R Studio? No, Stata has the same problems but no one ever acknowledges it See - http://www.ssc.wisc.edu/sscc/pubs/stata_psmatch.htm Past users of psmatch2 were obtaining systematically biased results (it has been fixed now, to the extent of my knowledge).

1-D: Why Should You Use R Studio? Versatility Packages are created and updated frequently Adapts to newer methods faster than Stata or SPSS Double-edged blade with this, though Superior graphing capabilities Yup, I said it…. Seriously – graphs may be stored and have plots added/changed after they have been made Great package for excellent plots – ggplot2 (I’ll be demonstrating plots with this later) Knowledge of Code Transferrable to other programs (kind of) E.g. Matlab, SAS, C++, etc… Have I mentioned that it is free?

2-A: Where to get R or R Studio Options for using R Base R package http://cran.r-project.org/bin/windows/base/ An alternative – R Studio http://www.rstudio.com/ I find it to be much more user-friendly Also, an easier transition from Stata Look and feel of the program is similar Differences As far as I can tell, none for the typical user outside of the different interface Important note Must install base R package before R Studio will work

3-A: Layout of R Studio Four Primary Windows Console Source Equivalent of results window in Stata Source Equivalent of Do file editor in Stata Not open by default Environment Closest equivalent is Properties window in Stata File/Plot/Packages/Etc…Viewer Similar to Properties window in Stata but has much more functionality

3-B: Layout of R Studio Default Setup

3-C: Layout of R Studio With Source Code Window

4-A: Installing Packages into R Studio Works similarly to adding packages into Stata (e.g., psmatch2, gllamm, etc…) Two methods: Point and Click Syntax

4-B: Installing Packages into R Studio Point and Click Method Step 1: Tools  Install Packages Step 2: Enter package name, check dependencies

4-C: Installing Packages into R Studio Point and Click Method Step 3: Install package Step 4: Verify install in Console

4-D: Installing Packages into R Studio Syntax Method Step 1: Write then run code Step 2: Verify install in Console

5-A: Loading Packages in R Studio Unlike Stata, packages other than the base package are not loaded by default They need to be explicitly loaded by the user This can be adjusted through Tools  Global Preferences menu Again, two methods: Point and click Syntax

5-B: Loading Packages in R Studio Point and Click Method Step 1. Packages  Check Box Step 2: Verify load in Console

5-C: Loading Packages in R Studio Syntax Method Step 1: Write then run code Step 2: Verify load in Console

6-A: Bringing Data into R Studio Native R data forms .RData or .rda Can import multiple types of files, just like Stata Text data (.txt, .TXT, etc…) Can be imported using the read.table(…) function Spreadsheet data (.csv, etc…) Must use sep option (e.g., read.table(“file name here”, sep=“,”) )for comma separated files

7-A: Basic Features of R Studio Data Storage Types Numeric Equivalent in Stata is “byte” Meaningful numbers Character Equivalent in Stata is “string” Contains alpha characters Logical True or False Special NA (Not available) Typical missing value indicator  Can have a variety of classes Inf and –Inf Basically, what is returned when the number is too large or small NaN Not a number Null Distinct from NA Not recognized in vectors, has no class Best thought of as “undefined”

7-B: Basic Features of R Studio Types of Data Vectors May be numeric, character, or logical Matrices Combination of vectors Must all be the same storage type (e.g., numeric) and length Arrays 2+ Dimensional versions of matrices Same restrictions apply Data Frames Most important for our purposes Vectors comprising it may have multiple storage types Lists Serve a number of purposes Can be made up of any combination of data storage types Factors May explicitly tell R Studio that a variable is nominal or ordinal (similar to “encode” function in Stata) Integers are mapped to character values, character value are kept as labels

8-A: Helpful Resources Websites Coursera – Johns Hopkins Data Science Series https://www.coursera.org/learn/r-programming R Website (PDF) https://cran.r-project.org/doc/contrib/usingR.pdf Stack Overflow http://stackoverflow.com/ Swirl – Interactive Learning in R (I used this) http://swirlstats.com/

8-B: Helpful Resources (Cheap!) Books R Cookbook http://smile.amazon.com/Cookbook- OReilly-Cookbooks-Paul- Teetor/dp/0596809158/ref=sr_1_1?ie=UT F8&qid=1460556795&sr=8- 1&keywords=r+cookbook R Graphics Cookbook (uses ggplot2) http://smile.amazon.com/R-Graphics- Cookbook-Winston- Chang/dp/1449316956/ref=sr_1_1?ie=U TF8&qid=1460557744&sr=8- 1&keywords=r+graphics+cookbook