Actor Heights 1)Create Vectors of Actor Names, Heights, Date of Birth, Gender 2) Combine the 4 Vectors into a DataFrame.

Slides:



Advertisements
Similar presentations
R for Macroecology Aarhus University, Spring 2011.
Advertisements

Outline Research Question: What determines height? Data Input Look at One Variable Compare Two Variables Children’s Height and Parents Height Children’s.
Objective: Dealing with data in C++ Agenda: Notes Essay Help.
Comparing Numeric Values If Val(Text1.Text) = MaxPrice Then (Is the current numeric value stored in the Text property of Text1 equal to the value stored.
JavaScript, Third Edition
Computing with Strings CSC 161: The Art of Programming Prof. Henry Kautz 9/16/2009.
Baburao Kamble (Ph.D) University of Nebraska-Lincoln Data Analysis Using R Week2: Data Structure, Types and Manipulation in R.
Storing data Getting data out Data types Ruby as a foundation Program Variables Click icon to hear comments (the download may take a minute)
Computer Science 1000 Spreadsheets II Permission to redistribute these slides is strictly prohibited without permission.
The Selection Control Structure Questions on Program 3? 1.Review. 2. Truth-tables. 3. Forms of the if statement. 4. The switch statement.
Data Objects in R Vector1 dimensionAll elements have the same data types Data types: numeric, character logic, factor Matrix2 dimensions Array2 or more.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Introduction to Scheme Lectures on The Scheme Programming Language, 2 nd Ed. R. Kent Dybvig.
3 - Variables Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
R-Studio and Revolution Analytics have built additional functionality on top of base R.
R Programming Yang, Yufei. Normal distribution.
Chapter 16: Using Lookup Tables to Match Data 1 STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
A Simple Guide to Using SPSS ( Statistical Package for the Social Sciences) for Windows.
Sha Tin Methodist College F.4 Computer Studies Pascal Programming.
Computer Science 1620 boolean. Types so far: Integer char, short, int, long Floating Point float, double, long double String sequence of chars.
Using Text Files in Excel File I/O Methods. Working With Text Files A file can be accessed in any of three ways: –Sequential access: By far the most common.
Chapter 51 Decisions Relational and Logical Operators If Blocks Select Case Blocks.
R Introduction, Data Structures. An Excellent R Book (among many others) R in Action Data Analysis and Graphics with R Robert I. Kabacoff
ITEC 109 Lecture 7 Operations. Review Variables / Methods Functions Assignments –Purpose? –What provides the data? –What stores the data? –What type of.
School of Computer Science & Information Technology G6DICP - Lecture 4 Variables, data types & decision making.
Creating PHP Pages Chapter 6 PHP Variables, Constants and Operators.
Study Opportunities1 Database table quiz What is your name?
Logistic Regression. Linear regression – numerical response Logistic regression – binary categorical response eg. has the disease, or unaffected by the.
Slide 4- 1 © 2012 Pearson Education, Inc. Quiz 1 For Use with Clicker System or ResponsWare Introductory Statistics: Exploring the World through Data,
CMPS 1371 Introduction to Computing for Engineers CHARACTER STRINGS.
A: A: double “4” A: “34” 4.
Use SPSS for solving the problems Lecture#21. Opening SPSS The default window will have the data editor There are two sheets in the window: 1. Data view2.
R objects  All R entities exist as objects  They can all be operated on as data  We will cover:  Vectors  Factors  Lists  Data frames  Tables 
Querying Databases A query is a program that allows us to VIEW the data or operate on the data Several types of queries –Select query –Merge query –Summary.
DATA TYPES, VARIABLES AND CONSTANTS. LEARNING OBJECTIVES  Be able to identify and explain the difference between data and information  Be able to identify,
Data & Graphing vectors data frames importing data contingency tables barplots 18 September 2014 Sherubtse Training.
Steps Continuous Categorical Histogram Scatter Boxplot Child’s Height Linear Regression Dad’s Height Gender Continuous Y X1, X2 X3 Type Variable Mom’s.
Basics in R part 2. Variable types in R Common variable types: Numeric - numeric value: 3, 5.9, Logical - logical value: TRUE or FALSE (1 or 0)
Lecture 11 Introduction to R and Accessing USGS Data from Web Services Jeffery S. Horsburgh Hydroinformatics Fall 2013 This work was funded by National.
Checking If User Input Is Numeric.  Quiz  Detecting numeric input  Finish Prior Lecture  Y'all work on one of the problems listed 2.
Random Functions Selection Structure Comparison Operators Logical Operator
Vectors and DataFrames. Character Vector: b
Chapter 9: Data types and data structures OCR Computing for A Level © Hodder Education 2009.
OCR AS Level F452: Data types and data structures Data types and data structures a. define different data types, eg numeric (integer, real),
Setting up your database And codebook. What is a codebook? It is a description of all your variables How they were created How they are scored Includes.
Java String Methods - Codehs
GCSE COMPUTER SCIENCE Practical Programming using Python
DATA TYPES.
Relational Operator and Operations
var variableName:datatype;
DATA MANAGEMENT MODULE: Getting Data Into and Out of R
JavaScript Objects.
Stats Lab #1 TA: Kyle Davis
Starter Question In your jotter write the pseudocode to take in two numbers, add them together then display the answer. Declare variables RECEIVE firstNumber.
Uploading and handling databases
Web Programming– UFCFB Lecture 19-20
DATA MANAGEMENT MODULE: Getting Data Into and Out of R
Learning Objective LO: We’re learning to understand when it is appropriate to use particular data types.
Numerical Descriptives in R
Review Operation Bingo
Data Types.
Computers & Programming Languages
LabVIEW.
Vectors and DataFrames
JavaScript.
MIS2502: Data Analytics Introduction to R and RStudio
C# Revision Cards Data types
Understanding Variables
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Data Types and Maths Programming Guides.
Presentation transcript:

Actor Heights 1)Create Vectors of Actor Names, Heights, Date of Birth, Gender 2) Combine the 4 Vectors into a DataFrame

Numeric: e.g. heights String: e.g. names Dates: “ Factor: e.g. gender Boolean: TRUE, FALSE Variable Types

We use the c() function and list all values in quotations so that R knows that it is string data. Create a variable called ActorNames as follows: ActorNames <- c(“John", “Meryl”, “Jennifer", “Andre") Creating a Character / String Vector

Class, Length, Index class(ActorNames) length(ActorNames) ActorNames[2]

Create a variable called ActorHeights (inches): ActorHeights <- c(77, 66, 70, 90) Creating a Numeric Vector / Variable

Use the as.Date() function: ActorDoB <-as.Date(c(" ", " ", " ", " “ )) Each date has been entered as a text string (in quotations) in the appropriate format (yyyy-mm-dd). By enclosing these data in the as.Date() function, these strings are converted to date objects. Creating a Date Variable

Use the factor() function: ActorGender <- c(“male", “female", “female", “male“ ) ActorGender <- factor(ActorGender) Creating a Categorical / Factor Variable

Actor.DF <-data.frame(Name=ActorNames, Height=ActorHeights, BirthDate = ActorDob, Gender=ActorGender) Vectors and DataFrames dim(Actor.DF) Actor.DF[2] Actor.DF[2,] Actor.DF[1,3] Actor.DF[2,2] Actor.DF[2:3,]

> getwd() [1] "C:/Users/johnp_000/Documents" > setwd() getwd() setwd()

write.table(Actors.DF, “ActorData.txt", sep="\t", row.names = TRUE) write.csv(Actors.DF, “ActorData.csv") Write / Create a File