Skip to contents

This function calculates the centroid (geometric center), the distance from a reference point to the centroid (centroidal distance), and the area moment (Q) of a given shape or set of data points.

Usage

calc_centroid(df_input_response)

Arguments

df_input_response

A `data.frame` containing referent names and their associated responses, typically recorded by the listener. For example data, run `data("df_input_response_example")` or `data("df_input_response_previous_example")`.

Value

A `list` with the following components:

centroid

A numeric vector of length 2, providing the x and y coordinates of the centroid. This represents the geometric center of the input data.

distance

A numeric value representing the centroidal distance, which is the distance between a reference point and the calculated centroid.

moment

A numeric value for the area moment (often referred to as area Q), representing the product of the area and the distance to a reference axis.

Examples

data("df_input_response_example")
calc_centroid(df_input_response = df_input_response_example)
#> $centroid
#> [1]  1.33 -2.67
#> 
#> $distance
#> [1] 2.98
#> 
#> $moment
#> [1] 649.44
#>