Yes this is point geometry, as you expect. I'm unclear on how to pipe the result of the read.csv() function. I've consulted the hyperlink of R documentation on how to use the sf::st_as_sf() function but I wasn't able to yield much better results.
You will see that I've made progress but I'm still getting an error citing no "simple features geometry column present".
> #The colClasses parameter of this function keeps in necessary leading zeroes when read from Excel to R program
> OMAR_RoofFanCodes3 <- read.csv("H:/NYCHA_Analysis/OMAR_MaximoRF_Reconciliation/OMAR_RoofFanCode1.29.2020.csv", colClasses= c(LOCATIO = "character"))
> #Apply the class function to each variable of the dataset simultaneously
> sapply(OMAR_RoofFanCodes3, class)
NO BOROUGH DVLMT BLDG_NUM LOCATIO Bldg_RF_CT RoofVentID Longitude Latitude
"integer" "factor" "factor" "factor" "character" "integer" "factor" "numeric" "numeric"
geometry
"factor"
> glimpse(OMAR_RoofFanCodes3)
Observations: 9,540
Variables: 10
$ NO <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, ...
$ BOROUGH <fct> BROOKLYN, BROOKLYN, MANHATTAN, MANHATTAN, MANHATTAN, MANHATTAN, MANHATTAN, MANHATTAN, M...
$ DVLMT <fct> WILLIAMSBURG, WILLIAMSBURG, EAST RIVER, ELLIOTT, ELLIOTT, ELLIOTT, ELLIOTT, ELLIOTT, EL...
$ BLDG_NUM <fct> 21, 21, 1, 1, 1, 2, 2, 3, 3, 4, 4, 1, 3, 6, 8, 9, 10, 12, 14, 17, 19, 20, 22, 25, 27, 8...
$ LOCATIO <chr> "2021", "2021", "9001", "15001", "15001", "15002", "15002", "15003", "15003", "15004", ...
$ Bldg_RF_CT <int> 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, ...
$ RoofVentID <fct> 002.21.01, 002.21.02, 009.01.01, 015.01.01, 015.01.02, 015.02.01, 015.02.02, 015.03.01,...
$ Longitude <dbl> -73.94395, -73.94396, -73.94032, -74.00208, -74.00206, -74.00267, -74.00266, -74.00211,...
$ Latitude <dbl> 40.70940, 40.70940, 40.78838, 40.74981, 40.74971, 40.74911, 40.74914, 40.74887, 40.7489...
$ geometry <fct> "-73.9439472338482, 40.709396333482", "-73.9439644487238, 40.7094003293267", "-73.94032...
> OMAR_RoofFanCodes3 %>%
+ st_as_sf(coords= c("x"= "Longitude", "y"= "Latitude"), crs = 4326)
Simple feature collection with 9540 features and 7 fields
geometry type: POINT
dimension: XY
bbox: xmin: -74.16494 ymin: 40.57183 xmax: -73.75014 ymax: 40.88714
epsg (SRID): 4326
proj4string: +proj=longlat +datum=WGS84 +no_defs
First 10 features:
NO BOROUGH DVLMT BLDG_NUM LOCATIO Bldg_RF_CT RoofVentID geometry
1 1 BROOKLYN WILLIAMSBURG 21 2021 2 002.21.01 POINT (-73.94395 40.7094)
2 2 BROOKLYN WILLIAMSBURG 21 2021 2 002.21.02 POINT (-73.94396 40.7094)
3 3 MANHATTAN EAST RIVER 1 9001 1 009.01.01 POINT (-73.94032 40.78838)
4 4 MANHATTAN ELLIOTT 1 15001 2 015.01.01 POINT (-74.00208 40.74981)
5 5 MANHATTAN ELLIOTT 1 15001 2 015.01.02 POINT (-74.00206 40.74971)
6 6 MANHATTAN ELLIOTT 2 15002 2 015.02.01 POINT (-74.00267 40.74911)
7 7 MANHATTAN ELLIOTT 2 15002 2 015.02.02 POINT (-74.00266 40.74914)
8 8 MANHATTAN ELLIOTT 3 15003 2 015.03.01 POINT (-74.00211 40.74887)
9 9 MANHATTAN ELLIOTT 3 15003 2 015.03.02 POINT (-74.0021 40.7489)
10 10 MANHATTAN ELLIOTT 4 15004 2 015.04.01 POINT (-74.00115 40.74926)
> View(OMAR_RoofFanCodes3)
> st_write(OMAR_RoofFanCodes3, "NYCHA_RoofFans.shp")
Error in st_sf(x, ..., agr = agr, sf_column_name = sf_column_name) :
no simple features geometry column present