0% found this document useful (0 votes)
46 views6 pages

Data Analysis & Data Science With R

This document discusses topics related to basic data management in R, including adding and removing variables, recoding variables, renaming variables, changing the order of columns, subsetting data frames, sorting data, and identifying unique and duplicated values. It provides an overview of functions and techniques for performing these common data management tasks in R, such as using expressions to add new columns, removing columns directly or with functions, recoding variables with cut() and pretty(), renaming with names() and rename(), subsetting with square brackets and subset(), and sorting data. Web links to video tutorials on related topics like subsetting are also included.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views6 pages

Data Analysis & Data Science With R

This document discusses topics related to basic data management in R, including adding and removing variables, recoding variables, renaming variables, changing the order of columns, subsetting data frames, sorting data, and identifying unique and duplicated values. It provides an overview of functions and techniques for performing these common data management tasks in R, such as using expressions to add new columns, removing columns directly or with functions, recoding variables with cut() and pretty(), renaming with names() and rename(), subsetting with square brackets and subset(), and sorting data. Web links to video tutorials on related topics like subsetting are also included.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 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