You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@edzer thanks for the great package! It's already simplifying and improving my R/GIS workflows.
When dropping the geometry column with st_geometry(obj) <- NULL, the brute-force coercing of the table to a data.frame using data.frame(x) (sf.R line 147) will change the names. Consider using as.data.frame(x) instead, or setting check.names = FALSE.
> test_df <- data.frame(`Some letters` = letters[1:10],
+ x = 1:10,
+ y = 11:20,
+ check.names = F)
> test_df
Some letters x y
1 a 1 11
2 b 2 12
3 c 3 13
4 d 4 14
5 e 5 15
6 f 6 16
7 g 7 17
8 h 8 18
9 i 9 19
10 j 10 20
>
> test_df %<>% sf::st_as_sf(coords = c("x", "y"))
> test_df
Simple feature collection with 10 features and 1 field
geometry type: POINT
dimension: XY
bbox: xmin: 1 ymin: 11 xmax: 10 ymax: 20
epsg (SRID): NA
proj4string: NA
Some letters geometry
1 a POINT(1 11)
2 b POINT(2 12)
3 c POINT(3 13)
4 d POINT(4 14)
5 e POINT(5 15)
6 f POINT(6 16)
7 g POINT(7 17)
8 h POINT(8 18)
9 i POINT(9 19)
10 j POINT(10 20)
>
> sf::st_geometry(test_df) <- NULL
> test_df
Some.letters
1 a
2 b
3 c
4 d
5 e
6 f
7 g
8 h
9 i
10 j
>
> # Demonstrating as.data.frame(x)
> test_df <- data.frame(`Some letters` = letters[1:10],
+ x = 1:10,
+ y = 11:20,
+ check.names = F)
> data.frame(test_df)
Some.letters x y
1 a 1 11
2 b 2 12
3 c 3 13
4 d 4 14
5 e 5 15
6 f 6 16
7 g 7 17
8 h 8 18
9 i 9 19
10 j 10 20
> as.data.frame(test_df)
Some letters x y
1 a 1 11
2 b 2 12
3 c 3 13
4 d 4 14
5 e 5 15
6 f 6 16
7 g 7 17
8 h 8 18
9 i 9 19
10 j 10 20
The text was updated successfully, but these errors were encountered:
@edzer thanks for the great package! It's already simplifying and improving my R/GIS workflows.
When dropping the geometry column with
st_geometry(obj) <- NULL
, the brute-force coercing of the table to a data.frame usingdata.frame(x)
(sf.R line 147) will change the names. Consider usingas.data.frame(x)
instead, or settingcheck.names = FALSE
.The text was updated successfully, but these errors were encountered: