Reading a file R can read a wide variety of input formats Text,

Slides:



Advertisements
Similar presentations
Introduction to Web Design Lecture number:. Todays Aim: Introduction to Web-designing and how its done. Modelling websites in HTML.
Advertisements

Database Basics. What is Access? Database management system Computer-based equivalent of a manual database Makes it easy to organize and update information.
DATA ANALYTICS. NORMS Cell Phones on Vibrate Respect all opinions.
Spreadsheet Basics Computer Technology.
EndNote. What is EndNote:  EndNote is referencing software that enables you to create a database of references from your readings. Your database of references.
Tutorial 12: Enhancing Excel with Visual Basic for Applications
A Guide to MySQL 3. 2 Objectives Start MySQL and learn how to use the MySQL Reference Manual Create a database Change (activate) a database Create tables.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
MS-Word XP Lesson 8. Inserting Column to Table 1.Select column (click on top margin) 2.Click on table menu 3.Select insert sub menu and click on columns.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
1Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Microsoft Office Access 2010 by Robert Grauer, Keith Mast, and Mary Anne.
Carolina Environmental Program UNC Chapel Hill The Analysis Engine – A New Tool for Model Evaluation, Sensitivity and Uncertainty Analysis, and more… Alison.
Spreadsheet Introduction and Terminology Fill in the Listening Guide as you view this presentation.
Miscellaneous Excel Combining Excel and Access. – Importing, exporting and linking Parsing and manipulating data. 1.
PHP meets MySQL.
Objects for Business Reporting MIS 497. Objective Learn about miscellaneous objects required for business reporting. Learn about miscellaneous objects.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
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,
WEEK# 2 Haifa Abulaiha August 24,
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.
Microsoft Access 2000 Presentation 1 The Basics of Access.
A Guide to MySQL 3. 2 Introduction  Structured Query Language (SQL): Popular and widely used language for retrieving and manipulating database data Developed.
EndNote. What is EndNote? EndNote is referencing software that enables you to create a database of references from your readings.
Introduction to R Statistics are no substitute for judgment Henry Clay, U.S. congressman and senator.
How long is the quiz available? The quiz will always have a start time but the end time can be unlimited or fixed. If your quiz has an END time, you will.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
MySQL Importing and creating a database. CSV (Comma Separated Values) file CSV = Comma Separated Values – they are simple text files containing data which.
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Aliya Farheen October 29,2015.
DTC Quantitative Methods Summary of some SPSS commands Weeks 1 & 2, January 2012.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Quick Videos: A tutorial on creating reports. Select a report and click this to view it. Select a report and click this to change it. Select a report and.
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,
DAY 2 Haifa Abulaiha January 13,
Database (Microsoft Access). Database A database is an organized collection of related data about a specific topic or purpose. Examples of databases include:
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 3 & 4 By Tasha Chapman, Oregon Health Authority.
3 A Guide to MySQL.
Excel Tutorial 8 Developing an Excel Application
Data Visualization The commonality between science and art is in trying to see profoundly - to develop strategies of seeing and showing Edward Tufte.
DATA MANAGEMENT MODULE: USING SQL in R
MapReduce & R “MapReduce allows us to stop thinking about fault tolerance.” Cathy O’Neil & Rachel Schutt, 2013.
Tutorial 5: Working with Excel Tables, PivotTables, and PivotCharts
Scatterplot #SCATTERPLOT: USEFUL FOR PLOTTING RELATIONSHIPS BETWEEN TWO NUMERIC VARIABLES library(ggvis) library(DBI) require(RMySQL) # set a driver m
Introduction to R Carolina Salge March 29, 2017.
Introduction to Web programming
Introduction to XHTML.
Working with Data in Windows
DATA MANAGEMENT MODULE: USING SQL in R
B2B Portal Training Materials
Excel Spreadsheet Introduction and Terminology.
Chapter 7 Working with Databases and MySQL
Structured Query Language
EndNote by: fatimah alotaibi.
JavaScript Charting Library
Chapter 8 Working with Databases and MySQL
CS1222 Using Relational Databases and SQL
Weka Package Weka package is open source data mining software written in Java. Weka can be applied to your dataset from the GUI, the command line or called.
Introduction to R Statistics are no substitute for judgment
Spreadsheet Basics Computer Technology.
CSE 491/891 Lecture 21 (Pig).
Navya Thum January 23, 2013 Day 3: MICROSOFT EXCEL Navya Thum January 23, 2013.
CSCI N317 Computation for Scientific Applications Unit R
Blackboard Tutorial (Student)
Spreadsheets, Modelling & Databases
Tutorial 6 PHP & MySQL Li Xu
Blackboard Tutorial (Student)
Tutorial 7 – Integrating Access With the Web and With Other Programs
B2B Portal Training Materials
Blackboard Tutorial (Student)
Spreadsheet Basics Computer Technology.
Presentation transcript:

Reading a file R can read a wide variety of input formats Text, Statistical package formats (e.g., SAS) DBMS

Reading a text file Delimited text file, such as CSV Creates a data frame Specify as required Presence of header Separator Row names It will not find this local file on your computer. Mac require(readr) t <- read.csv("~/Dropbox/Carolina/Paper2/Fixed Encoding Data/changeBrasil.txt", stringsAsFactors=FALSE) t <- read.csv("C:\\Dropbox\Carolina\\Paper2\\Fixed Encoding Data\\changeBrasil.txt", stringsAsFactors=FALSE) PC

Reading a text file Can read a file using a URL t <- read.table(url, header=T, sep=',')

Learning about an object Click on the name of the file in the top-right window to see its content url <- "http://people.terry.uga.edu/rwatson/data/centralparktemps.txt" t <- read.table(url, header=T, sep=',') head(t) # first six rows tail(t) # last six rows dim(t) # dimension str(t) # structure of a dataset class(t) #type of object Click on the blue icon of the file in the top-right window to see its structure

Referencing data datasetName$columName Column Data set # Referencing your data # Qualify with tablename to reference fields mean(t$temperature) sd(t$temperature) max(t$year) range(t$month) Column Data set

Creating a new column Formula to transform Fahrenheit to Celsius http://www.manuelsweb.com/temp.htm # Creating a new column t$Ctemp <- round((t$temperature-32)*5/9,1) head(t)

Renaming a column and writing a file # Renaming a column colnames(t)[3] <- 'Ftemp' # rename third column to indicate Fahrenheit head(t) # Save a file write.table(t,"centralparktempsCF.txt") The file is stored in your default location (maybe documents or the folder where you save the script)

sqldf A R package for using SQL with data frames Returns a data frame Supports MySQL

Subset and Sort Selecting rows Selecting columns Selecting rows and columns Sorting on column name library(sqldf) options(sqldf.driver = "SQLite") # to avoid a conflict with RMySQL trowSQL <- sqldf("select * from t where year = 1999") tcol <- t[,c(1:2,4)] tcolSQL <- sqldf("select year, month, Ctemp from t”) trowcolSQL <- sqldf("select year, month, Ctemp from t where year > 1989 and year < 2000") sSQL <- sqldf("select * from t order by year desc, month")

Recoding Some analyses might be facilitated by the recoding of data Split a continuous measure into two categories t$Category <- 'Other’ head(t) t$Category[t$Ftemp >= 30] <- 'Hot’

Deleting information on a column Assign NULL t$Category <- NA

Aggregate data Summarize data using a specified function Compute the mean monthly temperature for each year # Average F temperate for each year a <- aggregate(t$Ftemp, by=list(t$year), FUN=mean) # Name columns colnames(a) = c('year', 'mean') a sqldf("select year, avg(Ftemp) as mean from t group by year")

Exercise Using sqldf Compute the maximum temperature for year 2000

Compile a notebook A notebook is a report of an analysis Interweaves R code and output File > Compile Notebook … Select html, pdf, or Word output Install knitr before use Install suggested packages

HTML

Resources R books Reference card Quick-R DataCamp If you ever use R and get an error, DO NOT PANIC. Google your error and search for answers in StackOverFlow—they are usually very good!

Key points R is a platform for a wide variety of data analytics Statistical analysis Data visualization HDFS and MapReduce Text mining Energy Informatics R is a programming language Much to learn