Introduction to R and R-Studio Getting Data Into R. 1. Enter Data Directly into R...

Size: px
Start display at page:

Download "Introduction to R and R-Studio Getting Data Into R. 1. Enter Data Directly into R..."

Transcription

1 Introduction to R and R-Studio Getting Data Into R 1. Enter Data Directly into R Import Excel Data (.xlsx ) into R Import Stata Data (.dta ) into R a) From a folder on your computer.... b) From the internet. 4. Import SAS Data (.sas7bdat ) into R.. 5. Describe Your Data Set Structure List Your Data Please note I do a lot of comments! You will see many of my commands that begin with the pound sign (#). They re also in green. While recommended, you don t actually have to type these comments. R handout 02 Fall 2017 Getting Data into R.docx Page 1 of 8

2 1. Enter Data Directly into R R is all about objects. Data in R is, thus, an object Each command is an assignment to an object. objectname <- Type here the stuff that you are assigning to objectname Direct Entry of Data for a Single Variable using the command c(value, value, value, etc) # Enter data on weight for n=4 into column vector called weight <- c(value,value,value,value) weight <- c(161.3,120.1,223.2,124.0) weight [1] Direct Entry of Data for Multiple Variables using c(value, value, etc) and data.frame (column,column, etc) # Enter data on weight for n=4 into column vector called weight # Repeat for age # Repeat for study id weight <- c(161.3,120.1,223.2,124.0) age <- c(54,36,78,62) studyid <- c(1,2,3,4) # Bind columns of data into a single matrix <- data.frame(column,column,colum) labdata1 <- data.frame(studyid,age,weight) labdata1 studyid age weight R handout 02 Fall 2017 Getting Data into R.docx Page 2 of 8

3 2. Import Excel Data (.xlsx ) into R Importing Excel Data into R Requires 2 or 3 Steps First. (This is a one time step) Install the package openxlsx Second. Attach (load) the package to your R Environment Third. Import Excel data 1. How to Install the Package openxlsx install.packages( openxlsx ) Example - Here is a screen capture of my installation of openxlsx R handout 02 Fall 2017 Getting Data into R.docx Page 3 of 8

4 2. Attach (Load) the package openxlsx to your R Environment library(openxlsx) 3. Import Excel Data using function read.xlsx( ) # Import Excel data (R_lab1.xlsx) into R object (excel_import) <- read.xlsx( full path/r_lab1.xlsx ) excel_import <- read.xlsx( /Users/cbigelow/Desktop/R_lab1.xlsx ) excel_import id dob gender weight male female male female Alternatively, under the Packages tab, select Install and type openxlsx in the dialogue box. Click Install to complete this step. R handout 02 Fall 2017 Getting Data into R.docx Page 4 of 8

5 3. Import Stata Data (.dta ) into R No surprises here. The steps are similar to those for importing Excel data into R. Importing Stata Data into R Requires 2 or 3 Steps First. (Again, this is a one time step) Install the package foreign Second. Attach (load) the package to your R Environment Third. Import Stata data 1. How to Install the Package foreign install.packages( foreign ) OR install the package using the Packages tab. 2. Attach (Load) the package foreign to your R Environment library(foreign) 3a. Import Stata Data From a Folder on Your Computer using function read.dta( ) # Import Stata data (larvae.dta) into R object (larvae_data) <- read.dta( full path/larvae.dta ) larvae_data <- read.dta( /Users/cbigelow/Desktop/larvae.dta ) larvae_data id y x1 x some rows skipped b. Import Stata Data From the Internet using function read.dta( ) # Import Stata data (week02.dta) into R object (week02_data) # url <- full url url <- week02_data <- read.dta(file=url) R handout 02 Fall 2017 Getting Data into R.docx Page 5 of 8

6 4. Import SAS Data (.sas7bdat ) into R Importing SAS Data into R Requires 3 Steps First. (Again, this is a one time step) Install the package haven Second. Attach (load) the package to your R Environment Third. Import SAS data 1. How to Install the Package haven install.packages( haven ) OR install the package using the Packages tab. 2. Attach (Load) the package haven to your R Environment library(haven) 3. Import SAS Data using function read_sas( ) # Import SAS data (example.sas7bdat) into R object (example) <- read_sas( full path/larvae.dta ) example <- read_sas( /Users/cbigelow/Desktop/sasexample.sas7bdat ) example id dob gender weight male female male female R handout 02 Fall 2017 Getting Data into R.docx Page 6 of 8

7 5. Describe Your Data Set Structure # Observations, # Variables Display variable names R Command colnames(larvae_data) Display number of rows (observations) nrow( ) nrow(larvae_data) [1] 15 Display number of columns (variables) ncol( ) Display dimensions of data set frame (rows x columns) (# observations x # variables) ncol(larvae_data) [1] 4 dim( ) dim(larvae_data) [1] 15 4 Detailed Structure of Data command str(dataframe) # str(dataframe) str(larvae_data) 'data.frame': 15 obs. of 4 variables: $ id: num $ y : num $ x1: num $ x2: num attr(*, "datalabel")= chr "PubHlth 640 Unit 2 Regression - Larvae data" - attr(*, "time.stamp")= chr "10 Feb :36" - attr(*, "formats")= chr "%9.0g" "%9.0g" "%9.0g" "%9.0g" - attr(*, "types")= int attr(*, "val.labels")= chr "" "" "" "" - attr(*, "var.labels")= chr "larva id" "log10(survival)" "log10(dose)" "log10(weight)" - attr(*, "expansion.fields")=list of 2..$ : chr "_dta" "note1" "\"Week 3 homework assignment exercises 2 and 3\""..$ : chr "_dta" "note0" "1" - attr(*, "version")= int 12 R handout 02 Fall 2017 Getting Data into R.docx Page 7 of 8

8 6. List Your Data Use Subscripts to Select a Subset of Your Data Just like spreadsheets in Excel or Stata data sets, rows are observations and variables are columns To select a subset of your data requires using subscripts, which can be thought of as addresses. Subscripts appear in square brackets and are of the form: dataframe[1 st subscript is for rows, 2 nd subscript is for columns] = [observation selection, variable selection] List First 6 observations using head( ) List Last 6 observations using tail( ) List Entire Data Set (be careful!): Two ways: 1) Just type its name; or 2) View(dataframe). List Selected Observations: For observations 8, 9, 10, list the data for all variables List Selected Variables: For all observations, List the observations for only the 2 nd variable List Selected Variables on Selected Observations: For observations 8, 9, 10 only, List the observations for only the 2 nd variable R Command head(larvae_data) tail(larvae_data) larvae_data View(larvae_data) larvae_data[8:10,] id y x1 x larvae_data[,2] [1] larvae_data[8:10,2] [1] R handout 02 Fall 2017 Getting Data into R.docx Page 8 of 8

