A Quick Introduction to R

Size: px
Start display at page:

Download "A Quick Introduction to R"

Transcription

1 A Quick Introduction to R Guy Lebanon January 18, Overview R is a relatively new programming language aimed at computational data analysis, statistical modeling, and data visualization. It is similar to Matlab in the following ways In its default setting it is run inside an interactive shell. In many cases, the shell is a complete graphical user interface (GUI) It emphasizes storing and manipulating data as multidimensional arrays - vectors, matrices, tensors, etc. A great deal of functionality is already implemented in packages - both elementary (matrix operations, SVD, eigenvalues solvers, random number generators, optimization routines, etc.) and specicialized (kernel smoothing, support vector machines, etc.). Like Matlab it is slower than native C/C++/Java/Python applications and cannot handle extremely large datasets. Depending on how the code is vectorized 1 this may be a marginal slowdown or an extremely significant one. Both languages can interface with native C/C++ code in order to reduce computational bottlenecks. It is also different from Matlab in some important ways: R is open-source and freely available for all major operating systems (Windows, Linux, Mac). It is much easier to extend R and install packages contributed by others. As a result, R has an enormous number of high quality and well documented packages that are easy to install In contrast to Matlab which was initialy designed for engineers, R was designed for data analysis. As a result, the syntax of the language is much better suited for computational data analysis, statistics, and data visualization. It has several extremely powerful libraries for data visualiztion. R is less polished than Matlab in several ways: simpler GUI, less convenient profiler and editor, worse handling of sparse matrices. 2 First Commands First, download and install a copy of R from that is suitable for your operating system. That website is also an extremely useful source of documentation, news, and user contributed packages. On Linux you can invoke and run R within a terminal by typing R at the prompt. Another convenient way is to run it within emacs using the Emacs Speaks Statistics (ESS) package. In Windows R is used using the graphical user interface. In Mac both terminal (or emacs) and GUI version are available. The easiest way to quit R is to type q() at the prompt. To get help on a specific function, operator, or data object type help(x) where X is a case sensitive string within single or double quotes. Similarly, example(x) yields an example of using X. help.start() starts html-based documentation within a browser that is easy to navigate. Each line may contain one or more commands separated by the ; symbol. Here are some self explanatory important commands. 1 > # This is a comment 2 > x =3; y =3* x +2; # basic variable assignment and arithmetic 3 > y # same as print ( y) 1 Vectorized code means that that basic operations are done on entire arrays rather than on individual array elements inside nested loops 1

2 11 1 > ls (); # lists all variables in workspace "x " "y " 1 > save.image( file = ' varfile ' ); # saves all variables to a file 2 > rm(x, y); # clears variables x and y 3 > ls (); 1 character (0) 1 > load ( ' varfile ' ) # loads all variables back to the workspace 2 > ls (); "x " "y " When R is exited the current variables are saved to a file named.rdata in the current directory. When R is started it automatically uploads that file (in the current directory) if it exists and so retrives the set of variables from the previous session in that directory. Inside R you can change directories or view the current directory using setwd and getwd. Shell commands may be executed with the system functions e.g., in linux display all files in current directory by 1 > system ( ' ls -al ' ); Calling from R to C code, in particular computational bottlenecks is described in One of the nice features of R is the ease with which new packages can be installed (this applies to packages written by both the formal R developers as well as other users). The function install.packages(x) installs the functions and data in the package X (a string with single quotes) from the internet and library(x) brings the data and functions into the program s namespace or scope. The reason for this is that some packages may contain functions or datas that overlaps functions or data in other packages (remember that many packages are developed in a distributed way by independent contributors). A list of available packages, their implementation and documentation is available at As mentioned above a package contains both function definitions and datasets. A list of datasets available inside the package can be obtained using the function data 1 > data ( package = ' ggplot2 ' ); The functions source(x) and sink(x) causes R to executes commands in the file X and records the output to the file X respectively (similar to linux input/output redirection). The conventional suffix for a file with R commands is.r. 3 Vectors, Arrays, Lists, and Dataframes In R, data is kept and manipulated in vectors, arrays, lists and dataframes. A vector is one dimensional ordered collection of variables of the same type e.g., real numbers, booleans values, etc. An array is a multidimensional collection of which matrix is a two dimensional special case. Lists are ordered collections of variables of potentially different types. A dataframes are ordered collections of lists that is often interpreted as samples from a common distribution (think of a matrix whos rows are samples and columns are features or dimensions of potentially different type). Here are some examples concerning vectors. 1 > x=c (4,3,3,4,3,1); x # c() contcatanates arguments to create a vector > y= vector ( mode = ' logical ', length =4); y # a boolean vector initialized to FALSE FALSE FALSE FALSE FALSE 2

3 1 > z= vector ( length =3, mode = ' numeric ' ); z # a numeric vector initialized to > w= seq (0, 1, length. out =11); w # vector of 11 evenly spaced numbers in the range (0,1) > r=w 0.5; r # a boolean vector showing where w is less than or equal to 1/ 2 TRUE TRUE TRUE TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE 1 > w[ w 0.5 ]=0; w # zero out all components less than or equal to 1/ > w =2* w +1; w # element- wise operations Matrices and more generally arrays are multidimensional generalizations of vectors whose dimensionality is specified using the dim attribute. In arrays as in vectors all elements must have the same mode or type (numeric, boolean, character, etc.). 1 > x= array ( data = seq (1,20, length.out =20), dim =c (4,5)); x 1 [,1] [,2] [,3] [,4] [,5] 2 [1,] [2,] [3,] [4,] > x [2,3] # refer to the 2 nd row and 3 rd column 10 1 > x[2,] # refer to the entire second row > x[-1,] # all but the first row - same as x[ c(2,3,4),] 1 [,1] [,2] [,3] [,4] [,5] 2 [1,] [2,] [3,] > y=x[c(1,2),c(1,2)]; y=2*y +1; y # note elementwise operation 1 [,1] [,2] 2 [1,] [2,] > y %*% y # matrix product ( both arguments are matrices ) 3

4 1 [,1] [,2] 2 [1,] [2,] > x[1,] %*% x [1,] # inner product ( both vectors have the same dimensions ) 1 [,1] 2 [1,] > x[,1] %*% t( x [,1]) # outer product ( vectors have different dimensions ; t( X) transposes X) 1 [,1] [,2] [,3] [,4] 2 [1,] [2,] [3,] [4,] > rbind (x[1,],x[1,]) # vertical concatationn 1 [,1] [,2] [,3] [,4] [,5] 2 [1,] [2,] > cbind (x[1,],x[1,]) # horizontal concatanation 1 [,1] [,2] 2 [1,] [2,] [3,] [4,] [5,] Lists are similar to vetctors in being one dimensional but can hold variables of different types. The positions can be given names, which makes referring to them easier. 1 > L= list ( name = ' John ',age =55, manager = FALSE, no.children =3, children.ages =c (15,18,25)) 2 > L [[1]] # variable in first position - note double brackets for list elements [[.]] "John " 1 > L$ name # entry corresponding to name ( first ) "John " 1 > L$ children.ages [2] # same as L [[5]][2] 18 A dataframe is an ordered sequence of lists. It is easy to think of a dataframe as a two dimensional entity whose rows correspond to data examples (samples from a multivariatte distribution) and columns correspond to dimensions or features. They are like matrices with two important differences: the different columns may have different types (numeric, boolean, string) and may be assigned names for easier reference. In the example below we demonstrate the iris dataframe which which is a built-in R dataset (first four dimensions are numeric describing flower measurements, the last dimension is a string describing flower type). 1 > summary ( i r i s ) # statistical summary 4

5 1 Sepal. Length Sepal. Width Petal. Length Petal. Width 2 Min. :4.300 Min. :2.000 Min. :1.000 Min. : st Qu. : st Qu. : st Qu. : st Qu. : Median :5.800 Median :3.000 Median :4.350 Median : Mean :5.843 Mean :3.057 Mean :3.758 Mean : rd Qu. : rd Qu. : rd Qu. : rd Qu. : Max. :7.900 Max. :4.400 Max. :6.900 Max. : Species 9 setosa :50 10 versicolor :50 11 virginica :50 1 > names ( i r i s ) # dimension names "Sepal.Length " "Sepal.Width " "Petal.Length " "Petal.Width " "Species " 1 > i r i s [1,] # first sample 1 Sepal. Length Sepal. Width Petal. Length Petal. Width Species setosa 1 > i r i s $ Sepal. Length [1:10] # sepal length of first ten samples > attach ( i r i s ); # now we can use the shorter Sepal. Length instead of iris $ Sepal. Length 2 > mean ( Sepal.Length ) Dataframes can be easily created from text files with the right formatting. For example, consider the text file containing the same Iris data in - first line is the header containing dimension names and the remaining lines describe the data points. Such a file may be used to create a dataframe using the command 1 > Iris = read.table ( ' irisfile.txt ',header = TRUE ); # or else from internet : 2 > Iris = read.table ( ' http :// / wsc / visualizing.datatables / iris ',header = TRUE ); Dataframes and other variables can also be examined and edited within a spreadsheet like enviornment 1 > edit ( i r i s ) # examine data as spreadsheet 2 > i r i s = edit ( i r i s ) # edit dataframe / variable 3 > newiris = edit ( i r i s ) # edit dataframe / variable but keep original The function search() shows the search path for variables and functions, starting with the current global enviornment. 4 If-Else, Loops, and Functions The flow of control within an R program is very similar to that in other programming languages. Below are some examples of if-else, loops, and function definitions and function calls. 1 > a =10; b =5; c =1; 2 > if ( a<b ) d =1 else if ( a == b) d =2 else d =3; # may need curly braces if more than one line 3 > d 3 Logical operators are similar to C/C++: && for AND for OR. 5

6 1 > sm =0; 2 > for ( num in seq (1,100, by =1)) { 3 + sm=sm+num ; 5 > sm # same as sum (1:100) > repeat { 2 + sm= sm-num ; num = num-1 ; 3 + if ( sm ==0) break 5 > sm 0 1 > a =1; b =10; 2 > while (b >a) { 3 + sm=sm +1; 4 + a=a +1; b= b-1 ; 5 + } 6 > sm 5 Functions in R are similar to those in other languages like C/C++, Java, or Matlab. When calling a function the parameters are copied into the arguments according to the order they are entered. Parameters may be entered out of order if the parameter names are supplied. Default values for missing parameters are supported. 1 > mypower = function ( bas =10, pow =2) { 2 + res = bas pow ; 3 + return ( res ); 5 > mypower (2,3) 8 1 > mypower ( pow =3, bas =2) # same as before - named parameters are out of order 8 1 > mypower ( bas =3); # default power value is used 9 As in other languages, variables defined inside functions (including the arguments) are local and do not affect the program after the function completes its execution (except for the returned value). 5 Customization and Other Topics When R starts it executes the function.first() in the.rprofile file in the home directory (if it exist). This is a good place to put user preferred options. Similarly, a function.last in the same file is executed at the end of any R session. 1 >.First = function () { 2 + options ( prompt = ' R> ',digits =6) 3 + library ( ' ggplot2 ' ); 5 >.Last = function () { 6 + cat ( paste ( date (), "\ nbye \n ")); 7 + } 6

7 R may be executed with flags, for example R -q starts R without printing the initial welcome message or R -d gdb runs R via the debugger gdb. To run an R script file foo.r type R CMD BATCH foo.r &. You can pass arguments to the script using R CMD BATCH -args arg1 arg 2 foo.r &. To retrieve the arguments inside the script type args=commandargs(true). A shorter command for running script is Rscript foo.r. Another possibility to run R scripts is to write a shell script-type file 1 > #! / usr / bin / Rscript 2 > args = commandargs ( TRUE ); # retrieve arguments if available 3 >... # here comes a sequence of R commands 4 > q (1); # return value Such a file may executed by making it executable using chmod 755 filename. It is also possible to redirect input and output by typing in the shell prompt: filename < infile > outfile. 7

Getting Started with R and RStudio 1

Getting Started with R and RStudio 1 Getting Started with R and RStudio 1 1 What is R? R is a system for statistical computation and graphics. It is the statistical system that is used in Mathematics 241, Engineering Statistics, for the following

More information

Introduction to Matlab

Introduction to Matlab Introduction to Matlab Social Science Research Lab American University, Washington, D.C. Web. www.american.edu/provost/ctrl/pclabs.cfm Tel. x3862 Email. SSRL@American.edu Course Objective This course provides

More information

Creating a Simple Macro

Creating a Simple Macro 28 Creating a Simple Macro What Is a Macro?, 28-2 Terminology: three types of macros The Structure of a Simple Macro, 28-2 GMACRO and ENDMACRO, Template, Body of the macro Example of a Simple Macro, 28-4

More information

CLC Server Command Line Tools USER MANUAL

CLC Server Command Line Tools USER MANUAL CLC Server Command Line Tools USER MANUAL Manual for CLC Server Command Line Tools 2.5 Windows, Mac OS X and Linux September 4, 2015 This software is for research purposes only. QIAGEN Aarhus A/S Silkeborgvej

More information

Beginner s Matlab Tutorial

Beginner s Matlab Tutorial Christopher Lum lum@u.washington.edu Introduction Beginner s Matlab Tutorial This document is designed to act as a tutorial for an individual who has had no prior experience with Matlab. For any questions

More information

Lecture 2 Notes: Flow of Control

Lecture 2 Notes: Flow of Control 6.096 Introduction to C++ January, 2011 Massachusetts Institute of Technology John Marrero Lecture 2 Notes: Flow of Control 1 Motivation Normally, a program executes statements from first to last. The

More information

grep, awk and sed three VERY useful command-line utilities Matt Probert, Uni of York grep = global regular expression print

grep, awk and sed three VERY useful command-line utilities Matt Probert, Uni of York grep = global regular expression print grep, awk and sed three VERY useful command-line utilities Matt Probert, Uni of York grep = global regular expression print In the simplest terms, grep (global regular expression print) will search input

More information

MATLAB Tutorial. Chapter 6. Writing and calling functions

MATLAB Tutorial. Chapter 6. Writing and calling functions MATLAB Tutorial Chapter 6. Writing and calling functions In this chapter we discuss how to structure a program with multiple source code files. First, an explanation of how code files work in MATLAB is

More information

Introduction to R and UNIX Working with microarray data in a multi-user environment

Introduction to R and UNIX Working with microarray data in a multi-user environment Microarray Data Analysis Workshop MedVetNet Workshop, DTU 2008 Introduction to R and UNIX Working with microarray data in a multi-user environment Carsten Friis Media glna tnra GlnA TnrA C2 glnr C3 C5

More information

Unix Shell Scripts. Contents. 1 Introduction. Norman Matloff. July 30, 2008. 1 Introduction 1. 2 Invoking Shell Scripts 2

Unix Shell Scripts. Contents. 1 Introduction. Norman Matloff. July 30, 2008. 1 Introduction 1. 2 Invoking Shell Scripts 2 Unix Shell Scripts Norman Matloff July 30, 2008 Contents 1 Introduction 1 2 Invoking Shell Scripts 2 2.1 Direct Interpretation....................................... 2 2.2 Indirect Interpretation......................................

More information

Computational Mathematics with Python

Computational Mathematics with Python Boolean Arrays Classes Computational Mathematics with Python Basics Olivier Verdier and Claus Führer 2009-03-24 Olivier Verdier and Claus Führer Computational Mathematics with Python 2009-03-24 1 / 40

More information

AMATH 352 Lecture 3 MATLAB Tutorial Starting MATLAB Entering Variables

AMATH 352 Lecture 3 MATLAB Tutorial Starting MATLAB Entering Variables AMATH 352 Lecture 3 MATLAB Tutorial MATLAB (short for MATrix LABoratory) is a very useful piece of software for numerical analysis. It provides an environment for computation and the visualization. Learning

More information

A Crash Course on UNIX

A Crash Course on UNIX A Crash Course on UNIX UNIX is an "operating system". Interface between user and data stored on computer. A Windows-style interface is not required. Many flavors of UNIX (and windows interfaces). Solaris,

More information

CSC 120: Computer Science for the Sciences (R section)

CSC 120: Computer Science for the Sciences (R section) CSC 120: Computer Science for the Sciences (R section) Radford M. Neal, University of Toronto, 2015 http://www.cs.utoronto.ca/ radford/csc120/ Week 2 Typing Stuff into R Can be Good... You can learn a

More information

VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0

VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0 VISUAL GUIDE to RX Scripting for Roulette Xtreme - System Designer 2.0 UX Software - 2009 TABLE OF CONTENTS INTRODUCTION... ii What is this book about?... iii How to use this book... iii Time to start...

More information

Appendix: Tutorial Introduction to MATLAB

Appendix: Tutorial Introduction to MATLAB Resampling Stats in MATLAB 1 This document is an excerpt from Resampling Stats in MATLAB Daniel T. Kaplan Copyright (c) 1999 by Daniel T. Kaplan, All Rights Reserved This document differs from the published

More information

Computational Mathematics with Python

Computational Mathematics with Python Computational Mathematics with Python Basics Claus Führer, Jan Erik Solem, Olivier Verdier Spring 2010 Claus Führer, Jan Erik Solem, Olivier Verdier Computational Mathematics with Python Spring 2010 1

More information

Data Mining: Exploring Data. Lecture Notes for Chapter 3. Introduction to Data Mining

Data Mining: Exploring Data. Lecture Notes for Chapter 3. Introduction to Data Mining Data Mining: Exploring Data Lecture Notes for Chapter 3 Introduction to Data Mining by Tan, Steinbach, Kumar What is data exploration? A preliminary exploration of the data to better understand its characteristics.

More information

5 Correlation and Data Exploration

5 Correlation and Data Exploration 5 Correlation and Data Exploration Correlation In Unit 3, we did some correlation analyses of data from studies related to the acquisition order and acquisition difficulty of English morphemes by both

More information

Basic C Shell. helpdesk@stat.rice.edu. 11th August 2003

Basic C Shell. helpdesk@stat.rice.edu. 11th August 2003 Basic C Shell helpdesk@stat.rice.edu 11th August 2003 This is a very brief guide to how to use cshell to speed up your use of Unix commands. Googling C Shell Tutorial can lead you to more detailed information.

More information

CS1112 Spring 2014 Project 4. Objectives. 3 Pixelation for Identity Protection. due Thursday, 3/27, at 11pm

CS1112 Spring 2014 Project 4. Objectives. 3 Pixelation for Identity Protection. due Thursday, 3/27, at 11pm CS1112 Spring 2014 Project 4 due Thursday, 3/27, at 11pm You must work either on your own or with one partner. If you work with a partner you must first register as a group in CMS and then submit your

More information

Introduction to Java

Introduction to Java Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high

More information

Unix Scripts and Job Scheduling

Unix Scripts and Job Scheduling Unix Scripts and Job Scheduling Michael B. Spring Department of Information Science and Telecommunications University of Pittsburgh spring@imap.pitt.edu http://www.sis.pitt.edu/~spring Overview Shell Scripts

More information

VB.NET Programming Fundamentals

VB.NET Programming Fundamentals Chapter 3 Objectives Programming Fundamentals In this chapter, you will: Learn about the programming language Write a module definition Use variables and data types Compute with Write decision-making statements

More information

Visual Basic Programming. An Introduction

Visual Basic Programming. An Introduction Visual Basic Programming An Introduction Why Visual Basic? Programming for the Windows User Interface is extremely complicated. Other Graphical User Interfaces (GUI) are no better. Visual Basic provides

More information

Financial Econometrics MFE MATLAB Introduction. Kevin Sheppard University of Oxford

Financial Econometrics MFE MATLAB Introduction. Kevin Sheppard University of Oxford Financial Econometrics MFE MATLAB Introduction Kevin Sheppard University of Oxford October 21, 2013 2007-2013 Kevin Sheppard 2 Contents Introduction i 1 Getting Started 1 2 Basic Input and Operators 5

More information

G563 Quantitative Paleontology. SQL databases. An introduction. Department of Geological Sciences Indiana University. (c) 2012, P.

G563 Quantitative Paleontology. SQL databases. An introduction. Department of Geological Sciences Indiana University. (c) 2012, P. SQL databases An introduction AMP: Apache, mysql, PHP This installations installs the Apache webserver, the PHP scripting language, and the mysql database on your computer: Apache: runs in the background

More information

Introduction. Chapter 1

Introduction. Chapter 1 Chapter 1 Introduction MATLAB (Matrix laboratory) is an interactive software system for numerical computations and graphics. As the name suggests, MATLAB is especially designed for matrix computations:

More information

Lab 1: Introduction to C, ASCII ART and the Linux Command Line Environment

Lab 1: Introduction to C, ASCII ART and the Linux Command Line Environment .i.-' `-. i..' `/ \' _`.,-../ o o \.' ` ( / \ ) \\\ (_.'.'"`.`._) /// \\`._(..: :..)_.'// \`. \.:-:. /.'/ `-i-->..

More information

2+2 Just type and press enter and the answer comes up ans = 4

2+2 Just type and press enter and the answer comes up ans = 4 Demonstration Red text = commands entered in the command window Black text = Matlab responses Blue text = comments 2+2 Just type and press enter and the answer comes up 4 sin(4)^2.5728 The elementary functions

More information

R Language Fundamentals

R Language Fundamentals R Language Fundamentals Data Types and Basic Maniuplation Steven Buechler Department of Mathematics 276B Hurley Hall; 1-6233 Fall, 2007 Outline Where did R come from? Overview Atomic Vectors Subsetting

More information

R: A self-learn tutorial

R: A self-learn tutorial R: A self-learn tutorial 1 Introduction R is a software language for carrying out complicated (and simple) statistical analyses. It includes routines for data summary and exploration, graphical presentation

More information

AN INTRODUCTION TO UNIX

AN INTRODUCTION TO UNIX AN INTRODUCTION TO UNIX Paul Johnson School of Mathematics September 24, 2010 OUTLINE 1 SHELL SCRIPTS Shells 2 COMMAND LINE Command Line Input/Output 3 JOBS Processes Job Control 4 NETWORKING Working From

More information

Using Casio Graphics Calculators

Using Casio Graphics Calculators Using Casio Graphics Calculators (Some of this document is based on papers prepared by Donald Stover in January 2004.) This document summarizes calculation and programming operations with many contemporary

More information

Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

More information

OVERVIEW OF R SOFTWARE AND PRACTICAL EXERCISE

OVERVIEW OF R SOFTWARE AND PRACTICAL EXERCISE OVERVIEW OF R SOFTWARE AND PRACTICAL EXERCISE Hukum Chandra Indian Agricultural Statistics Research Institute, New Delhi-110012 1. INTRODUCTION R is a free software environment for statistical computing

More information

Lecture 4: Writing shell scripts

Lecture 4: Writing shell scripts Handout 5 06/03/03 1 Your rst shell script Lecture 4: Writing shell scripts Shell scripts are nothing other than les that contain shell commands that are run when you type the le at the command line. That

More information

1 Topic. 2 Scilab. 2.1 What is Scilab?

1 Topic. 2 Scilab. 2.1 What is Scilab? 1 Topic Data Mining with Scilab. I know the name "Scilab" for a long time (http://www.scilab.org/en). For me, it is a tool for numerical analysis. It seemed not interesting in the context of the statistical

More information

Large Datasets and You: A Field Guide

Large Datasets and You: A Field Guide Large Datasets and You: A Field Guide Matthew Blackwell m.blackwell@rochester.edu Maya Sen msen@ur.rochester.edu August 3, 2012 A wind of streaming data, social data and unstructured data is knocking at

More information

Object Oriented Software Design

Object Oriented Software Design Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 14, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction

More information

Cisco Networking Academy Program Curriculum Scope & Sequence. Fundamentals of UNIX version 2.0 (July, 2002)

Cisco Networking Academy Program Curriculum Scope & Sequence. Fundamentals of UNIX version 2.0 (July, 2002) Cisco Networking Academy Program Curriculum Scope & Sequence Fundamentals of UNIX version 2.0 (July, 2002) Course Description: Fundamentals of UNIX teaches you how to use the UNIX operating system and

More information

Invitation to Ezhil : A Tamil Programming Language for Early Computer-Science Education 07/10/13

Invitation to Ezhil : A Tamil Programming Language for Early Computer-Science Education 07/10/13 Invitation to Ezhil: A Tamil Programming Language for Early Computer-Science Education Abstract: Muthiah Annamalai, Ph.D. Boston, USA. Ezhil is a Tamil programming language with support for imperative

More information

Introduction to Python

Introduction to Python Introduction to Python Sophia Bethany Coban Problem Solving By Computer March 26, 2014 Introduction to Python Python is a general-purpose, high-level programming language. It offers readable codes, and

More information

Windows PowerShell Essentials

Windows PowerShell Essentials Windows PowerShell Essentials Windows PowerShell Essentials Edition 1.0. This ebook is provided for personal use only. Unauthorized use, reproduction and/or distribution strictly prohibited. All rights

More information

Computational Mathematics with Python

Computational Mathematics with Python Numerical Analysis, Lund University, 2011 1 Computational Mathematics with Python Chapter 1: Basics Numerical Analysis, Lund University Claus Führer, Jan Erik Solem, Olivier Verdier, Tony Stillfjord Spring

More information

Shell Scripts (1) For example: #!/bin/sh If they do not, the user's current shell will be used. Any Unix command can go in a shell script

Shell Scripts (1) For example: #!/bin/sh If they do not, the user's current shell will be used. Any Unix command can go in a shell script Shell Programming Shell Scripts (1) Basically, a shell script is a text file with Unix commands in it. Shell scripts usually begin with a #! and a shell name For example: #!/bin/sh If they do not, the

More information

NLP Programming Tutorial 0 - Programming Basics

NLP Programming Tutorial 0 - Programming Basics NLP Programming Tutorial 0 - Programming Basics Graham Neubig Nara Institute of Science and Technology (NAIST) 1 About this Tutorial 14 parts, starting from easier topics Each time: During the tutorial:

More information

PHP Tutorial From beginner to master

PHP Tutorial From beginner to master PHP Tutorial From beginner to master PHP is a powerful tool for making dynamic and interactive Web pages. PHP is the widely-used, free, and efficient alternative to competitors such as Microsoft's ASP.

More information

CS 2112 Lab: Version Control

CS 2112 Lab: Version Control 29 September 1 October, 2014 Version Control What is Version Control? You re emailing your project back and forth with your partner. An hour before the deadline, you and your partner both find different

More information

Sources: On the Web: Slides will be available on:

Sources: On the Web: Slides will be available on: C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,

More information

HP-UX Essentials and Shell Programming Course Summary

HP-UX Essentials and Shell Programming Course Summary Contact Us: (616) 875-4060 HP-UX Essentials and Shell Programming Course Summary Length: 5 Days Prerequisite: Basic computer skills Recommendation Statement: Student should be able to use a computer monitor,

More information

Command Line - Part 1

Command Line - Part 1 Command Line - Part 1 STAT 133 Gaston Sanchez Department of Statistics, UC Berkeley gastonsanchez.com github.com/gastonstat Course web: gastonsanchez.com/teaching/stat133 GUIs 2 Graphical User Interfaces

More information

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

More information

Prof. Nicolai Meinshausen Regression FS 2014. R Exercises

Prof. Nicolai Meinshausen Regression FS 2014. R Exercises Prof. Nicolai Meinshausen Regression FS 2014 R Exercises 1. The goal of this exercise is to get acquainted with different abilities of the R statistical software. It is recommended to use the distributed

More information

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 Oct 4, 2013, p 1 Name: CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 1. (max 18) 4. (max 16) 2. (max 12) 5. (max 12) 3. (max 24) 6. (max 18) Total: (max 100)

More information

R Language Fundamentals

R Language Fundamentals R Language Fundamentals Data Frames Steven Buechler Department of Mathematics 276B Hurley Hall; 1-6233 Fall, 2007 Tabular Data Frequently, experimental data are held in tables, an Excel worksheet, for

More information

SmartArrays and Java Frequently Asked Questions

SmartArrays and Java Frequently Asked Questions SmartArrays and Java Frequently Asked Questions What are SmartArrays? A SmartArray is an intelligent multidimensional array of data. Intelligent means that it has built-in knowledge of how to perform operations

More information

This loop prints out the numbers from 1 through 10 on separate lines. How does it work? Output: 1 2 3 4 5 6 7 8 9 10

This loop prints out the numbers from 1 through 10 on separate lines. How does it work? Output: 1 2 3 4 5 6 7 8 9 10 Java Loops & Methods The while loop Syntax: while ( condition is true ) { do these statements Just as it says, the statements execute while the condition is true. Once the condition becomes false, execution

More information

Example of a Java program

Example of a Java program Example of a Java program class SomeNumbers static int square (int x) return x*x; public static void main (String[] args) int n=20; if (args.length > 0) // change default n = Integer.parseInt(args[0]);

More information

1001ICT Introduction To Programming Lecture Notes

1001ICT Introduction To Programming Lecture Notes 1001ICT Introduction To Programming Lecture Notes School of Information and Communication Technology Griffith University Semester 2, 2015 1 3 A First MaSH Program In this section we will describe a very

More information

CE 504 Computational Hydrology Computational Environments and Tools Fritz R. Fiedler

CE 504 Computational Hydrology Computational Environments and Tools Fritz R. Fiedler CE 504 Computational Hydrology Computational Environments and Tools Fritz R. Fiedler 1) Operating systems a) Windows b) Unix and Linux c) Macintosh 2) Data manipulation tools a) Text Editors b) Spreadsheets

