Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

could not find function "%>%" #1

Closed
alvinopler opened this issue Jun 17, 2024 · 8 comments
Closed

could not find function "%>%" #1

alvinopler opened this issue Jun 17, 2024 · 8 comments

Comments

@alvinopler
Copy link

in R 4.3.2 GUI 1.80 Big Sur ARM build (8281)
I get the error :
Error in seq(min(values(CHM_g), na.rm = T) + min_H, max(values(CHM_g), :
could not find function "%>%"
chm is from lidR

@DijoG
Copy link
Owner

DijoG commented Jun 17, 2024 via email

@alvinopler
Copy link
Author

Yes ! I loaded all libraries, now getting another error:
Error in (function (cond) :
error in evaluating the argument 'x' in selecting a method for function 'deepcopy': subscript out of bounds

@DijoG
Copy link
Owner

DijoG commented Jun 18, 2024 via email

@alvinopler
Copy link
Author

R version: 4.3.3
terra 1.7.78
lidR 4.1.1

library(lidR)
library(terre)
library(tidyverse)
library(sf)
library(data.table)
library(crayon)

LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
las <- readLAS(LASfile, select = "xyzr", filter = "-drop_z_below 0")
chm <- rasterize_canopy(las, 0.5, pitfree(subcircle = 0.2))
ttops <- get_TREETOPS(chm, 3)

Error in (function (cond) :
error in evaluating the argument 'x' in selecting a method for function 'deepcopy': subscript out of bounds

at every step of library I tried and it does not work giving the same error (except when loading tidyverse)

@DijoG
Copy link
Owner

DijoG commented Jun 24, 2024

There was a small compatible issue with terra::cells().
It should work now.

Please try:

remove.packages("TREETOPS")
devtools::install_github("DijoG/TREETOPS")

library(lidR)
library(terra)
library(tidyverse)
library(sf)
library(data.table)
library(crayon)

LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
las <- readLAS(LASfile, select = "xyzr", filter = "-drop_z_below 0")
chm <- rasterize_canopy(las, 0.5, pitfree(subcircle = 0.2))
plot(chm)
ttops <- TREETOPS::get_TREETOPS(chm, 25)
points(vect(ttops))

@alvinopler
Copy link
Author

Perfect thanks a lot !

@alvinopler
Copy link
Author

alvinopler commented Jun 24, 2024

Actually (sorry about that) got an error in finalize_treetops:

fttops <- TREETOPS::finalize_TREETOPS(ttops, 5, 5)
Error in st_as_sf():
ℹ In argument: ..2 = Z.
Caused by error:
! object 'Z' not found
Run rlang::last_trace() to see where the error occurred.

@DijoG
Copy link
Owner

DijoG commented Jun 26, 2024

Am truly sorry for the late reply, I completely missed the e-mail containing your request sent by github.

I forgot to adjust terra::cells() output attribute in the get_MARKER() function. It is done and
finalize_TREETOPS() works again.

All you have to do is:
remove.packages("TREETOPS")
devtools::install_github("DijoG/TREETOPS")

Thank you very much for using the tool and pointing out its errors!
Please let me know whether it works and I can close your issue.

Best,
Gergo

@DijoG DijoG closed this as completed Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants