Baburao Kamble (Ph.D) University of Nebraska-Lincoln Data Analysis Using R Week2: Data Structure, Types and Manipulation in R.

Slides:



Advertisements
Similar presentations
ICDL Software Applications - Database Concepts. Unit 6 Data and Data Representation Database Concepts –File Structure –Relationships Database Design –Data.
Advertisements

Introduction to arrays
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 2: Data types and addressing modes dr.ir. A.C. Verschueren.
Data in R. General form of data ID numberSexWeightLengthDiseased… 112m … 256f3.61 NA1… 3……………… 4……………… n91m5.1711… NOTE: A DATASET IS NOT A MATRIX!
R for Research Data Analysis using R Day1: Basic R Baburao Kamble University of Nebraska-Lincoln.
General Computer Science for Engineers CISC 106 Lecture 04 Roger Craig Computer and Information Sciences 9/11/2009.
Chapter 9: Arrays and Strings
Chapter 9: Arrays and Strings
Tutorial 11 Working with Operators and Expressions
Guide To UNIX Using Linux Third Edition
2 Systems Architecture, Fifth Edition Chapter Goals Describe numbering systems and their use in data representation Compare and contrast various data.
JavaScript, Third Edition
Introduction to Array The fundamental unit of data in any MATLAB program is the array. 1. An array is a collection of data values organized into rows and.
Structured Data Types. Date Types We have seen various data types –Integer, Real, Character, Logical All these types define data values of different kinds.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Exploring Formulas.
Java Unit 9: Arrays Declaring and Processing Arrays.
Chapter 4 MATLAB Programming Combining Loops and Logic Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 5. Loops are common in most programming languages Plus side: Are very fast (in other languages) & easy to understand Negative side: Require a.
Matlab tutorial course Lesson 2: Arrays and data types
IE 212: Computational Methods for Industrial Engineering
Automating Tasks with Visual Basic. Introduction  When can’t find a readymade macro action that does the job you want, you can use Visual Basic code.
Introduction to SPSS Edward A. Greenberg, PhD
REVIEW 2 Exam History of Computers 1. CPU stands for _______________________. a. Counter productive units b. Central processing unit c. Copper.
Introduction to to R Emily Kalah Gade University of Washington Credit to Kristin Siebel for development of much of this PowerPoint.
Numeric Processing Chapter 6, Exploring the Digital Domain.
Chapter 3: Data Types and Operators JavaScript - Introductory.
C Programming n General Information on C n Data Types n Arithmetic Operators n Relational Operators n if, if-else, for, while by Kulapan Waranyuwat.
Introduction to Arrays in Java Corresponds with Chapter 6 of textbook.
1 © 2002, Cisco Systems, Inc. All rights reserved. Arrays Chapter 7.
5 BASIC CONCEPTS OF ANY PROGRAMMING LANGUAGE Let’s get started …
MATLAB for Engineers 4E, by Holly Moore. © 2014 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected by Copyright.
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Arrays.
Term 2, 2011 Week 1. CONTENTS Problem-solving methodology Programming and scripting languages – Programming languages Programming languages – Scripting.
What does C store? >>A = [1 2 3] >>B = [1 1] >>[C,D]=meshgrid(A,B) c) a) d) b)
Data TypestMyn1 Data Types The type of a variable is not set by the programmer; rather, it is decided at runtime by PHP depending on the context in which.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
Matlab Basic. MATLAB Product Family 2 3 Entering & Quitting MATLAB To enter MATLAB double click on the MATLAB icon. To Leave MATLAB Simply type quit.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Ten Structures and Sequential Access Files.
Chapter 8 Arrays. A First Book of ANSI C, Fourth Edition2 Introduction Atomic variable: variable whose value cannot be further subdivided into a built-in.
© 2015 by Wade Rogers Introduction to R Cytomics Workshop December, 2015.
Java Software Solutions Lewis and Loftus Chapter 6 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Objects for Organizing Data.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Student Grades Application Introducing Two-Dimensional Arrays and RadioButton.
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
DATA TYPES, VARIABLES AND CONSTANTS. LEARNING OBJECTIVES  Be able to identify and explain the difference between data and information  Be able to identify,
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 2 Introduction to C++
Arrays Declaring arrays Passing arrays to functions Searching arrays with linear search Sorting arrays with insertion sort Multidimensional arrays Programming.
Arrays What is an array… –A data structure that holds a set of homogenous elements (of the same type) –Associate a set of numbers with a single variable.
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)
Arrays. Arrays are objects that help us organize large amounts of information.
Chapter 9 Introduction to Arrays Fundamentals of Java.
Lecture 11 Introduction to R and Accessing USGS Data from Web Services Jeffery S. Horsburgh Hydroinformatics Fall 2013 This work was funded by National.
Chapter 1 Computing Tools Variables, Scalars, and Arrays Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Introduction to R Chris Free. Introduction to R Free! Superior (if not comparable) to commercial alternatives Available on all platforms Not just for.
Chapter 9: Data types and data structures OCR Computing for A Level © Hodder Education 2009.
Working with data in R 2 Fish 552: Lecture 3. Recommended Reading An Introduction to R (R Development Core Team) –
Web Database Programming Using PHP
Introduction to R.
Web Database Programming Using PHP
Naomi Altman Department of Statistics (Based on notes by J. Lee)
Other Kinds of Arrays Chapter 11
Other Kinds of Arrays Chapter 11
Introduction to R Studio
C Basics.
Uploading and handling databases
National Scientific Library at Tbilisi State University
Numerical Descriptives in R
CSCI N207 Data Analysis Using Spreadsheet
Spreadsheets, Modelling & Databases
Introduction to Data Structure
Creating a dataset in R Instructor: Li, Han
Presentation transcript:

Baburao Kamble (Ph.D) University of Nebraska-Lincoln Data Analysis Using R Week2: Data Structure, Types and Manipulation in R

Understanding Data Observation ID DateTminWindType CropHealth Status 110/15/200925Type1Poor 211/01/200934Type2Improved 310/21/200928Type1Excellent 410/28/200952Type1Poor identifier date variable continuous variable nominal variable ordinal variable/ categorical Variable Data has different types and structure Data is facts and statistics collected together for reference or analysis

Importance of Data Type and Data Structure  The first step in any data analysis is the creation of a dataset from data sources.  Data sources can include text files, spreadsheets, statistical packages, and database management systems.  R contains a wide variety of structures for holding data, including scalars, vectors, arrays, data frames, and lists.  A small investment in learning Data Structure and Data Type will pays off in the long run.  You are going to use R for a years from now, so it’s better to learn a little bit about the underlying data type and data structures in R.

Data Type A data type is a (potentially infinite) class of concrete objects that all share some property. Example integers :[15,50,67] character data :[lion, cat, dog, food] R has a wide variety of data types including double, integer, complex, logical, character, factor, dates and times, Missing data (NaN) and Infinity

Data Type: Integer Integers are natural numbers. Integers are whole number with no decimal point with or without (+/-) sign.

Data Type: Double The Double data type provides the largest and smallest possible magnitudes for a number. Doubles are numbers like , 6.67 and 9.81.

Data Type: Complex A complex variable or value is usually represented as a pair of floating point numbers. In statistical data analysis you will not need them often for scientific calculations.

Data Type: Logical A logical data item is a primitive data structure that can assume the value of either “TRUE” or “False” Most commonly used logical operators are and, or and not represented by &, — and !, respectively.

Data Type: Character A character object is used to represent string values in R. A character object is represented by a collection of characters between double quotes (“ ”).

Data Type: Factor Conceptually, factors are variables in R which take on a limited number of different values; such variables are often referred to as categorical variables. Factor objects can be created from character objects or from numeric objects, using the function factor.

Data Type: Dates and Times Time series data and observational data needs calendar dates and times for analysis A character object is represented by a collection of characters between double quotes (“ ”).

Data Type: Missing data Missing data in R appears as NA(Not Available). NA is not a string or a numeric value, but an indicator of missing value. Recoding missing values Weather data or some data formats often use codes such as for not applicable (NA) values.

Data Type: Infinite values In R there are two function to check infinite values, is.finite and is.infinite. The first function returns TRUE if the number is finite; the second one returns TRUE if the number is infinite.

Lets talk about data structure

Data Structure Data structure are the ways of organizing data in R. Data structures play a central role in the data analysis using R You interact with data structures even more often than with function written in R. R has a wide variety of data structure including vectors (numerical, character, and logical), matrices, arrays, data frames, lists

Data Structure: Vectors Vectors can be thought of as contiguous cells containing data. Vectors are one-dimensional arrays that can hold numeric data, character data, or logical data. a is numeric vector, b is a character vector, and c is a logical vector.

Data Structure: Matrices and arrays Matrices are nothing more than 2-dimensional vectors. Arrays are similar to matrices but can have more than two dimensions. Arrays are one of the most efficient data structures in inserting, retrieving, indexing data. Arrays are a natural extension of matrices.

Data Structure: Data Frame A data frame is more general than a matrix in that different columns can contain different modes of data (numeric, character, etc.).

Data Structure: List Lists are the most complex of the R data types. A list allows you to gather a variety of (possibly unrelated) objects under one name.

Overview of data Structure

Questions ? Please practice commands in R