More information

NaviCell Data Visualization Python API

NaviCell Data Visualization Python API NaviCell Data Visualization Python API Tutorial - Version 1.0 The NaviCell Data Visualization Python API is a Python module that let computational biologists write programs to interact with the molecular

More information

Perl in a nutshell. First CGI Script and Perl. Creating a Link to a Script. print Function. Parsing Data 4/27/2009. First CGI Script and Perl

Perl in a nutshell. First CGI Script and Perl. Creating a Link to a Script. print Function. Parsing Data 4/27/2009. First CGI Script and Perl First CGI Script and Perl Perl in a nutshell Prof. Rasley shebang line tells the operating system where the Perl interpreter is located necessary on UNIX comment line ignored by the Perl interpreter End

More information

Object systems available in R. Why use classes? Information hiding. Statistics 771. R Object Systems Managing R Projects Creating R Packages

Object systems available in R. Why use classes? Information hiding. Statistics 771. R Object Systems Managing R Projects Creating R Packages Object systems available in R Statistics 771 R Object Systems Managing R Projects Creating R Packages Douglas Bates R has two object systems available, known informally as the S3 and the S4 systems. S3

More information

PHP Debugging. Draft: March 19, 2013 2013 Christopher Vickery

PHP Debugging. Draft: March 19, 2013 2013 Christopher Vickery PHP Debugging Draft: March 19, 2013 2013 Christopher Vickery Introduction Debugging is the art of locating errors in your code. There are three types of errors to deal with: 1. Syntax errors: When code

