I have a question about reading certain files in a folder. For example, there are files in the folder "wind_grids", with file names as wind_lat1_lon1, wind_lat1_lon2, wind_lat1_lon3, ..., wind_lat2_lon1, wind_lat2_lon2, wind_lat2_lon3, .... Now I have another excel file with two columns: longitude, latitude. I want to exclude these coordinates in the excel file that appear in the wind_grids folder, because these grids are not necessary to show up. How to realize this? Thanks for your help.
I think this can be done by applying string manipulations to the list of files, but we would need some sample data to provide a practical example, could you ask this with a minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.
If you've never heard of a reprex before, you might want to start by reading this FAQ:
EDIT: The solution I have in mind would be similar to this
Thanks, the sample data works. However, there are a lager number of files in the "wd.files" folder, and some have names like "wind_40.1250_-105.5000", "wind_41.0500_-106.5000", etc. And in the "excel_df" data frame, the coordinates are 40.125, -105.5, etc., so is there a way to keep four decimal spaces when reading the excel_df? This way, the str_detect function can recognize all corresponding string names. Thanks again.