Relative R/programming/github novice here, so please excuse my ignorance.
I’m trying to extract a subset of line segments in a line segment pattern based upon a window. Subset.psp aka Extract.psp aka [.psp almost does what I want, except that I would like to exclude the line segments that cross the boundary of the window rather than clipping them.
Example: subset the psp “d” based on the window “eroded” to generate a new psp called “deroded”
> deroded <- d[eroded]
> plot(d, col="blue", main="deroded")
> plot(eroded, add=TRUE, col="red")
> plot(deroded, add=TRUE, col="green")
I am wondering if I can copy most of the functionality of subset.psp and just figure out how to change the trimming part of the function. Now comes the ignorant part: I can’t find the source code for subset.psp. I’ve tried searching on GitHub and in RStudio.
> spatstat:::subset.psp
Error in get(name, envir = asNamespace(pkg), inherits = FALSE) : object 'subset.psp' not found
> getAnywhere(subset.psp)
no object named ‘subset.psp’ was found
I've looked at How can I view the source code for a function?, but I'm having trouble understanding which of the commands apply to subset.psp. What is the proper syntax?
Alternatively, is there a different function or work-around I can use to do this?