Data Analysis & Data Science With R

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 6

Al.I.

Cuza University of Iai


Faculty of Economics and Business Administration
Department of Accounting, Information Systems and
Statistics

Data Analysis & Data


Science with R
Basic Data Management
By Marin Fotache

R script associated with this


presentation
04b_basic_data_management.R

http://1drv.ms/1LUUuG3

Topics

Adding column/variables

New columns defined through expresssions

Function transform

Removing

variables (columns)

Directly, e.g. invoices_2 <- invoices_1[-10]

Directly, e.g. df$column.to.remove <- NULL

Indirecty (by copying a data frame and specifiyng the


variables NOT to be removed)

With function remove.vars from package gdata

With function VarDrop from package DataCombine

Topics (cont.)

Recoding variables (values)

Recode with filter (subsetting)

Divide continuous variable x into factor with n levels:

cut(x, n)

Divides a continuous variable x into n intervals by


selecting n+1 equally spaced rounded values (pretty
breakpoints): pretty(x, n)

Renaming

variables (columns)

With function names

With function rename from package reshape

With function rename.vars from package gdata

Topics (cont.)
Change

order of the columns

When copy a data frame

With function MoveFront from package DataCombine

Subsetting

data frames

Using square brackets [ ]

With function which

With function subset

Sorting

data

Unique

and duplicated values

Data
Basic

sampling
"descriptive" functions

Web sites/video-tutorials for Basic


Data Management
Lecture

2b: Subsetting

https://www.youtube.com/watch?v=hWbgq
zsQJF0&index=9&list=PLjTlxb-wKvXPqyY3
FZDO8GqIaWuEDy-Od
Subsetting Data in R With Square
Brackets and Logic Statements (R Tutorial
1.6)
https://www.youtube.com/watch?v=jGf7W
Nh-LX8&list=PLqzoL9-eJTNBDdKgJgJzaQcY
6OXmsXAHU&index=7
Subsetting Data in R With Square

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy