Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCI N207 Data Analysis Using Spreadsheet

Similar presentations


Presentation on theme: "CSCI N207 Data Analysis Using Spreadsheet"— Presentation transcript:

1 CSCI N207 Data Analysis Using Spreadsheet
Expressions Department of Computer and Information Science IUPUI

2 Expressions String(text) value must be enclosed in single or double quotes paste() will connect objects together, sep=‘’ option means to connect without using spaces c() – combine elements into a vector

3 Symbols Symbols You can assign a value to a symbol (variable)
You can change the value of the variable You can assign the value of a variable to another variable Assignment operator ← takes the value evaluated from the right hand side and assignment the value to the variable on the left hand side

4 Symbols Symbols Variable names are case sensitive
Some names are reserved key words by R, thus cannot be used as variable names, e.g. if, else, repeat, for, while, in, function, TRUE, FALSE, NULL etc You can write a series of expressions on separate lines or in one line separated by semi colons

5 User-Defined Functions
You can create a user-defined function that performs a particular task designed by you. You need to define a function name, and/or input parameter(s), and the operations (function definition) When you use(call) a function, give the function name and the actual input values (function call)

6 Conditional Statements
if/else statements if (condition) {statement block} If the condition is true, run the statement block if (condition) {statement block 1} else {statement block 2} If the condition is true, run statement block 1 otherwise, run statement block 2

7 Save Your Code You can save all the contents in R Console by clicking on “File”, then “Save to File”. You will be asked to save the file as a .txt file. Enter a file name and make sure .txt is part of the file name, e.g. max.txt. You may want to clean up the .txt file, e.g. deleting error messages or additional codes. This is the easiest way to save your codes at this moment. Another way will be introduced later.


Download ppt "CSCI N207 Data Analysis Using Spreadsheet"

Similar presentations


Ads by Google