Comments (9)
Hi @kellyecoles - are you sure the coordinates are in decimal degrees? That's a common problem that crops up. Also, if all the points are within 0.2 km of each other, then you might also get this error.
from spthin.
HI @kellyecoles and @mlammens - I have had exactly this problem tonight. I successfully used that code yesterday and tonight I am getting the above error. I have two data sets for two different projects. Yesterdays data set would not work tonight even though it worked yesterday. My coordinates are in decimal degrees.
I ended up getting into QGIS and thinning by hand. Tedious but the job is done.
I would still love to solve this problem.
from spthin.
That's pretty strange @RuthPalsson . I don't suppose you could share the points, or a subset of them, so I can trouble shoot the problem?
from spthin.
Thanks for your reply @mlammens
My data. This set worked a few days ago and now will not. I get this error message:
Beginning Spatial Thinning.
Script Started at: Wed Mar 08 08:15:48 2023Error in .subset2(x, i, exact = exact) :
attempt to select less than one element in get1index
My code:
thin(
loc.data = input,
lat.col = "latitude", long.col = "longitude",
spec.col = "species",
thin.par = 1, reps = 10,
locs.thinned.list.return = TRUE,
write.files = TRUE,
max.files = 10,
out.dir = "outputs/", out.base = "Cineatrip",
write.log.file = TRUE,
log.file = "Cineatrip.txt"
)
from spthin.
@mlammens, this is working perfectly this morning!! Who knows what was going on!!
from spthin.
Odd. Usually I've seen that error when the points are too close to each other (relative to the thin distance), but that does not appear to be the case here. It is a random algorithm, so I suppose it's not totally impossible for it to work sometimes but not others. I'll have to tweak this going forward.
from spthin.
@mlammens, the data I sent you had worked initially but then didn't. I had two other sets of data that I knew had locs closer than 0.2 km - I had thinned them manually in QGIS and then yesterday, I got spThin to thin both of them to <1 km apart.
Is it in the dodumentation that points need to be >0.2 km apart? I did not notice it.
Thanks for your help.
from spthin.
Hii, I am trying to work with a certain species for spatial thinning and am stuck with the same error. My CSV file has a species column, lat and long columns with values in decimal.
head(hyp)
Species Latitude Longitude X X.1
1 M. (L.) Kuntze -6.563056 147.0306 NA NA
2 M. (L.) Kuntze -7.058333 146.6750 NA NA
3 M. (L.) Kuntze -9.391667 147.3083 NA NA
4 M. (L.) Kuntze -6.758333 147.0083 NA NA
5 M. (L.) Kuntze -5.250000 145.7500 NA NA
6 M. (L.) Kuntze -5.750000 145.1667 NA NA
thin(
- loc.data <- subset_hyp,
- lat.col = "LATITUDE",
- long.col = "LONGITUDE",
- spec.col = "SPECIES",
- thin.par = 1,
- rep = 100,
- locs.thinned.list.return = FALSE,
- write.files = TRUE,
- max.files = 1,
- out.dir = ("~/dissertation/Lifeform article'24"),
- out.base = "thinned data",
- write.log.file = TRUE,
- log.file = "spatial_thin_hyp.csv",
- verbose = TRUE
- )
Beginning Spatial Thinning.
Script Started at: Wed Jan 31 16:42:09 2024Error in .subset2(x, i, exact = exact) :
attempt to select less than one element in get1index
Would be of great help if anyone could help me out on this. Thanks in advance!
from spthin.
@riyapakhre , I think this error might be from the labels your using for the Latitude / Longitude columns in the data set being different from the names you are using in the thin
function -- i.e., "LATITUDE" and "LONGITUDE". Case matters in R.
from spthin.
Related Issues (20)
- Identify "best" results from heuristic thinning? HOT 1
- write.SpThin did not save to dir HOT 1
- Make species column optional HOT 1
- Check that out.dir is optional in next version
- SUGGESTION - output spatial data object
- thin.par HOT 3
- Error in .subset2 HOT 7
- thin multiple species based on spec.col HOT 3
- Output additional columns? HOT 3
- Unexpectedly (?) long run time for a large dataset HOT 2
- Location points moving HOT 4
- thin.algorithm doesn't work with tibbles
- Avoid full distance matrix within thin.algorithm() to allow for thin() on a large number of points? HOT 9
- error HOT 1
- Using ENMeval to tune Maxent settings and getting exactly the same results for two disjunct species HOT 1
- Error (error: In path.expand(path)) from spThin::thin(..., write.files = TRUE) resulting from long file names where a dataset with where "spec.col" has many levels
- Is there a way to keep the most recent record? HOT 1
- what input projection for spThin HOT 2
- Help Please: I get this error: Error in .subset2(x, i, exact = exact) : attempt to select less than one element in get1index HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spthin.