Introduction to R. Dataset Basics. March 2018

Introduction to R. Dataset Basics. March 2018 Introduction to R March 2018 1. Preliminaries.... a) Suggested packages for importing/exporting data.... b) FAQ: How to find the path of your dataset (or whatever). 2. Import/Export Data........ a) R (.Rdata)

More information

BIOSTAT640 R Lab1 for Spring 2016

BIOSTAT640 R Lab1 for Spring 2016 BIOSTAT640 R Lab1 for Spring 2016 Minming Li & Steele H. Valenzuela Feb.1, 2016 This is the first R lab session of course BIOSTAT640 at UMass during the Spring 2016 semester. I, Minming (Matt) Li, am going

More information

Entering and Outputting Data 2 nd best TA ever: Steele H. Valenzuela February 2-6, 2015

Entering and Outputting Data 2 nd best TA ever: Steele H. Valenzuela February 2-6, 2015 Entering and Outputting Data 2 nd best TA ever: Steele H. Valenzuela February 2-6, 2015 Contents Things to Know Before You Begin.................................... 1 Entering and Outputting Data......................................

More information

BIOSTATS 640 Spring 2018 Introduction to R Data Description. 1. Start of Session. a. Preliminaries... b. Install Packages c. Attach Packages...

BIOSTATS 640 Spring 2018 Introduction to R Data Description. 1. Start of Session. a. Preliminaries... b. Install Packages c. Attach Packages... BIOSTATS 640 Spring 2018 Introduction to R and R-Studio Data Description Page 1. Start of Session. a. Preliminaries... b. Install Packages c. Attach Packages... 2. Load R Data.. a. Load R data frames...

More information

Introduction to Stata Getting Data into Stata. 1. Enter Data: Create a New Data Set in Stata...

Introduction to Stata Getting Data into Stata. 1. Enter Data: Create a New Data Set in Stata... Introduction to Stata 2016-17 02. Getting Data into Stata 1. Enter Data: Create a New Data Set in Stata.... 2. Enter Data: How to Import an Excel Data Set.... 3. Import a Stata Data Set Directly from the

More information

Data Input/Output. Andrew Jaffe. January 4, 2016

Data Input/Output. Andrew Jaffe. January 4, 2016 Data Input/Output Andrew Jaffe January 4, 2016 Before we get Started: Working Directories R looks for files on your computer relative to the working directory It s always safer to set the working directory

More information

Importing data sets in R

Importing data sets in R Importing data sets in R R can import and export different types of data sets including csv files text files excel files access database STATA data SPSS data shape files audio files image files and many

More information

Session 1 Nick Hathaway;

Session 1 Nick Hathaway; Session 1 Nick Hathaway; nicholas.hathaway@umassmed.edu Contents R Basics 1 Variables/objects.............................................. 1 Functions..................................................

More information

Data Input/Output. Introduction to R for Public Health Researchers

Data Input/Output. Introduction to R for Public Health Researchers Data Input/Output Introduction to R for Public Health Researchers Common new user mistakes we have seen 1. Working directory problems: trying to read files that R "can't find" RStudio can help, and so

More information

Introduction to R and R-Studio Toy Program #2 Excel to R & Basic Descriptives

