Lab 9: practice with functions Some tips to make your functions a little more interesting.

Slides:



Advertisements
Similar presentations
Writing functions in R Some handy advice for creating your own functions.
Advertisements

CTEC2902 Advanced Programming in Visual Studio (ASP. NET + C#
How I work Write code Notepad (or similar), and copy and paste to R Read data always to object dat.
Getting Started With STATA How do I do this? It probably opened automatically, but you may have to save it to the desktop, and double-click it to open.
Finding Red Pixels – Part 2 Prof. Noah Snavely CS1114
Lab3 (Signal & System) Instructor: Anan Osothsilp Date: 13 Feb 07.
Week 6 labs. Compute A B or log A B For B an integer, A B can be computed very similarly to N! except instead of building the product 1*2*3*…*N, we build.
Long Multiplication What is long multiplication?
CS 211 RECURSION TREES. Trees versus Linked Lists A tree is like a linked list, except instead of a single next node, it can have multiple next nodes.
MATLAB Programming Session
Unit 1 – Improving Productivity. 1.1Why did you use a computer? What other systems / resources could you have used? I could have used a pen and paper.
Chapter 5. Loops are common in most programming languages Plus side: Are very fast (in other languages) & easy to understand Negative side: Require a.
J. ElderPSYC 6256 Principles of Neural Coding ASSIGNMENT 2: REVERSE CORRELATION.
Science Student Led Conferences By Sophie D.. On a scale of 1-5 (5 being the best) rate yourself on your ability to complete all of the assignments for.
1 Tips for solving Project 1 Reactor SO 3 SO 2 +O 2.
Review of Matrices Or A Fast Introduction.
Pseudo Code Possibly one of the hardest skills to get to grips with in learning a programming language is developing the ability to take a problem and.
Session 3: More features of R and the Central Limit Theorem Class web site: Statistics for Microarray Data Analysis.
Data Analysis Lab 04 Regression and Multiple Regression.
Questions as we get started?. Getting Loopy Unplugged Activity (Course 2, Lesson 5) I need a volunteer to come up and follow my directions. I need a second.
Mindset  A fixed mental attitude that predetermines a person’s responses to situations.
Parallel Computing with Matlab CBI Lab Parallel Computing Toolbox TM An Introduction Oct. 27, 2011 By: CBI Development Team.
Matlab Basics Tutorial. Vectors Let's start off by creating something simple, like a vector. Enter each element of the vector (separated by a space) between.
Homework: optimal control without a reference trajectory A disadvantage of the formulation that we developed in class is that it requires a reference trajectory.
3 x x x x x 23. Grid Method Grid Method Gelosian Method Gelosian Method Partitioning method Partitioning method “Long” multiplication.
L – Modelling and Simulating Social Systems with MATLAB Lesson 2 – Statistics and plotting Anders Johansson and Wenjian Yu © ETH.
Synthesis ENGR 1181 MATLAB 11. Topics  No new material  Covers topics that will be on the Midterm 2 Exam MATLAB 01 – Program Design MATLAB 02 – Introduction.
Introduction to Programming in R Department of Statistical Sciences and Operations Research Computation Seminar Series Speaker: Edward Boone
Learning R hands on. Organization of Folders: Class Data folder has datasets (end in.csv or.rda) Rcode has the scripts of R commands that can cut and.
Chapter 6 Review: User Defined Functions Introduction to MATLAB 7 Engineering 161.
Finding Red Pixels – Part 1 Prof. Noah Snavely CS1114
WHAT IS THE VALUE OF X? x = 0 for value in [3, 41, 12, 9, 74, 15] : if value < 10 : x = x + value print x.
LAB 01: DATA WRANGLING WITH PYTHON September 21, 2015 SDS 235 Visual Analytics.
Multiplication with Arrays and Boxes – A Visual Model.
By:Hollie Riley MAKE 2013 PROJECT.  The reason I picked this topic to do this project was because I helped my cousin make a movie for a project and it.
O N-LINE P UBLIC A CCESS C ATALOG. O N-LINE P UBLIC A CCESS C ATALOG.
Data Analytics CMIS Short Course part II Day 1 Part 1: Introduction Sam Buttrey December 2015.
The single most important skill for a computer programmer is problem solving Problem solving means the ability to formulate problems, think creatively.
CSE 143 Lecture 13 Recursive Backtracking slides created by Ethan Apter
HRP Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
R Workshop #2 Basic Data Analysis. What we did last week: Understand the basics of how R works Generated objects (vectors, matrices, etc.) Read in data.
INFOMGP Student names and numbers Papers’ references Title.
Data & Graphing vectors data frames importing data contingency tables barplots 18 September 2014 Sherubtse Training.
Randomising the behaviour of Sprites Games Programming in Scratch.
How to stay organized NEXT 1. Click the Slide Show Tab 2. Click on the “Start from Beginning” Button.
Machine Learning SEM 1 G53MLE: Machine Learning: Guoping Qiu.
Stata – be the master Stata. “After I have run my standard commands, what can I do to make my model better (and understand better what is going on)?”
L – Modeling and Simulating Social Systems with MATLAB Lecture 2 – Statistics and plotting © ETH Zürich | Giovanni Luca Ciampaglia,
Welcome to the Fundamentals of Mathematics for Engineers Lab ENGR 2194 MATLAB Supplemental Instruction #1.
By Leslie Ammann DROPBOX “Simplify Your Life”. What is Dropbox?  An online file hosting service  A way to link files to multiple computers  A way to.
● Preparing data sets ● CTD Data from Tomales Bay ● Clean up ● Binning ● Combined Temperature-Depth plots ● T-S scatter plots ● Multiple plots on a single.
Problem Solving: Brute Force Approaches
Creativity of Algorithms & Simple JavaScript Commands
Presented by Yuting Liu
Implementation of Convolution using C++
Randomising the behaviour of Sprites
Dimension Reduction via PCA (Principal Component Analysis)
Problem Solving: Brute Force Approaches
Mathematics Common Math Approaches
DATA MANAGEMENT MODULE: Managing Variables
Counting counts Quantifiable methods and data easy to learn
Building Web Applications
SoarUnit Bob Marinier 11/29/2018.
Welcome to the Fundamentals of Mathematics for Engineers Lab
Creating Functions with Parameters
DATA MANAGEMENT MODULE: Managing Variables
Data Management Module: Creating, Adding and Dropping Variables
Vectors and Matrices In MATLAB a vector can be defined as row vector or as a column vector. A vector of length n can be visualized as matrix of size 1xn.
Machine Learning Support Vector Machine Supervised Learning
Presentation transcript:

Lab 9: practice with functions Some tips to make your functions a little more interesting

Some advice before we start For this lab, the code file will be much more useful than the slides We'll post solutions to all of the problems, but try a few of them on your own first These techniques will make it easier to write functions, but you already know enough to do the assignment! This is just the delicious icing on the cake!

Applying functions for functional applications The apply() family of functions allows you to carry out a single function multiple times on a dataset  e.g., get the means of the rows of a dataset You can accomplish the same thing with a for loop, but apply() is faster

Conditioning for success We can use more interesting conditionals  x & y → x and y  x | y → x or y  !x → not x See the code file for how to subset a vector using conditionals

Making plots R has the ability to make lots of really nice plots Some commands you might us are:  plot()  hist()  barplot()