如何更改R中的filepath中的变量?

发布于 2025-01-21 11:58:12 字数 519 浏览 2 评论 0原文

我有此采样代码,我想在“ s2_b8”(月份,瓷砖..)之外更改多个变量,而不必更改整个filepath,而只是变量。例如,对于“月”,我只需要写“ 01”,如果我想参加一月的.tif,

`month <- "01"

tile <- "T39LTF"

name_im <- "AMBARO_T39LTF"

S2_B8 = raster("D:/Tuiles_José/2021/'month'/'name_im'/images/SENTINEL2X_2021+'month'+01-000000-000_L3A_+'tile'+_C_V2-2/SENTINEL2X_2021+'month'+01-000000-000_L3A_+'tile'+_C_V2-2_FRC_B8.tif",values=T)
crs(S2_B8)=crs("+init=epsg:32738")` 

我已经在spyder上使用 +'name_of_the_variable' +进行了此操作。该r由于语法错误而无法理解我的方式,

感谢您的帮助!

I have this sampled code where I want to change multiple variable outside of my filepath "S2_B8"(month,tile..) and do not have to the change the entire filepath just the variable. For example for "month" I will just have to write "01" if I wanted to take the .tif of January

`month <- "01"

tile <- "T39LTF"

name_im <- "AMBARO_T39LTF"

S2_B8 = raster("D:/Tuiles_José/2021/'month'/'name_im'/images/SENTINEL2X_2021+'month'+01-000000-000_L3A_+'tile'+_C_V2-2/SENTINEL2X_2021+'month'+01-000000-000_L3A_+'tile'+_C_V2-2_FRC_B8.tif",values=T)
crs(S2_B8)=crs("+init=epsg:32738")` 

I've already done this on spyder with adding +'name_of_the_variable'+ but it does not work with R. I think that R does not understand my way because of a syntaxic error

thanks for ur help !!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文