Introduction to R and R-Studio Toy Program #2 Excel to R & Basic Descriptives Introduction to R and R-Studio 2018-19 Toy Program #2 Basic Descriptives Summary The goal of this toy program is to give you a boiler for working with your own excel data. So, I m hoping you ll try!. In

More information

1. Creating a data set using the data editor 2. Importing an Excel data file

1. Creating a data set using the data editor 2. Importing an Excel data file Introduction This illustration describes two ways to enter data into Stata 1. Creating a data set using the data editor 2. Importing an Excel data file Example -. This data set has n=4 observations on

More information

1 Building a simple data package for R. 2 Data files. 2.1 bmd data

1 Building a simple data package for R. 2 Data files. 2.1 bmd data 1 Building a simple data package for R Suppose that we wish to make a package containing data sets only available in-house or on CRAN. This is often done for the data sets in the examples and exercises

More information

Introduction to StatKey Getting Data Into StatKey

Introduction to StatKey Getting Data Into StatKey Introduction to StatKey 2016-17 03. Getting Data Into StatKey Introduction This handout assumes that you do not want to type in the data by hand. This handout shows you how to use Excel and cut and paste

More information

Reading and wri+ng data

Reading and wri+ng data An introduc+on to Reading and wri+ng data Noémie Becker & Benedikt Holtmann Winter Semester 16/17 Course outline Day 4 Course outline Review Data types and structures Reading data How should data look

More information

TYPES OF VARIABLES, STRUCTURE OF DATASETS, AND BASIC STATA LAYOUT

TYPES OF VARIABLES, STRUCTURE OF DATASETS, AND BASIC STATA LAYOUT PRIMER FOR ACS OUTCOMES RESEARCH COURSE: TYPES OF VARIABLES, STRUCTURE OF DATASETS, AND BASIC STATA LAYOUT STEP 1: Install STATA statistical software. STEP 2: Read through this primer and complete the

More information

Stata versions 12 & 13 Week 4 - Practice Problems

Stata versions 12 & 13 Week 4 - Practice Problems Stata versions 12 & 13 Week 4 - Practice Problems DUE: Monday February 24, 2014 Last submission date for credit: Monday March 3, 2014 1 Practice Screen Capture a Create a word document Name it using the

More information

Introduction to Stata First Session. I- Launching and Exiting Stata Launching Stata Exiting Stata..

Introduction to Stata First Session. I- Launching and Exiting Stata Launching Stata Exiting Stata.. Introduction to Stata 2016-17 01. First Session I- Launching and Exiting Stata... 1. Launching Stata... 2. Exiting Stata.. II - Toolbar, Menu bar and Windows.. 1. Toolbar Key.. 2. Menu bar Key..... 3.

More information

Basic matrix math in R

Basic matrix math in R 1 Basic matrix math in R This chapter reviews the basic matrix math operations that you will need to understand the course material and how to do these operations in R. 1.1 Creating matrices in R Create

More information

Data Input/Output. Introduction to R for Public Health Researchers

Data Input/Output. Introduction to R for Public Health Researchers Data Input/Output Introduction to R for Public Health Researchers Common new user mistakes we have seen 1. Working directory problems: trying to read files that R can t find RStudio can help, and so do

More information

For many people, learning any new computer software can be an anxietyproducing

For many people, learning any new computer software can be an anxietyproducing 1 Getting to Know Stata 12 For many people, learning any new computer software can be an anxietyproducing task. When that computer program involves statistics, the stress level generally increases exponentially.

More information

Package labelled. December 19, 2017

Package labelled. December 19, 2017 Package labelled December 19, 2017 Type Package Title Manipulating Labelled Data Version 1.0.1 Date 2017-12-19 Maintainer Joseph Larmarange Work with labelled data imported from

More information

Loading Data into R. Loading Data Sets

Loading Data into R. Loading Data Sets Loading Data into R Loading Data Sets Rather than manually entering data using c() or something else, we ll want to load data in stored in a data file. For this class, these will usually be one of three

More information

An Introduction to R- Programming

An Introduction to R- Programming An Introduction to R- Programming Hadeel Alkofide, Msc, PhD NOT a biostatistician or R expert just simply an R user Some slides were adapted from lectures by Angie Mae Rodday MSc, PhD at Tufts University

More information

Package rio. R topics documented: January 14, Type Package Title A Swiss-Army Knife for Data I/O Version 0.3.

Package rio. R topics documented: January 14, Type Package Title A Swiss-Army Knife for Data I/O Version 0.3. Type Package Title A Swiss-Army Knife for Data I/O Version 0.3.0 Date 2016-01-14 Package rio January 14, 2016 Maintainer Thomas J. Leeper Description Streamlined data import and

More information

Introduction to R. Adrienn Szabó. DMS Group, MTA SZTAKI. Aug 30, /62

Introduction to R. Adrienn Szabó. DMS Group, MTA SZTAKI. Aug 30, /62 Introduction to R Adrienn Szabó DMS Group, MTA SZTAKI Aug 30, 2014 1/62 1 What is R? What is R for? Who is R for? 2 Basics Data Structures Control Structures 3 ExtRa stuff R packages Unit testing in R

More information

Intermediate Programming in R Session 1: Data. Olivia Lau, PhD

Intermediate Programming in R Session 1: Data. Olivia Lau, PhD Intermediate Programming in R Session 1: Data Olivia Lau, PhD Outline About Me About You Course Overview and Logistics R Data Types R Data Structures Importing Data Recoding Data 2 About Me Using and programming

More information

Introduction to R: Data Types

Introduction to R: Data Types Introduction to R: Data Types https://ivanek.github.io/introductiontor/ Florian Geier (florian.geier@unibas.ch) September 26, 2018 Recapitulation Possible workspaces Install R & RStudio on your laptop

More information

Econ Stata Tutorial I: Reading, Organizing and Describing Data. Sanjaya DeSilva

Econ Stata Tutorial I: Reading, Organizing and Describing Data. Sanjaya DeSilva Econ 329 - Stata Tutorial I: Reading, Organizing and Describing Data Sanjaya DeSilva September 8, 2008 1 Basics When you open Stata, you will see four windows. 1. The Results window list all the commands

More information

/23/2004 TA : Jiyoon Kim. Recitation Note 1

/23/2004 TA : Jiyoon Kim. Recitation Note 1 Recitation Note 1 This is intended to walk you through using STATA in an Athena environment. The computer room of political science dept. has STATA on PC machines. But, knowing how to use it on Athena

More information

Select a report and click this to view it. Select a report and click this to change it.

Select a report and click this to view it. Select a report and click this to change it. Quick Videos: A tutorial on creating reports. Shows reports you have created.s Not used by the county Reports pre-made by the county Reports pre-made by 4-H Online Shows reports and folders you have deleted.

More information

Stata version 12. Lab Session 1 February Preliminary: How to Screen Capture.. 2. Preliminary: How to Keep a Log of Your Stata Session..

Stata version 12. Lab Session 1 February Preliminary: How to Screen Capture.. 2. Preliminary: How to Keep a Log of Your Stata Session.. Stata version 12 Lab Session 1 February 2013 1. Preliminary: How to Screen Capture.. 2. Preliminary: How to Keep a Log of Your Stata Session.. 3. Preliminary: How to Save a Stata Graph... 4. Enter Data:

More information

SAS Training Spring 2006

SAS Training Spring 2006 SAS Training Spring 2006 Coxe/Maner/Aiken Introduction to SAS: This is what SAS looks like when you first open it: There is a Log window on top; this will let you know what SAS is doing and if SAS encountered

More information

Stata versions 12 & 13 Week 4 Practice Problems

Stata versions 12 & 13 Week 4 Practice Problems Stata versions 12 & 13 Week 4 Practice Problems SOLUTIONS 1 Practice Screen Capture a Create a word document Name it using the convention lastname_lab1docx (eg bigelow_lab1docx) b Using your browser, go

More information

Outline. What are SAS (1966), Stata (1985), and SPSS (1968)? Migrating to R for SAS/SPSS/Stata Users

Outline. What are SAS (1966), Stata (1985), and SPSS (1968)? Migrating to R for SAS/SPSS/Stata Users UCLA Department of Statistics Statistical Consulting Center Outline Vivian Lew vlew@stat.ucla.edu October 4, 2009 Statistical packages allow you to read raw data and transform it into a proprietary file

More information

STAT 113: R/RStudio Intro

STAT 113: R/RStudio Intro STAT 113: R/RStudio Intro Colin Reimer Dawson Last Revised September 1, 2017 1 Starting R/RStudio There are two ways you can run the software we will be using for labs, R and RStudio. Option 1 is to log

More information

Making sense of census microdata

Making sense of census microdata Making sense of census microdata Tutorial 3: Creating aggregated variables and visualisations First, open a new script in R studio and save it in your working directory, so you will be able to access this

More information

Table of Contents. Navigate the Management Menu. 911 Management Page

Table of Contents. Navigate the Management Menu. 911 Management Page ucontrol Managing 911 Information Important note regarding 911 service: VoIP 911 service has certain limitations relative to Enhanced 911 service that is available on most traditional telephone service.

More information

Using Microsoft Access

Using Microsoft Access Using Microsoft Access USING MICROSOFT ACCESS 1 Forms & Reports 2 Forms 2 Using Auto Forms 2 Exercise 1. Creating a Datasheet Auto Form 3 Exercise 2. Creating a Tabular Auto Form 4 Exercise 3. Creating

More information

QPM Lab 1: Installing R and R Studio

QPM Lab 1: Installing R and R Studio QPM Lab 1: Installing R and R Studio Department of Political Science Washington University, St. Louis September 1-2, 2016 QPM Lab 1: Installing R and R Studio 1 Introductions About me Your turn: Name Year

More information

Intro to Stata for Political Scientists

Intro to Stata for Political Scientists Intro to Stata for Political Scientists Andrew S. Rosenberg Junior PRISM Fellow Department of Political Science Workshop Description This is an Introduction to Stata I will assume little/no prior knowledge

More information

Data types and structures

Data types and structures An introduc+on to Data types and structures Noémie Becker & Benedikt Holtmann Winter Semester 16/17 Course outline Day 3 Review GeFng started with R Crea+ng Objects Data types in R Data structures in R

More information

Biology 345: Biometry Fall 2005 SONOMA STATE UNIVERSITY Lab Exercise 2 Working with data in Excel and exporting to JMP Introduction

Biology 345: Biometry Fall 2005 SONOMA STATE UNIVERSITY Lab Exercise 2 Working with data in Excel and exporting to JMP Introduction Biology 345: Biometry Fall 2005 SONOMA STATE UNIVERSITY Lab Exercise 2 Working with data in Excel and exporting to JMP Introduction In this exercise, we will learn how to reorganize and reformat a data

More information

Package readstata13. R topics documented: May 5, Type Package Title Import 'Stata' Data Files Version 0.9.0

Package readstata13. R topics documented: May 5, Type Package Title Import 'Stata' Data Files Version 0.9.0 Type Package Title Import 'Stata' Data Files Version 0.9.0 Package readstata13 May 5, 2017 Function to read and write the 'Stata' file format. URL https://github.com/sjewo/readstata13 BugReports https://github.com/sjewo/readstata13/issues

More information

Package haven. April 9, 2015

Package haven. April 9, 2015 Version 0.2.0 Title Import SPSS, Stata and SAS Files Package haven April 9, 2015 Import foreign statistical formats into R via the embedded ReadStat C library (https://github.com/wizardmac/readstat). Package

More information

TIPS FROM THE TRENCHES

TIPS FROM THE TRENCHES TIPS FROM THE TRENCHES Christopher Bost MDRC SAS Users Group October 1, 2008 Recent user questions 2 How can I print long character values? How can I EXPORT formatted values to Excel? How can I check for

More information

Getting and Cleaning Data. Biostatistics

Getting and Cleaning Data. Biostatistics Getting and Cleaning Data Biostatistics 140.776 Getting and Cleaning Data Getting data: APIs and web scraping Cleaning data: Tidy data Transforming data: Regular expressions Getting Data Web site Nature

More information

No Name What it does? 1 attach Attach your data frame to your working environment. 2 boxplot Creates a boxplot.

No Name What it does? 1 attach Attach your data frame to your working environment. 2 boxplot Creates a boxplot. No Name What it does? 1 attach Attach your data frame to your working environment. 2 boxplot Creates a boxplot. 3 confint A metafor package function that gives you the confidence intervals of effect sizes.

More information

I Launching and Exiting Stata. Stata will ask you if you would like to check for updates. Update now or later, your choice.

I Launching and Exiting Stata. Stata will ask you if you would like to check for updates. Update now or later, your choice. I Launching and Exiting Stata 1. Launching Stata Stata can be launched in either of two ways: 1) in the stata program, click on the stata application; or 2) double click on the short cut that you have

More information

Logical operators: R provides an extensive list of logical operators. These include

Logical operators: R provides an extensive list of logical operators. These include meat.r: Explanation of code Goals of code: Analyzing a subset of data Creating data frames with specified X values Calculating confidence and prediction intervals Lists and matrices Only printing a few

More information

Math 263 Excel Assignment 3

Math 263 Excel Assignment 3 ath 263 Excel Assignment 3 Sections 001 and 003 Purpose In this assignment you will use the same data as in Excel Assignment 2. You will perform an exploratory data analysis using R. You shall reproduce

More information

You will learn: The structure of the Stata interface How to open files in Stata How to modify variable and value labels How to manipulate variables

You will learn: The structure of the Stata interface How to open files in Stata How to modify variable and value labels How to manipulate variables Jennie Murack You will learn: The structure of the Stata interface How to open files in Stata How to modify variable and value labels How to manipulate variables How to conduct basic descriptive statistics

More information

LECTURE NOTES FOR ECO231 COMPUTER APPLICATIONS I. Part Two. Introduction to R Programming. RStudio. November Written by. N.

LECTURE NOTES FOR ECO231 COMPUTER APPLICATIONS I. Part Two. Introduction to R Programming. RStudio. November Written by. N. LECTURE NOTES FOR ECO231 COMPUTER APPLICATIONS I Part Two Introduction to R Programming RStudio November 2016 Written by N.Nilgün Çokça Introduction to R Programming 5 Installing R & RStudio 5 The R Studio

More information

Lecture 1: Getting Started and Data Basics

Lecture 1: Getting Started and Data Basics Lecture 1: Getting Started and Data Basics The first lecture is intended to provide you the basics for running R. Outline: 1. An Introductory R Session 2. R as a Calculator 3. Import, export and manipulate

More information

Where s the spreadsheet?

Where s the spreadsheet? Reading in Data Where s the spreadsheet? Statistical packages normally have a spreadsheet R has a minimal-but-usable spreadsheet More emphasis on data generated/curated externally Very powerful data import

More information

Introduction to Stata Toy Program #1 Basic Descriptives

Introduction to Stata Toy Program #1 Basic Descriptives Introduction to Stata 2018-19 Toy Program #1 Basic Descriptives Summary The goal of this toy program is to get you in and out of a Stata session and, along the way, produce some descriptive statistics.

More information

WiredContact Enterprise Import Instructions

WiredContact Enterprise Import Instructions WiredContact Enterprise Import Instructions You can perform an import from many different file types:, this document deals with TXT and Microsoft Excel. File Format CSV TXT Excel Import Type Text Data

More information

STENO Introductory R-Workshop: Loading a Data Set Tommi Suvitaival, Steno Diabetes Center June 11, 2015

STENO Introductory R-Workshop: Loading a Data Set Tommi Suvitaival, Steno Diabetes Center June 11, 2015 STENO Introductory R-Workshop: Loading a Data Set Tommi Suvitaival, tsvv@steno.dk, Steno Diabetes Center June 11, 2015 Contents 1 Introduction 1 2 Recap: Variables 2 3 Data Containers 2 3.1 Vectors................................................

More information

Brief cheat sheet of major functions covered here. shoe<-c(8,7,8.5,6,10.5,11,7,6,12,10)

Brief cheat sheet of major functions covered here. shoe<-c(8,7,8.5,6,10.5,11,7,6,12,10) 1 Class 2. Handling data in R Creating, editing, reading, & exporting data frames; sorting, subsetting, combining Goals: (1) Creating matrices and dataframes: cbind and as.data.frame (2) Editing data:

More information

Integrate Word and the Web Vocabulary

Integrate Word and the Web Vocabulary Handout D404-02 Integrate Word and the Web Vocabulary Browser Browsing Bulletin board system Domain Domain extension (also known as top-level domain) Domain extension types Domain name system (DNS) Download

More information

Link Crew & WEB Database User Guide. Database 2011

Link Crew & WEB Database User Guide. Database 2011 i Link Crew & WEB Database User Guide Database 2011 1 ii 1 Contents 1 CONTENTS...II 2 THE LINK CREW AND WEB DATABASE... 3 3 DOWNLOADING THE DATABASE... 4 Step 1: Login to the Boomerang Project Website...4

More information

1. To answer this question, we will create 3 vectors named first, second, and third.

1. To answer this question, we will create 3 vectors named first, second, and third. 1. To answer this question, we will create 3 vectors named first, second, and third. (a) Create the vectors first, second, and third. Each vector should be made up of the following elements: first=(6,10,9,10,8,4,9,1,3,6),

More information

Creating a data file and entering data

Creating a data file and entering data 4 Creating a data file and entering data There are a number of stages in the process of setting up a data file and analysing the data. The flow chart shown on the next page outlines the main steps that

More information

Reading data into R. 1. Data in human readable form, which can be inspected with a text editor.

Reading data into R. 1. Data in human readable form, which can be inspected with a text editor. Reading data into R There is a famous, but apocryphal, story about Mrs Beeton, the 19th century cook and writer, which says that she began her recipe for rabbit stew with the instruction First catch your

More information

Research Support. Processing Results in Stata

Research Support. Processing Results in Stata Most Stata functions (such as reg) display their results in the Stata results window. Sometimes this is not quite sufficient: we might want to either preserve some of the output and use it in future computations,

More information

Stat 302 Statistical Software and Its Applications Data Import and Export

Stat 302 Statistical Software and Its Applications Data Import and Export 1 Stat 302 Statistical Software and Its Applications Data Import and Export Fritz Scholz Department of Statistics, University of Washington Winter Quarter 2015 January 26, 2015 2 General Remarks on I/O

More information

How to extract suicide statistics by country from the. WHO Mortality Database Online Tool

How to extract suicide statistics by country from the. WHO Mortality Database Online Tool Instructions for users How to extract suicide statistics by country from the WHO Mortality Database Online Tool This guide explains how to access suicide statistics and make graphs and tables, or export

More information

1. Basic Steps for Data Analysis Data Editor. 2.4.To create a new SPSS file

1. Basic Steps for Data Analysis Data Editor. 2.4.To create a new SPSS file 1 SPSS Guide 2009 Content 1. Basic Steps for Data Analysis. 3 2. Data Editor. 2.4.To create a new SPSS file 3 4 3. Data Analysis/ Frequencies. 5 4. Recoding the variable into classes.. 5 5. Data Analysis/

More information

HOTLINE 4.0. Hotline v Page 1 of 11

HOTLINE 4.0. Hotline v Page 1 of 11 HOTLINE 4.0 Hotline v.20120722 Page 1 of 11 The Hotline module is available in PetPoint Professional and PetPoint Enterprise. It is designed to keep record of behavior hotlines, post-adoption follow up

More information

COMM 391 Winter 2014 Term 1. Tutorial 2: Microsoft Excel Using VLookUp and Creating PivotChart

COMM 391 Winter 2014 Term 1. Tutorial 2: Microsoft Excel Using VLookUp and Creating PivotChart COMM 391 Winter 2014 Term 1 Tutorial 2: Microsoft Excel Using VLookUp and Creating PivotChart The purpose of this tutorial is to enable you to learn how to use the VLookUp function and create a PivotChart