More information

AP Computer Science Java Subset

AP Computer Science Java Subset APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall

More information

Command Scripts. 13.1 Running scripts: include and commands

Command Scripts. 13.1 Running scripts: include and commands 13 Command Scripts You will probably find that your most intensive use of AMPL s command environment occurs during the initial development of a model, when the results are unfamiliar and changes are frequent.

More information

Developing In Eclipse, with ADT

Developing In Eclipse, with ADT Developing In Eclipse, with ADT Android Developers file://v:\android-sdk-windows\docs\guide\developing\eclipse-adt.html Page 1 of 12 Developing In Eclipse, with ADT The Android Development Tools (ADT)

More information

Iris Sample Data Set. Basic Visualization Techniques: Charts, Graphs and Maps. Summary Statistics. Frequency and Mode

Iris Sample Data Set. Basic Visualization Techniques: Charts, Graphs and Maps. Summary Statistics. Frequency and Mode Iris Sample Data Set Basic Visualization Techniques: Charts, Graphs and Maps CS598 Information Visualization Spring 2010 Many of the exploratory data techniques are illustrated with the Iris Plant data

More information

Data Tool Platform SQL Development Tools

Data Tool Platform SQL Development Tools Data Tool Platform SQL Development Tools ekapner Contents Setting SQL Development Preferences...5 Execution Plan View Options Preferences...5 General Preferences...5 Label Decorations Preferences...6

