Introduction Session 1. R as a Giant Calculator Demo: Set 1.

Slides:



Advertisements
Similar presentations
When you read a passage or an article,the first thing you should do is to feel the language … There are two tasks for you to accomplish when you experience.
Advertisements

Introduction to R Brody Sandel. Topics Approaching your analysis Basic structure of R Basic programming Plotting Spatial data.
Methods Java 5.1 A quick overview of methods
15. Python - Modules A module allows you to logically organize your Python code. Grouping related code into a module makes the code easier to understand.
M2 – Explain the tools and techniques used in the creation of an interactive website. By Arturas Vitkovskij.
1 CS101 Introduction to Computing Lecture 17 Algorithms II.
 Introduction to Programming History of programming.
Algorithms and Problem Solving-1 Algorithms and Problem Solving.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Visual Programming Via The Squeak Car Demo Dan Grossman University of Washington CS4HS July 11-13, 2008.
LBSC 690 Session #10 Programming, JavaScript Jimmy Lin The iSchool University of Maryland Wednesday, November 5, 2008 This work is licensed under a Creative.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
Computer Science - I Course Introduction Computer Science Department Boston College Hao Jiang.
CS 61C L02 Number Representation (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C.
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
Computer Science - I Course Introduction Computer Science Department Boston College Hao Jiang.
PRE-PROGRAMMING PHASE
Course: Introduction to Computers
Every week: Sign in at the door If you are new: Fill in Registration Form Ask a Mentor how to get started Make sure you are on the Athenry Parents/Kids.
FUNDAMENTALS OF PRACTICAL COMPUTING Ken ChurchFUNDAMENTALS OF PRACTICAL COMPUTING Ken Church Intended audience: – Students considering a major.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
PHP: Hypertext Processor Fred Durao
An Introduction to Scilab Tsing Nam Kiu 丁南僑 Department of Mathematics The University of Hong Kong 2009 January 7.
Python Mini-Course University of Oklahoma Department of Psychology Day 1 – Lesson 2 Fundamentals of Programming Languages 4/5/09 Python Mini-Course: Day.
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #005 (April somthin, 2015)
Introduction Session 4. Generate the first N Fibonacci #s 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144,... The nth Fibonacci number is the sum of the.
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
Mobile search engine for a smart phone / navigation system can be used to search and compare hundreds of stores and their products in seconds. © 2001 –
Introduction to Python
COP1220/CGS2423 Introduction to C++/ C for Engineers Professor: Dr. Miguel Alonso Jr. Fall 2008.
Data, graphics, and programming in R 28.1, 30.1, Daily:10:00-12:45 & 13:45-16:30 EXCEPT WED 4 th 9:00-11:45 & 12:45-15:30 Teacher: Anna Kuparinen.
PHP TUTORIAL. HISTORY OF PHP  PHP as it's known today is actually the successor to a product named PHP/FI.  Created in 1994 by Rasmus Lerdorf, the very.
ICAPRG301A Week 4Buggy Programming ICAPRG301A Apply introductory programming techniques Program Bugs US Navy Admiral Grace Hopper is often credited with.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Introduction to Arrays. definitions and things to consider… This presentation is designed to give a simple demonstration of array and object visualizations.
Nonvisual Arrays and Recursion by Chris Brown under Prof. Susan Rodger Duke University June 2012.
CS 114 – Class 02 Topics  Computer programs  Using the compiler Assignments  Read pages for Thursday.  We will go to the lab on Thursday.
Introduction Algorithms and Conventions The design and analysis of algorithms is the core subject matter of Computer Science. Given a problem, we want.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
 Muscle Shoals Center for Technology Mrs. Stonecipher.
English Logic and Writing
You can learn how to quickly and knowledgably search with the following information. By: Kataryna Cookman.
Programming. Definition Computer programming is the process of designing, writing, testing, debugging, and maintaining the source code of computer programs.
Chapter 1 Introduction Chapter 1 Introduction 1 st Semester 2015 CSC 1101 Computer Programming-1.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
Department of Electrical and Computer Engineering Introduction to C++: Primitive Data Types, Libraries and Operations By Hector M Lugo-Cordero August 27,
Introduction to R Introductions What is R? RStudio Layout Summary Statistics Your First R Graph 17 September 2014 Sherubtse Training.
COSC 2007 Data Structures II Chapter 13 Advanced Implementation of Tables IV.
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.
Computer Software Operating Systems – Programs. Computer Language - Review We learnt that computers are made up of millions of tiny switches that can.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
11 Computers, C#, XNA, and You Session 1.1. Session Overview  Find out what computers are all about ...and what makes a great programmer  Discover.
INVITATION TO Computer Science 1 11 Chapter 2 The Algorithmic Foundations of Computer Science.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
Getting Started With Python Brendan Routledge
Control Structures: Conditionals, If/Else and Loops David Millard
Standards Certification Education & Training Publishing Conferences & Exhibits Easy Web Design ISA Toronto – Jan 2013.
The Need for Algorithms
Algorithms and Problem Solving
G. Pullaiah College of Engineering and Technology
Creativity in Algorithms
Lesson 2: Building Blocks of Programming
Coding Concepts (Basics)
Algorithms and Problem Solving
Fundamentals of Functional Programming
For loops Taken from notes by Dr. Neil Moore
Presentation transcript:

Introduction Session 1

R as a Giant Calculator

Demo: Set 1

Now try it yourself log(), exp(), log10(), sqrt(), factorial(), choose(), floor(), ceiling(), trunc(), round(), signif(), cos(), sin(), tan(), acos(), asin(), atan(), acosh(), asinh(), atanh() Use help() to figure out what these functions do, and play with them

What is Programming Exactly

According to Wikipedia, Computer programming (often shortened to programming, scripting, or coding) is the process of designing, writing, testing, debugging, and maintaining the source code of computer programs. This source code is written in one or more programming languages (such as Java, C++, C#, Python, etc.). The purpose of programming is to create a set of instructions that computers use to perform specific operations or to exhibit desired behaviors. The process of writing source code often requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms and formal logic. Within software engineering, programming (the implementation) is regarded as one phase in a software development process.

According to Wikipedia, Computer programming (often shortened to programming, scripting, or coding) is the process of designing, writing, testing, debugging, and maintaining the source code of computer programs. This source code is written in one or more programming languages (such as Java, C++, C#, Python, etc.). The purpose of programming is to create a set of instructions that computers use to perform specific operations or to exhibit desired behaviors. The process of writing source code often requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms and formal logic. Within software engineering, programming (the implementation) is regarded as one phase in a software development process.

But we’re not software engineers Computer programming (often shortened to programming, scripting, or coding) is the process of designing, writing, testing, debugging, and maintaining the source code of computer programs. This source code is written in one or more programming languages (such as Java, C++, C#, Python, etc.). The purpose of programming is to create a set of instructions that computers use to perform specific operations or to exhibit desired behaviors. The process of writing source code often requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms and formal logic. Within software engineering, programming (the implementation) is regarded as one phase in a software development process.

In other words, A program is plan of action, or a story And programming is the creative process of making the plan or writing the story

Elements of a story vs. Elements of a Program

Hypothetical Program/Passage You don’t need to be able to understand all of the following. Just read it for now and think about it.

Christmas Shopping A hypothetical program Alice needs to buy Christmas Presents for each of her cousins so She’s planning out her day So her plan, which she calls OperationXMas() should take in input a list of her 8 cousins And output a list of wrapped presents Bob Carl Dee

Christmas Shopping Human language (what Alice is thinking in her mind): My cousins are Bob, Carl, & Dee Start out with no items bought For each person, pick out a perfect present Checking out all items in my shopping cart Bring home what I bought Programming Language (if Alice wanted to hire a robot to do her bidding): Cousins = c(Bob, Carl, Dee) cart = c() for(each in Cousins){ cart = c(cart, PickPresent(each)) } cart = CheckOut(cart) return(cart)

R R is programming language designed for statistical computing, graphics, and data analysis It’s open source, meaning that the source code is also is freely accessible. So the benefit is that it’s free, and easily updated with new methods and techniques

What We’ll Be Doing

Demo 1: Introduction This will be a gentle ease in It won’t be extremely fun, but I believe that once you stick this out, the rest will be a lot more understandable and interesting

Demo 2: Data and Graphics Google Flu Trends Data Sources:

Demo 3: Working With Packages and a Bit of Math Radiohead Data Source:

Demo 3: String Processing, Web Scraping, and Large Datasets State of the Union Addresses Data Source:

Demo 4: Mark Up Languages Flu Activity Using XML

Demo 4: Mark Up Languages Or Alternatively: Make a Website Using HTML

Other Demos (to be planned…) Unix and Remote Computing May use Amazon Cloud for this Demo, but I know a few of you also have Biowulf accounts, so that would be easier Python Tutorial This will also be a bit dry, but the exciting part is that you should now be able to learn a new language very quickly Introductory Sequence Processing If you’re interested in genomics, this will be fun, and even if you’re not, I think this can also be fun. Search Algorithms This is more theoretical, but it still is useful. I’ve had to whip this out of my toolkit a couple times this year. I think it’s really fun, though you can tell me if you think I’m lying. And we can demo this through searching mazes. Suggestions?

Variables, Primitive Data Types, Data Structures, and Functions

Names, same as in life, for example, Alice, Bob, Carol, Fluffy They “store” data In this illustration, the variables are the name cups, not the actual people themselves. Variables Aliceappledog

Primitive Data Types Primitive data types serve as the fundamental building blocks for more complicated types of data. As a real-world analogy, I relate data to nouns, and primitive data to anything organic, occurring naturally like apples, dogs, people

Primitive Data Types in R R has three main primitive data types – Numeric (numbers, ex: 0, 5, 144, 25.7, Inf) – Character (words or passages, ex: “hello world”, “apple”, “My fellow citizens, I stand here today humbled by the task before us”) – Logical (TRUE/FALSE) There is one exception, missing data is represented as NA and has certain properties of its own

Logical Data Also called “boolean” data In R, it is represented as TRUE/FALSE But it can also be represented as 1/0

OR Alice is trying to pick out a gift for Bob Bob wants either something red OR a pen Will he be happy with A red pen? A red candle? A blue pen? A blue candle?

OR GiftIs it red?Is it a pen?Happy? red penTRUETRUETRUE red candleTRUEFALSETRUE blue penFALSETRUETRUE blue candleFALSEFALSEFALSE

AND Alice is trying to pick out a gift for Bob Bob wants either something red AND a pen Will he be happy with A red pen? A red candle? A blue pen? A blue candle?

AND GiftIs it red?Is it a pen?Happy? red penTRUETRUETRUE red candleTRUEFALSEFALSE blue penFALSETRUEFALSE blue candleFALSEFALSEFALSE

Demo: Next time

Christmas Shopping A hypothetical program Alice needs to buy Christmas Presents for each of her cousins so She’s planning out her day So her plan, which she calls OperationXMas() should take in input a list of her 8 cousins And output a list of wrapped presents Bob Carl Dee

Christmas Shopping Human language (what Alice is thinking in her mind): My cousins are Bob, Carl, & Dee Start out with no items bought For each person, pick out a perfect present Checking out all items in my shopping cart Bring home what I bought Programming Language (if Alice wanted to hire a robot to do her bidding): Cousins = c(Bob, Carl, Dee) cart = c() for(each in Cousins){ cart = c(cart, PickPresent(each)) } cart = CheckOut(cart) return(cart)

Generate the first N Fibonacci #s 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144,... The nth Fibonacci number is the sum of the previous two numbers. In other words, F n =F n-1 +F n-2 F 0 =0, F 1 =1

Generate the first N Fibonacci #s 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144,... The nth Fibonacci number is the sum of the previous two numbers. In other words, F n =F n-1 +F n-2 F 0 =0, F 1 =1

Generate the first N Fibonacci #s Human language: Generating a list of the first n Fibonacci numbers involves knowing what the value of “n” is. Creating an empty vector called myFibs with n spots Fill spot 1 with 0 and spot 2 with 1 For each spot number, starting with 3, and ending with n, fill that spot with the sum of what’s in the previous two spots Output the list of numbers Programming Language: fibonacci = function(n){ myFibs = rep(0,n) myFibs[1] = 0 myFibs[2] = 1 for(spot in 3:n){ myFibs[spot] = myFibs[spot-1] + myFibs[spot-2] } return(myFibs) }