[R] Import multiple tif raster

Ivan Krylov |kry|ov @end|ng |rom d|@root@org
Thu Apr 18 19:54:53 CEST 2024

В Thu, 18 Apr 2024 19:04:04 +0200
<sibylle.stoeckli using gmx.ch> пишет:

> Solution: direct and full path to the .tif files.
> I confused back and forward slash

Congratulations on solving the problem yourself!

Here's a few more options that could be useful in the future:

1. Double the backslashes. Between single quotes ('...') and double
quotes ("..."), backslashes have a special meaning. This makes it
possible to enter characters without typing them directly (e.g. '\uf6'
results in "ö") or put quotes inside quoted strings (e.g. message('\'')
prints a single quote), but in order to mean \, you have to type \\:

path = "C:\\Users\\Sibylle Stöckli\\Desktop\\NCCS_Impacts_Lot2_2022\\InVEST\\Species_Input\\valpar_bee_presence"

2. Use the special "raw character constant" syntax where backslashes
don't have a special meaning:

path = r"{C:\Users\Sibylle Stöckli\Desktop\NCCS_Impacts_Lot2_2022\InVEST\Species_Input\valpar_bee_presence}"

These two options are explained in help(Quotes).

3. Instead of typing the path, use choose.dir() (Windows only, I think)
and select it interactively. You can print() the return value and copy
and paste it into the script later.

Best regards,

More information about the R-help mailing list