slice2df: Retreiving Population Distribution at Given Time

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/slice2df.R

Description

Summarises the Input Data Frame by Area and an Optional Grouping Variable

Usage

1
slice2df(x, var1, var2)

Arguments

x

a data.frame object

var1

a character vector of length 1, indicating the name of the column in 'x' that contains area codes or names. This argument must be provided.

var2

an optional character vector of length 1, indicating the name of a grouping variable

Details

The result of the slice function shows where people exist at a given time in the form of data.frame, and each person is displayed in one row. slice2df is used when you want to aggregate these results the way you want.

Specifically, slice2df is a function indicating how many people exist for each space unit through x given as a result of the slice function, and additional classification can be performed by demographic characteristics through var2.

In other words, the result of slice2df is data.frame indicating how many populations exist in each area at a specific time, and this is a form that can be used directly in a function that measures spatial segregation inside a seg package.

However, slice2df should be noted that when the spatial unit of the data of the initially given ASpace class is measured in points or very small spatial unit, the number of all regions may appear as one.

Value

A data.frame that is suitable for the functions in the seg package

Author(s)

Seong-Yun Hong (syhong@khu.ac.kr)

See Also

seg, dissim

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# load data
data(slicedata)

# run slice function to create suitable data.frame
result1 <- slice(slicedata, at = 800)
result2 <- slice(slicedata, at = 1400)
result3 <- slice(slicedata, at = 2000)

# converting the result
slice2df(result1, "location")
slice2df(result2, "location")
slice2df(result3, "location")

syunhong/slice documentation built on Feb. 7, 2021, 4:55 p.m.