More information

Lab 1 (fall, 2017) Introduction to R and R Studio

Lab 1 (fall, 2017) Introduction to R and R Studio Lab 1 (fall, 201) Introduction to R and R Studio Introduction: Today we will use R, as presented in the R Studio environment (or front end), in an introductory setting. We will make some calculations,

More information

Graphing on Excel. Open Excel (2013). The first screen you will see looks like this (it varies slightly, depending on the version):

Graphing on Excel. Open Excel (2013). The first screen you will see looks like this (it varies slightly, depending on the version): Graphing on Excel Open Excel (2013). The first screen you will see looks like this (it varies slightly, depending on the version): The first step is to organize your data in columns. Suppose you obtain

More information

An Introduction to Using R

An Introduction to Using R An Introduction to Using R Dino Christenson & Scott Powell Ohio StateUniversity November 20, 2007 Introduction to R Outline I. What is R? II. Why use R? III. Where to get R? IV. GUI & scripts V. Objects

More information

https://biostatisticien.eu/springer/courserw3.pdf

https://biostatisticien.eu/springer/courserw3.pdf P. Lafaye de Micheaux 1 1 Mathematics and Statistics Departement Université de Montréal CANADA New South Wales University Sydney, Australia May 27, 2014 https://biostatisticien.eu/springer/courserw3.pdf

More information

11/07 11/08/ /5/2012 Software Technology, Inc. Thomas Murphy

11/07 11/08/ /5/2012 Software Technology, Inc. Thomas Murphy 0 Alabama INFOCUS Webinar 11/07 11/08/2012 11/5/2012 Software Technology, Inc. Thomas Murphy 0 Alabama INFOCUS Webinar OBJECTIVES: Tabular Report Introduce customers to the basics of building reports with

More information

Computer lab 2 Course: Introduction to R for Biologists

Computer lab 2 Course: Introduction to R for Biologists Computer lab 2 Course: Introduction to R for Biologists April 23, 2012 1 Scripting As you have seen, you often want to run a sequence of commands several times, perhaps with small changes. An efficient

More information

Text Mining with R: Building a Text Classifier

Text Mining with R: Building a Text Classifier Martin Schweinberger July 28, 2016 This post 1 will exemplify how to create a text classifier with R, i.e. it will implement a machine-learning algorithm, which classifies texts as being either a speech

More information

Stata version 14 Also works for versions 13 & 12. Lab Session 1 February Preliminary: How to Screen Capture..

Stata version 14 Also works for versions 13 & 12. Lab Session 1 February Preliminary: How to Screen Capture.. Stata version 14 Also works for versions 13 & 12 Lab Session 1 February 2016 1. Preliminary: How to Screen Capture.. 2. Preliminary: How to Keep a Log of Your Stata Session.. 3. Preliminary: How to Save

More information

Bivariate (Simple) Regression Analysis

Bivariate (Simple) Regression Analysis Revised July 2018 Bivariate (Simple) Regression Analysis This set of notes shows how to use Stata to estimate a simple (two-variable) regression equation. It assumes that you have set Stata up on your

More information

Introduction to Stata - Session 2

Introduction to Stata - Session 2 Introduction to Stata - Session 2 Siv-Elisabeth Skjelbred ECON 3150/4150, UiO January 26, 2016 1 / 29 Before we start Download auto.dta, auto.csv from course home page and save to your stata course folder.

More information

Excel Quick Reference Guide

Excel Quick Reference Guide Excel Quick Reference Guide CONTENTS Screen elements 3 Mouse shapes and actions 3 Cursor movement keys 4 Select a range using the keyboard 4 Edit cell contents 5 Select a range using the mouse 5 Sorting

More information

A Short Guide to R with RStudio

A Short Guide to R with RStudio Short Guides to Microeconometrics Fall 2013 Prof. Dr. Kurt Schmidheiny Universität Basel A Short Guide to R with RStudio 2 1 Introduction A Short Guide to R with RStudio 1 Introduction 3 2 Installing R

More information

Data Science Essentials

Data Science Essentials Data Science Essentials Lab 6 Introduction to Machine Learning Overview In this lab, you will use Azure Machine Learning to train, evaluate, and publish a classification model, a regression model, and

More information

Introduction to R and R-Studio Toy Program #1 R Essentials. This illustration Assumes that You Have Installed R and R-Studio

Introduction to R and R-Studio Toy Program #1 R Essentials. This illustration Assumes that You Have Installed R and R-Studio Introduction to R and R-Studio 2018-19 Toy Program #1 R Essentials This illustration Assumes that You Have Installed R and R-Studio If you have not already installed R and RStudio, please see: Windows

More information

Install RStudio from - use the standard installation.

Install RStudio from   - use the standard installation. Session 1: Reading in Data Before you begin: Install RStudio from http://www.rstudio.com/ide/download/ - use the standard installation. Go to the course website; http://faculty.washington.edu/kenrice/rintro/

More information

POL 345: Quantitative Analysis and Politics

POL 345: Quantitative Analysis and Politics POL 345: Quantitative Analysis and Politics Precept Handout 1 Week 2 (Verzani Chapter 1: Sections 1.2.4 1.4.31) Remember to complete the entire handout and submit the precept questions to the Blackboard

More information

Lab #10 Multi-dimensional Arrays

Lab #10 Multi-dimensional Arrays Multi-dimensional Arrays Sheet s Owner Student ID Name Signature Group partner 1. Two-Dimensional Arrays Arrays that we have seen and used so far are one dimensional arrays, where each element is indexed

More information

LING 104 Keating/Yang Week 2 Section

LING 104 Keating/Yang Week 2 Section Set-up: Agenda: 1. Calculating means and SDs 2. Graphing 3. T-tests 1. Make sure you have some data to work with. Your options are: a. The duration data from Assignment 1. Use this if you have already

More information

k-nn classification with R QMMA

k-nn classification with R QMMA k-nn classification with R QMMA Emanuele Taufer file:///c:/users/emanuele.taufer/google%20drive/2%20corsi/5%20qmma%20-%20mim/0%20labs/l1-knn-eng.html#(1) 1/16 HW (Height and weight) of adults Statistics

More information

Sample A2J Guided Interview & HotDocs Template Exercise

Sample A2J Guided Interview & HotDocs Template Exercise Sample A2J Guided Interview & HotDocs Template Exercise HotDocs Template We are going to create this template in HotDocs. You can find the Word document to start with here. Figure 1: Form to automate Converting

More information

Mélanie Weynants and Brigitta Tóth November 20, 2014

Mélanie Weynants and Brigitta Tóth November 20, 2014 The euptf package Mélanie Weynants and Brigitta Tóth mweynants@gmail.com November 20, 2014 The euptf package provides pedotransfer functions (PTFs) for the prediction of hydraulic properties in European

More information

Stata: A Brief Introduction Biostatistics

Stata: A Brief Introduction Biostatistics Stata: A Brief Introduction Biostatistics 140.621 2005-2006 1. Statistical Packages There are many statistical packages (Stata, SPSS, SAS, Splus, etc.) Statistical packages can be used for Analysis Data

More information

STAT 213 HW0a. R/RStudio Intro / Basic Descriptive Stats. Last Revised February 5, 2018

STAT 213 HW0a. R/RStudio Intro / Basic Descriptive Stats. Last Revised February 5, 2018 STAT 213 HW0a R/RStudio Intro / Basic Descriptive Stats Last Revised February 5, 2018 1 Starting R/RStudio There are two ways you can run the software we will be using for labs, R and RStudio. Option 1

More information

SISG/SISMID Module 3

SISG/SISMID Module 3 SISG/SISMID Module 3 Introduction to R Ken Rice Tim Thornton University of Washington Seattle, July 2018 Introduction: Course Aims This is a first course in R. We aim to cover; Reading in, summarizing

More information

Homework 1 Excel Basics

Homework 1 Excel Basics Homework 1 Excel Basics Excel is a software program that is used to organize information, perform calculations, and create visual displays of the information. When you start up Excel, you will see the

More information

MATH36032 Problem Solving by Computer. More Data Structure

MATH36032 Problem Solving by Computer. More Data Structure MATH36032 Problem Solving by Computer More Data Structure Data from real life/applications How do the data look like? In what format? Data from real life/applications How do the data look like? In what

More information

UPGRADE AND CONVERT INSTRUCTION Not available on the ipad. This step must be done on your computer and then transfer your files to ipad.

UPGRADE AND CONVERT INSTRUCTION Not available on the ipad. This step must be done on your computer and then transfer your files to ipad. UNIFORM MANAGEMENT ASSIGNMENT CENTER II Welcome to Uniform Management Assignment Center. UMAC II is compatible with Windows, Mac OSX, and ipad. Follow the step-by-step instructions to assign your students

More information

IMPORTING DATA IN R. Introduction read.csv

IMPORTING DATA IN R. Introduction read.csv IMPORTING DATA IN R Introduction read.csv Importing data in R? 5 types Flat files Data from Excel Databases Web Statistical software Flat Files states.csv Comma Separated Values state,capital,pop_mill,area_sqm

More information

A Brief Introduction to R

A Brief Introduction to R A Brief Introduction to R Babak Shahbaba Department of Statistics, University of California, Irvine, USA Chapter 1 Introduction to R 1.1 Installing R To install R, follow these steps: 1. Go to http://www.r-project.org/.

More information

Elements of a programming language 3

Elements of a programming language 3 Elements of a programming language 3 Marcin Kierczak 21 September 2016 Contents of the lecture variables and their types operators vectors numbers as vectors strings as vectors matrices lists data frames

More information

MBV4410/9410 Fall Bioinformatics for Molecular Biology. Introduction to R

MBV4410/9410 Fall Bioinformatics for Molecular Biology. Introduction to R MBV4410/9410 Fall 2018 Bioinformatics for Molecular Biology Introduction to R Outline Introduce R Basic operations RStudio Bioconductor? Goal of the lecture Introduce you to R Show how to run R, basic

More information