DATA MANAGEMENT MODULE: Getting Data Into and Out of R

Slides:



Advertisements
Similar presentations
DATABASE BASICS: INSERTING AND FORMATTING DATA EXCEL 07 SESSION II.
Advertisements

Dear Friends, I m Kartik Mali from gujarat. I prepared this presentation for who want to use oracle loader utility. I m giving here step by step knowledge.
Introduction to GTECH 201 Session 13. What is R? Statistics package A GNU project based on the S language Statistical environment Graphics package Programming.
Chapter 7 Data Management. Agenda Database concept Import data Input and edit data Sort data Function Filter data Create range name Calculate subtotal.
2015/6/301 TransCAD Managing Data Tables. 2015/6/302 Create a New Table.
Add a File with X, Y coordinates to MapWindow
Pasewark & Pasewark 1 Access Lesson 6 Integrating Access Microsoft Office 2007: Introductory.
Access Tutorial 8 Sharing, Integrating, and Analyzing Data
1 Access Lesson 6 Integrating Access Microsoft Office 2010 Introductory Pasewark & Pasewark.
Running & Creating Reports.  Log into MyVU and click on the “Employee” tab and then select the Argos Test or Production site, under “Administrative Systems.”
Importing existing reference lists Lorraine Beard & Martin Snelling DRAFT: May 2007.
Creating a Web Site to Gather Data and Conduct Research.
Introduction to to R Emily Kalah Gade University of Washington Credit to Kristin Siebel for development of much of this PowerPoint.
Programming in R Getting data into R. Importing data into R In this session we will learn: Some basic R commands How to enter data directly into R How.
Questionnaire Development: SPSS and Reliability Personality Lab October 8, 2010.
R packages/libraries Data input/output Rachel Carroll Department of Public Health Sciences, MUSC Computing for Research I, Spring 2014.
REDCap Advanced Topics Fred McClurg University of Iowa Institute for Clinical and Translational Science (ICTS) nce/display/ICTSit/REDCap#REDCap.
Introduction to Enterprise Guide Jennifer Schmidt Rhonda Ellis Cassandra Hall.
CREATING A LABEL MAIL MERGE IN WORD. TERMS FIELDS RECORDS MERGE CODES.
MySQL Importing and creating a database. CSV (Comma Separated Values) file CSV = Comma Separated Values – they are simple text files containing data which.
Importing Data to Excel. Suppose you have a delimited* text file and you need to bring it into Excel. Follow these steps… *Delimited means text separated.
More Oracle SQL Scripts. Highlight (but don’t open) authors table, got o External data Excel, and make an external spreadsheet with the data.
Data & Graphing vectors data frames importing data contingency tables barplots 18 September 2014 Sherubtse Training.
Review > x[-c(1,4,6)] > Y[1:3,2:8] > island.data fishData$weight[1] > fishData[fishData$weight < 20 & fishData$condition.
Working with data in R 2 Fish 552: Lecture 3. Recommended Reading An Introduction to R (R Development Core Team) –
Survey Training Pack Session 14 – Transferring CSPro, Access and Excel Files to SPSS.
Introduction to the SPSS Interface
IE 8580 Module 4: DIY Monte Carlo Simulation
DATA MANAGEMENT MODULE: USING SQL in R
Learning How to “Excel”
Infotools Harmoni IHU: Data Sources
By Shivgan Joshi Qcfinance.in
DATA MANAGEMENT MODULE: Subsetting and Formatting
Select Your Meeting Export Your Contacts From Outlook How to create a csv contact file from Outlook to import into Select Your Meeting
DATA MANAGEMENT MODULE: Concatenating, Stacking and Merging
Chapter 2: Getting Data into SAS
Dynamic Input with SQL Queries
CQG XData Walkthrough.
Contract Compliance: Search
Data Management Module: Concatenating, Stacking, Merging and Recoding
Data File Import / Export
Access Lesson 14 Import and Export Data
Uploading and handling databases
Adding and editing students and student test settings
MySQL and MyPHPAdmin.
Working with Data in Windows
DATA MANAGEMENT MODULE: Getting Data Into and Out of R
DATA MANAGEMENT MODULE: USING SQL in R
Lab 1 Introductions to R Sean Potter.
DATA MANAGEMENT MODULE: Managing Variables
Last updated: February 16, 2016
Reading a CSV file in R.
Learning about Taxes with Intuit ProFile
Use of Mathematics using Technology (Maltlab)
DATA MANAGEMENT MODULE: Subsetting and Formatting
DATA MANAGEMENT MODULE: Concatenating, Stacking and Merging
DATA MANAGEMENT MODULE: Managing Variables
Access Tutorial 8 Sharing, Integrating, and Analyzing Data
A poorly named Curt Hill utility program
Click ‘browse’ to search your device for
Learning about Taxes with Intuit ProFile
Data Management Module: Subset, Sort, and Format data
Basics of R, Ch Functions Help Managing your Objects
CSCI N317 Computation for Scientific Applications Unit R
Data Management Module: Creating, Adding and Dropping Variables
Lesson 1 - Automating Tasks
Matrix Addition
Data Manipulation (with SQL)
Tutorial 8 Sharing, Integrating, and Analyzing Data
Introduction to the SPSS Interface
Presentation transcript:

DATA MANAGEMENT MODULE: Getting Data Into and Out of R STAT 4030 – Programming in R DATA MANAGEMENT MODULE: Getting Data Into and Out of R Jennifer Lewis Priestley, Ph.D. Kennesaw State University 1

DATA MANAGEMENT MODULE Importing and Exporting Imputting data directly into R Creating, Adding and Dropping Variables Assigning objects Subsetting and Formatting Working with SAS Files Using SQL in R 2 2 2

Importing and Exporting: Data types Scalar – a single value Vectors – a single column (or row )of data Example – a numeric vector containing test scores of students Matrix – a collection of vectors but must all be of the same data type Data frame – a special matrix that can contain both numeric and character columns.

The easiest way to add data to R is to code it in… Importing and Exporting: Inputting Data in R The easiest way to add data to R is to code it in… names <- c("Bob","Gene","Valerie") age <- c(30, 40, 19) hometown <- c("Dallas, TX", "Little Rock, AR", "Dayton, OH") Note: How are the categorical values in the vector “names” coded? How are the numeric values in the vector “age” coded?

Importing and Exporting: reading data into R c() – creates a column vector (like creating a variable for analysis) read.csv – reads in a CSV file. read.table – more generic function that can read in files with any delimiter, such as tab delimited. read.fwf – reads in fixed record formats. 5

Importing and Exporting: reading data into R In order to import data into R, we need to know how the file was created: Excel SAS SPSS Delimited Fixed field or record 6

Easiest to save Excel as a CSV (comma delimited) file. Importing and Exporting: Excel Easiest to save Excel as a CSV (comma delimited) file. Click File > Save As On the next GUI, select “CSV” from the “save as type” option. Use the read.csv function to get the data into R. 7

Importing and Exporting: CSV 7

Importing and Exporting: CSV Files widge <- read.csv("C:\\Path here\\WidgeOne.csv") head(widge) 8

Importing and Exporting: Exporting data Depending on what kind of file format you want to export back to, there are several options – delimited, fixed field or record or proprietary formats like .sas7bdat or .sav names <- c("Bob","Gene","Valerie") age <- c(30, 40, 19) hometown <- c("Dallas, TX", "Little Rock, AR", "Dayton, OH") customers<- data.frame(names,age,hometown) write.table(customers, “pathhere", sep=",", col.names=NA, row.names = TRUE) 9