── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.4 ✔ readr 2.1.5
✔ forcats 1.0.0 ✔ stringr 1.5.1
✔ ggplot2 3.5.2 ✔ tibble 3.2.1
✔ lubridate 1.9.4 ✔ tidyr 1.3.1
✔ purrr 1.0.4
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Linking to GEOS 3.13.0, GDAL 3.10.0, PROJ 9.5.1; sf_use_s2() is TRUE
Loading required package: viridisLite
Attaching package: ‘ape’
The following object is masked from ‘package:dplyr’:
where
Loading required package: maps
Attaching package: ‘maps’
The following object is masked from ‘package:viridis’:
unemp
The following object is masked from ‘package:purrr’:
map
d =read_csv("../data/affix_adposition.csv")d %>%head()
Rows: 488 Columns: 8
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (4): Glottocode, Name, Macroarea, Family
dbl (4): Longitude, Latitude, Affix, Adposition
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
A tibble: 6 × 8
Glottocode
Name
Macroarea
Longitude
Latitude
Family
Affix
Adposition
<chr>
<chr>
<chr>
<dbl>
<dbl>
<chr>
<dbl>
<dbl>
aari1239
Aari
Africa
36.583333
6.000000
Afro-Asiatic
2
1
abkh1244
Abkhaz
Eurasia
41.000000
43.083333
Northwest Caucasian
4
1
acha1250
Achagua
South America
-72.250000
4.416667
Arawakan
4
1
acol1236
Acholi
Africa
32.666667
3.000000
Eastern Sudanic
4
2
west2632
Acoma
North America
-107.583333
34.916667
Keresan
4
1
adio1239
Adioukrou
Africa
-4.583333
5.416667
Niger-Congo
5
1
cross_classification <- d %>%count(Affix, Adposition, name ="Count") %>%pivot_wider(names_from = Adposition, values_from = Count, values_fill =0) %>%rename(postposition =`1`, preposition =`2`) cross_classification
A tibble: 5 × 3
Affix
postposition
preposition
<dbl>
<int>
<int>
2
175
53
3
34
30
4
42
52
5
21
38
6
7
36
ld_geo <- d %>%st_as_sf(coords =c("Longitude", "Latitude"), crs =4326)
# Change to Equal Earth projection centered at 160°Etarget_crs <-st_crs("+proj=eqearth +lon_0=160 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs")
Rows: 1508 Columns: 7
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (3): Glottocode, Macroarea, Family
dbl (4): nSegments, population, Longitude, Latitude
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Attaching package: ‘scales’
The following object is masked from ‘package:phytools’:
rescale
The following object is masked from ‘package:viridis’:
viridis_pal
The following object is masked from ‘package:purrr’:
discard
The following object is masked from ‘package:readr’:
col_factor
Warning message:
“The `size` argument of `element_line()` is deprecated as of ggplot2 3.4.0.
ℹ Please use the `linewidth` argument instead.”
`geom_smooth()` using formula = 'y ~ x'
`geom_smooth()` using formula = 'y ~ x'