如何更改R中的filepath中的变量?
我有此采样代码,我想在“ 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论