Skip to content

Commit

Permalink
added test on presence of slash at the end of dirPath
Browse files Browse the repository at this point in the history
  • Loading branch information
MGousseff committed Sep 17, 2024
1 parent 874d2ee commit 04d4cc4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions R/importLCZvect.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ importLCZvect<-function(dirPath, file="rsu_lcz.geojson", output="sfFile", column
"101"="A","102"="B","103"="C","104"="D","105"="E","106"="F","107"="G"),
drop=T, verbose=FALSE){
if (!file.exists(dirPath)){stop(message="The directory set in dirPath doesn't seem to exist")}

fileName<-paste0(dirPath,"/",file)
if ( substr(dirPath, start=nchar(dirPath), stop = nchar(dirPath)) == "/") {
fileName<-paste0(dirPath,file)} else {
fileName<-paste0(dirPath,"/",file)
}

# select only the needed column, that is the unempty strings among column, geomID and confid
colonnes<-c(geomID,column,confid)
colonnes<-colonnes[sapply(colonnes,nchar)!=0]
Expand Down

0 comments on commit 04d4cc4

Please sign in to comment.