Basic Data Input. To get started, you can give students binary data already in the R format. – save() one or more R objects to a file (with.rda extension)

Slides:



Advertisements
Similar presentations
A gentle introduction to R – how to load in data and produce summary statistics BRC MH Bioinformatics group.
Advertisements

Michael Alves, Patrick Dugan, Robert Daniels, Carlos Vicuna
Chapter 3. Expressions and Interactivity CSC125 Introduction to C++
FILE TRANSFER PROTOCOL Short for File Transfer Protocol, the protocol for exchanging files over the Internet. FTP works in the same way as HTTP for transferring.
1 HTML Markup language – coded text is converted into formatted text by a web browser. Big chart on pg. 16—39. Tags usually come in pairs like – data Some.
EGR 106 – Truss Design Project (cont.) Truss design programs Graphical interface tools in Matlab Saving and loading data Formatted output Project Assignment.
8 November Forms and JavaScript. Types of Inputs Radio Buttons (select one of a list) Checkbox (select as many as wanted) Text inputs (user types text)
Data types and variables
Data Representation Kieran Mathieson. Outline Digital constraints Data types Integer Real Character Boolean Memory address.
MIS316 – BUSINESS APPLICATION DEVELOPMENT – Chapter 14 – Files and Streams 1Microsoft Visual C# 2012, Fifth Edition.
Sen Wang 11/17/2011.  RFC  “Form-based File Upload in HTML” NOV 1995 
Arithmetic for Computers
Networking Nasrullah. Input stream Most clients will use input streams that read data from the file system (FileInputStream), the network (getInputStream()/getInputStream()),
MATLAB File Management. MATLAB User File Management Matlab provides a group of commands to manage user files. For more information, type help iofun. pwd.
Stream Handling Streams - means flow of data to and from program variables. - We declare the variables in our C++ for holding data temporarily in the memory.
CIS 451: HTML Frames Adapted from materials developed by Dr. Soe (updated January, 2009)
Introduction to Python
JavaScript, Fourth Edition
Input & Output: Console
Chapter 3 Elements of Assembly Language. 3.1 Assembly Language Statements.
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.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
1 Functions 1 Parameter, 1 Return-Value 1. The problem 2. Recall the layout 3. Create the definition 4. "Flow" of data 5. Testing 6. Projects 1 and 2.
CS1 Lesson 2 Introduction to C++ CS1 Lesson 2 -- John Cole1.
Chapter 8 Cookies And Security JavaScript, Third Edition.
Program A computer program (also software, or just a program) is a sequence of instructions written in a sequence to perform a specified task with a computer.
10-Sep Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Sept Representing Information in Computers:  numbers: counting numbers,
File Structures Foundations of Computer Science  Cengage Learning.
Chapter 18 – Miscellaneous Topics. Multiple File Programs u Makes possible to accommodate many programmers working on same project u More efficient to.
SE-1020 Dr. Mark L. Hornick 1 File Input and Output.
Website Development with PHP and MySQL Saving Data.
Data files and databases. Need a control to browse to a file Standard controls for drive folder and list not much use The CommonDialogs control offers.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
1 Week 12 l Overview of Streams and File I/O l Text File I/O Streams and File I/O.
 Pearson Education, Inc. All rights reserved Introduction to Java Applications.
Input and Output. Announcements  Exam Next Wednesday –Next Monday: Review session.  Invited talk: –7:30 PM,Tuesday, Oct 28th. –Prof. Katherine Socha.
File Input and Output July 2nd, Inputs and Outputs Inputs Keyboard Mouse storage(hard drive) Networks O utputs Graphs Images Videos(image stacks)
XP Tutorial 8 Adding Interactivity with ActionScript.
Chapter 14: Files and Streams. 2Microsoft Visual C# 2012, Fifth Edition Files and the File and Directory Classes Temporary storage – Usually called computer.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
CSCI 3133 Programming with C Instructor: Bindra Shrestha University of Houston – Clear Lake.
Files Tutor: You will need ….
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
C++ Programming Lecture 3 C++ Basics – Part I The Hashemite University Computer Engineering Department (Adapted from the textbook slides)
1 Lecture 4 Post-Graduate Students Advanced Programming (Introduction to MATLAB) Code: ENG 505 Dr. Basheer M. Nasef Computers & Systems Dept.
LIS654 lecture 4 more on omeka Thomas Krichel
XP New Perspectives on Macromedia Dreamweaver MX 2004 Tutorial 5 1 Adding Shared Site Elements.
09/06/ Data Representation ASCII, Binary Denary Conversion, Integer & Boolean data types.
Everything is a number Everything in a computer memory and on storages is a number. Number  Number Characters  Number by ASCII code Sounds  Number.
Input and Output in Java
TMF1414 Introduction to Programming
Other Kinds of Arrays Chapter 11
Net 323 D: Networks Protocols
CHAPTER 5 JAVA FILE INPUT/OUTPUT
Programming Language Concepts (CIS 635)
Uploading and handling databases
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Advanced Data Import & Export Jeff Henrikson
2.1 Parts of a C++ Program.
WEB PROGRAMMING JavaScript.
Student: Ying Hong Course: Database Security Instructor: Dr. Yang
Format String.
Fundamentals of Data Structures
Net 323 D: Networks Protocols
funCTIONs and Data Import/Export
Fundamentals of Python: First Programs
Chapter 2: Introduction to C++.
1: multiple representations
General Computer Science for Engineers CISC 106 Lecture 03
KySat Packet format legend
Presentation transcript:

Basic Data Input

To get started, you can give students binary data already in the R format. – save() one or more R objects to a file (with.rda extension) – Put it on a Web site. Students use load() to read the data into an R session directly – load(url(“ Note the use or url() – it is an example of a “connection”, a stream of bytes that come from “somewhere”, in this case a URL, but could be a file, another program outputting data, a character string.

Reading ASCII data Have to know how to read standard rectangular data – tab separated, comma-separated, etc. R has functions for this, i.e. – read. table(), read.csv(), etc. – read.fwf() for fixed width format. For efficiency reasons, very beneficial to use colClasses parameter to specify target type. But there are lots of issues.

Strings or factors Common “gotcha” For better or worse, by default, R turns strings in rectangular data read from an ASCII file into factor objects. Use stringsAsFactors = FALSE

Problems in reading Quote characters Missing values Character Encoding Comment characters

Interactive code read.table("~/problemData2", quote = "", comment.char = "", fill = TRUE)

Accessing files - Paths Students need to know about working directories (getwd() & setwd()) This is where the R session is “rooted” – all relative file names are relative to this directory. Students need to recognize that their code will not work if they move files, change directories, etc. – i.e. their code is not runnable and so we cannot help fix things. Using URLs makes things universally locatable.

Binary data R can read binary data. But one has to read the bytes and interpret them based on the actual known format of the data, e.g. – read 2 integers – then followed by n real numbers where n is the value of the second of the first two integers read, … Students should not necessarily deal with this, but be aware of the existence of different binary formats & why they are used (compact representation)

Non-standard data input 3 problems: – Sample observations from a huge ASCII file w/o reading the whole file – Multiple data frames in a single CSV file. – ragged data # timestamp= :31:58 # usec=250 # minReadings=110 t= ;id=00:02:2D:21:0F:33;pos=0.0,0.0,0.0;degree=0.0;00:14:bf: b1:97:8a=-38, ,3;00:14:bf:b1:97:90=- 56, ,3;00:0f:a3:39:e1:c0=-53, ,3;00:14:bf:b1:97:8d=- 65, ,3;