0

I had seen this this but even after I remove the space or a separator in between the file name and appended number, I keep in getting the same error. Are there any suggestions for this:

execGRASS("r.in.gdal",flags=c("o","overwrite"),
parameters=list(input=paste(path, paste("T", as.character(i),
sep=""), sep="/"), output=paste("T", as.character(i), sep="")))

ERROR 4: `F:/Desktop/Folder/T1' does not exist in the file system,
and is not recognised as a supported dataset name.

I also checked if that particular file T1 doesn't exist in the path. But surprisingly it does exist.

OS: Windows 10, Grass Version: 7.0

Thanks.

Community
  • 1
  • 1
  • It doesn't look like an error from R, but the backtick before the "F" might indicate some issue with an external (to R) package. You should: a) post more complete code, including the library calls, and b) post the results of list.files("F:/Desktop/Folder/T1") – IRTFM Jan 23 '16 at 16:46
  • Please tell us which package you are using (spgrass or rgrass7?) and show that the *folder* exists via `dir.exists` – Robert Hijmans Jan 23 '16 at 22:54
  • @42 The script is really lengthy, so, I had to post the important part of it. But I will do it. but as you asked for the list.files(), here they are: > list.files("F:/Srinu/RLP_Thesis") [57] "SSP_GK3.shx" "T 1.tif" [59] "T_1.tif" "T1.tif" [61] "UC" "UC.Rdata" [63] "UC_Extraction_Manual.R" "UC_Poly.dbf" [65] "UC_Poly.prj" "UC_Poly.qpj" [73] "URC_rast.tif" – flyingclouds Jan 24 '16 at 12:59
  • @RobertH I am currently using rgrass7. and dir.exists yielded some funny results, here they are: > dir.exists("F:/Srinu/RLP_Thesis/T_1") [1] FALSE > dir.exists("F:/Srinu/RLP_Thesis") [1] TRUE But the list.files() says, the file exists in the lib. – flyingclouds Jan 24 '16 at 13:03
  • I guess the problem here is, I have to input the file type i.e. "GTiff", can someone help me how to input the file type in the above code? – flyingclouds Jan 24 '16 at 14:46
  • Rather than adding this to the comments, please edit your question. – Robert Hijmans Jan 24 '16 at 20:03

1 Answers1

0

Your list.files("F:/Srinu/RLP_Thesis") does not show a file called F:/Desktop/Folder/T1. In fact there are unrelated paths.

Either way, it should probably be something like F:/Desktop/Folder/T1.tif

If you are confused about how to create filenames through code, first test your function with actual filenames. You probably are looking for something like:

input = paste0(path, "/T", i, ".tif")
Robert Hijmans
  • 40,301
  • 4
  • 55
  • 63