ST610-002 Intro to R programming Big picture language features -- just a brief description here -- more later:

Slides:



Advertisements
Similar presentations
Introduction to Programming
Advertisements

Chapter 8 Technicalities: Functions, etc. Bjarne Stroustrup
Introduction to R Brody Sandel. Topics Approaching your analysis Basic structure of R Basic programming Plotting Spatial data.
CPSC 388 – Compiler Design and Construction
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Q and A for Sections 1 – CS 106 © 2014 Victor Norman.
Programming TBE 540 Farah Fisher. Objectives After viewing this presentation, the learner will be able to… Given a task, create pseudocode Given pseudocode,
CHAPTER 1: AN OVERVIEW OF COMPUTERS AND LOGIC. Objectives 2  Understand computer components and operations  Describe the steps involved in the programming.
CS 106 Introduction to Computer Science I 02 / 12 / 2007 Instructor: Michael Eckmann.
A Java Syntax Primer Yong Choi School of Business CSU, Bakersfield.
Repetition Statements repeat block of code until a condition is satisfied also called loops Java supports 3 kinds of loops: while statement – repeats a.
Environments and Evaluation
Introduction to a Programming Environment
Adapted from Dr. Craig Chase, The University of Texas at Austin.
Greater than or equal? A lesson on math language A lesson on math language.
Python. What is Python? A programming language we can use to communicate with the computer and solve problems We give the computer instructions that it.
Introduction to Ruby CSE 413 Autumn 2008 Credit: Dan Grossman, CSE341.
Science Vocabulary Bingo. Descriptive research Research based on observations.
Introduction to programming in MATLAB MATLAB can be thought of as an super-powerful graphing calculator Remember the TI-83 from calculus? With many more.
Variables in Java Part 2. ICS-3M1 - Mr. Martens - Variables Part 2 Recall the “int” Data Types When you divide one integer by another – you always get.
Object Oriented Software Development
GRAPHICAL ANALYSIS OF MOTION
ITEC 352 Lecture 11 ISA - CPU. ISA (2) Review Questions? HW 2 due on Friday ISA –Machine language –Buses –Memory.
Algorithms Describing what you know. Contents What are they and were do we find them? Why show the algorithm? What formalisms are used for presenting.
The Data Element. 2 Data type: A description of the set of values and the basic set of operations that can be applied to values of the type. Strong typing:
Introduction to Python
Programming Fundamentals. Today’s lecture Decisions If else …… Switch Conditional Operators Logical Operators.
CMPS 211 JavaScript Topic 1 JavaScript Syntax. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction.
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Practice and Evaluation. Practice Develop a java class called: SumCalculator.java which computes a sum of all integer from 1 to 100 and displays the result.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 15: More-Advanced Concepts.
5 BASIC CONCEPTS OF ANY PROGRAMMING LANGUAGE Let’s get started …
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
Interpretation Environments and Evaluation. CS 354 Spring Translation Stages Lexical analysis (scanning) Parsing –Recognizing –Building parse tree.
COP 4620 / 5625 Programming Language Translation / Compiler Writing Fall 2003 Lecture 3, 09/11/2003 Prof. Roy Levow.
Lecture 1 Introduction Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
CPS120: Introduction to Computer Science Decision Making in Programs.
C++ crash course Class 8 statements, sort, flight times program.
Current Assignments Homework 2 is available and is due in three days (June 19th). Project 1 due in 6 days (June 23 rd ) Write a binomial root solver using.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
COMP 171: Data Types John Barr. Review - What is Computer Science? Problem Solving  Recognizing Patterns  If you can find a pattern in the way you solve.
ALBERT WAVERING BOBBY SENG. Week 4: JavaScript  Quiz  Announcements/questions.
Objects & Dynamic Dispatch CSE 413 Autumn Plan We’ve learned a great deal about functional and object-oriented programming Now,  Look at semantics.
Review, Pseudocode, Flow Charting, and Storyboarding.
MA/CS 375 Fall 2002 Lecture 3. Example 2 A is a matrix with 3 rows and 2 columns.
1 CS161 Introduction to Computer Science Topic #9.
The Functions and Purposes of Translators Syntax (& Semantic) Analysis.
8-1 Compilers Compiler A program that translates a high-level language program into machine code High-level languages provide a richer set of instructions.
CPS120 Introduction to Computer Science Iteration (Looping)
Unit 9 – “A BIG State Machine”. Introduction New Topics Nested Case Structures Reusable Code.
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.
Thinking about programming Intro to Computer Science CS1510 Dr. Sarah Diesburg.
BIT 115: Introduction To Programming Professor: Dr. Baba Kofi Weusijana (say Doc-tor Way-oo-see-jah-nah, Doc-tor, or Bah-bah)
Arrays and Loops. Learning Objectives By the end of this lecture, you should be able to: – Understand what a loop is – Appreciate the need for loops and.
Today’s Agenda ML Development Workflow –Emacs –Using use –The REPL More ML –Shadowing Variables –Debugging Tips –Boolean Operations –Comparison Operations.
CSCE Introduction to Program Design and Concepts J. Michael Moore Spring 2015 Set 6: Miscellaneous 1 Based on slides created by Bjarne Stroustrup.
Q and A for Sections 1 – CS 106 © 2015 Victor Norman.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 6: Stepwise refinement revisited, Midterm review.
Designing classes How to write classes in a way that they are easily understandable, maintainable and reusable 6.0.
Algorithms and Flowcharts
Thinking about programming
Thinking about programming
Assignment 3 Solution Background
Introduction to System Programming
What to do today: Brief history of Ruby General qualities/info
First Python Program Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
A programming language
6.001 SICP Variations on a Scheme
How to allow the program to know when to stop a loop.
[Robert W. Sebesta, “Programming the World Wide Web
Presentation transcript:

ST Intro to R programming Big picture language features -- just a brief description here -- more later:

Interpretive R translates symbols (e.g. x, 2.53, *, qr) into numbers, variables, and other expressions which are evaluated immediately (almost)

Object-oriented "everything is an object" Well, that really doesn't say anything. But as I see it, if a function takes a certain kind of object -- as long as R can recognize it or force into something it can recognize, then a function will work -- and produce another object, for another function or expression to work with. Variables, constants, and functions are all objects.

Coercion R will instinctively try to make sense of any expression that you give it, even if to you it is nonsense. So this can be very dangerous, as R will proceed many times when you would prefer that it would stop processing for syntax errors.

Recycling When R is trying to coerce something to work, and it needs more numbers, it will instinctively reuse the numbers that it has. For example, if you try to add a constant to a vector, R will really take the constant and make a vector of the same length as the other with it, by repeating the single number that it has. While very powerful, this can also be dangerous.

Lexical Scoping The real power of R is in its functions, and R creates a new working environment with each instance of a function. Variables are referenced (scoping) according its nested environment structure.

Natural and unnatural looping R is designed to do vector/matrix calculations and works best when calculations are coded to that end. R does have a loop feature (for loop) which can be competitive in speed to its natural looping, but more often is slow and inefficient.

Some Details gui vs batch and directory reference source("infile.name") sink("outfile.name") and sink() to discontinue.RData and.Rhistory help(command) q() to stop # begins a comment that continues to the end of the record