More information

Basic Concepts in Matlab

Basic Concepts in Matlab Basic Concepts in Matlab Michael G. Kay Fitts Dept. of Industrial and Systems Engineering North Carolina State University Raleigh, NC 769-7906, USA kay@ncsu.edu September 00 Contents. The Matlab Environment.

More information

Using R for Windows and Macintosh

Using R for Windows and Macintosh 2010 Using R for Windows and Macintosh R is the most commonly used statistical package among researchers in Statistics. It is freely distributed open source software. For detailed information about downloading

More information

Advanced Bash Scripting. Joshua Malone (jmalone@ubergeeks.com)

Advanced Bash Scripting. Joshua Malone (jmalone@ubergeeks.com) Advanced Bash Scripting Joshua Malone (jmalone@ubergeeks.com) Why script in bash? You re probably already using it Great at managing external programs Powerful scripting language Portable and version-stable

More information

PYTHON Basics http://hetland.org/writing/instant-hacking.html

PYTHON Basics http://hetland.org/writing/instant-hacking.html CWCS Workshop May 2009 PYTHON Basics http://hetland.org/writing/instant-hacking.html Python is an easy to learn, modern, interpreted, object-oriented programming language. It was designed to be as simple

More information

Exercise 0. Although Python(x,y) comes already with a great variety of scientic Python packages, we might have to install additional dependencies:

Exercise 0. Although Python(x,y) comes already with a great variety of scientic Python packages, we might have to install additional dependencies: Exercise 0 Deadline: None Computer Setup Windows Download Python(x,y) via http://code.google.com/p/pythonxy/wiki/downloads and install it. Make sure that before installation the installer does not complain

More information

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison

SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89. by Joseph Collison SYSTEMS OF EQUATIONS AND MATRICES WITH THE TI-89 by Joseph Collison Copyright 2000 by Joseph Collison All rights reserved Reproduction or translation of any part of this work beyond that permitted by Sections

More information

COSC282 BIG DATA ANALYTICS FALL 2015 LECTURE 2 - SEP 9

COSC282 BIG DATA ANALYTICS FALL 2015 LECTURE 2 - SEP 9 COSC282 BIG DATA ANALYTICS FALL 2015 LECTURE 2 - SEP 9 1 HOW WAS YOUR WEEKEND? Image source: http://www.liverunsparkle.com/ its-a-long-weekend-up-in-here/ 1. Read and Post on Piazza 2. Installed JDK &

More information

EXCEL SOLVER TUTORIAL

EXCEL SOLVER TUTORIAL ENGR62/MS&E111 Autumn 2003 2004 Prof. Ben Van Roy October 1, 2003 EXCEL SOLVER TUTORIAL This tutorial will introduce you to some essential features of Excel and its plug-in, Solver, that we will be using

More information

Data Mining: Exploring Data. Lecture Notes for Chapter 3. Slides by Tan, Steinbach, Kumar adapted by Michael Hahsler

Data Mining: Exploring Data. Lecture Notes for Chapter 3. Slides by Tan, Steinbach, Kumar adapted by Michael Hahsler Data Mining: Exploring Data Lecture Notes for Chapter 3 Slides by Tan, Steinbach, Kumar adapted by Michael Hahsler Topics Exploratory Data Analysis Summary Statistics Visualization What is data exploration?

More information

Homework 4 Statistics W4240: Data Mining Columbia University Due Tuesday, October 29 in Class

Homework 4 Statistics W4240: Data Mining Columbia University Due Tuesday, October 29 in Class Problem 1. (10 Points) James 6.1 Problem 2. (10 Points) James 6.3 Problem 3. (10 Points) James 6.5 Problem 4. (15 Points) James 6.7 Problem 5. (15 Points) James 6.10 Homework 4 Statistics W4240: Data Mining

More information

STATGRAPHICS Online. Statistical Analysis and Data Visualization System. Revised 6/21/2012. Copyright 2012 by StatPoint Technologies, Inc.

STATGRAPHICS Online. Statistical Analysis and Data Visualization System. Revised 6/21/2012. Copyright 2012 by StatPoint Technologies, Inc. STATGRAPHICS Online Statistical Analysis and Data Visualization System Revised 6/21/2012 Copyright 2012 by StatPoint Technologies, Inc. All rights reserved. Table of Contents Introduction... 1 Chapter

More information

Data Mining: Exploring Data. Lecture Notes for Chapter 3. Introduction to Data Mining

Data Mining: Exploring Data. Lecture Notes for Chapter 3. Introduction to Data Mining Data Mining: Exploring Data Lecture Notes for Chapter 3 Introduction to Data Mining by Tan, Steinbach, Kumar Tan,Steinbach, Kumar Introduction to Data Mining 8/05/2005 1 What is data exploration? A preliminary

More information

Bash shell programming Part II Control statements

Bash shell programming Part II Control statements Bash shell programming Part II Control statements Deniz Savas and Michael Griffiths 2005-2011 Corporate Information and Computing Services The University of Sheffield Email M.Griffiths@sheffield.ac.uk

More information

Introduction to R June 2006

Introduction to R June 2006 Introduction to R Introduction...3 What is R?...3 Availability & Installation...3 Documentation and Learning Resources...3 The R Environment...4 The R Console...4 Understanding R Basics...5 Managing your

More information

Forensic Analysis of Internet Explorer Activity Files

Forensic Analysis of Internet Explorer Activity Files Forensic Analysis of Internet Explorer Activity Files by Keith J. Jones keith.jones@foundstone.com 3/19/03 Table of Contents 1. Introduction 4 2. The Index.dat File Header 6 3. The HASH Table 10 4. The

More information

Java CPD (I) Frans Coenen Department of Computer Science

Java CPD (I) Frans Coenen Department of Computer Science Java CPD (I) Frans Coenen Department of Computer Science Content Session 1, 12:45-14:30 (First Java Programme, Inheritance, Arithmetic) Session 2, 14:45-16:45 (Input and Programme Constructs) Materials

More information

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

KITES TECHNOLOGY COURSE MODULE (C, C++, DS) KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php info@kitestechnology.com technologykites@gmail.com Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL

More information

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language Translation Translating to Java Introduction to Computer Programming The job of a programmer is to translate a problem description into a computer language. You need to be able to convert a problem description

More information

3.GETTING STARTED WITH ORACLE8i

3.GETTING STARTED WITH ORACLE8i Oracle For Beginners Page : 1 3.GETTING STARTED WITH ORACLE8i Creating a table Datatypes Displaying table definition using DESCRIBE Inserting rows into a table Selecting rows from a table Editing SQL buffer

More information

An R Tutorial. 1. Starting Out

An R Tutorial. 1. Starting Out An R Tutorial 1. Starting Out R is an interactive environment for statistical computing and graphics. This tutorial will assume usage of R 2.0.0 on a PC. However, except in rare situations, these commands

More information

BASH Scripting. A bash script may consist of nothing but a series of command lines, e.g. The following helloworld.sh script simply does an echo.

BASH Scripting. A bash script may consist of nothing but a series of command lines, e.g. The following helloworld.sh script simply does an echo. BASH Scripting bash is great for simple scripts that automate things you would otherwise by typing on the command line. Your command line skills will carry over to bash scripting and vice versa. bash comments

More information

Programming Exercise 3: Multi-class Classification and Neural Networks

Programming Exercise 3: Multi-class Classification and Neural Networks Programming Exercise 3: Multi-class Classification and Neural Networks Machine Learning November 4, 2011 Introduction In this exercise, you will implement one-vs-all logistic regression and neural networks

More information

BIO503 - Lecture 1 Introduction to the R language

BIO503 - Lecture 1 Introduction to the R language BIO503 - Lecture 1 Introduction to the R language Bio503 January 2008, Aedin Culhane. I R, S and S-plus What is R? ˆ R is an environment for data analysis and visualization ˆ R is an open source implementation

More information

An introduction to using Microsoft Excel for quantitative data analysis

An introduction to using Microsoft Excel for quantitative data analysis Contents An introduction to using Microsoft Excel for quantitative data analysis 1 Introduction... 1 2 Why use Excel?... 2 3 Quantitative data analysis tools in Excel... 3 4 Entering your data... 6 5 Preparing

More information

13 File Output and Input

13 File Output and Input SCIENTIFIC PROGRAMMING -1 13 File Output and Input 13.1 Introduction To make programs really useful we have to be able to input and output data in large machinereadable amounts, in particular we have to

More information

Linux Overview. Local facilities. Linux commands. The vi (gvim) editor

Linux Overview. Local facilities. Linux commands. The vi (gvim) editor Linux Overview Local facilities Linux commands The vi (gvim) editor MobiLan This system consists of a number of laptop computers (Windows) connected to a wireless Local Area Network. You need to be careful

More information

Informatica e Sistemi in Tempo Reale

Informatica e Sistemi in Tempo Reale Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)

More information

5 Arrays and Pointers

5 Arrays and Pointers 5 Arrays and Pointers 5.1 One-dimensional arrays Arrays offer a convenient way to store and access blocks of data. Think of arrays as a sequential list that offers indexed access. For example, a list of

More information

Cluster software and Java TreeView

Cluster software and Java TreeView Cluster software and Java TreeView To download the software: http://bonsai.hgc.jp/~mdehoon/software/cluster/software.htm http://bonsai.hgc.jp/~mdehoon/software/cluster/manual/treeview.html Cluster 3.0

More information

Exercises on using R for Statistics and Hypothesis Testing Dr. Wenjia Wang

Exercises on using R for Statistics and Hypothesis Testing Dr. Wenjia Wang Exercises on using R for Statistics and Hypothesis Testing Dr. Wenjia Wang School of Computing Sciences, UEA University of East Anglia Brief Introduction to R R is a free open source statistics and mathematical

More information