Dear all, I have a code that looks like the following (I am sorry that this is not a reproducible example)
indexSkipped<-NULL ....code Skipped that might alter indexSkipped if (length(indexSkipped)==0) spatial_structure<-spatial_structures_from_measurements(DataList[[i]]$Lon,DataList[[i]]$Lat,meanVector) else spatial_structure<-spatial_structures_from_measurements(DataList[[i]]$Lon[-indexSkipped],DataList[[i]]$Lat[-indexSkipped],meanVector) # What I am doing here is that I am processing files. Every files has a measurement table and Longtitude and Latitude fields. If one file is marked as invalid I keep a number of of the skipped index so to remove the element of the Longtitude and Latitide vectors. 1) That works correct, I was just wondering if it would be possible to remove some how the given if statement and initialize the indexSkipped in such a way so the DataList[[i]]$Lon[-indexSkipped],DataList[[i]]$Lat[-indexSkipped] do nothing, aka remove no element, in case the indexSkipped remains unchanged (in its initial value). 2) When u define a variable as empty, I usually use NULL, how I can check afterwords if that holds or not. If I use the (indexSkipped==NULL) logical(0) this does not return true or false. How I can do that check? Iwould like to thank you in advance for your help B.R Alex [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.