Isorix prepsources ()

54 views
Skip to first unread message

BEN JEMAA HSAN

unread,
Jan 3, 2022, 4:40:06 AM1/3/22
to IsoriX
Hello, Happy new year everyone !!
 I am  Tunisian phd student, I carried out isotopic analyzes on the feathers of Falco eleonorae and its prey within the Tunisian archipelago Galite. I want to assign these passerines to their wintering grounds using IsoriX. I encountered problems early on. I had  trouble using prepsources () for the GNIPdDataEUagg dataframe.
Do the sources work for GNIPDataDEUagg?
Thank you

Alexandre Courtiol

unread,
Jan 3, 2022, 4:54:37 AM1/3/22
to IsoriX
Happy new year and thanks for joining the group.

The point of the function `prepsources()` is to filter and aggregate unaggregated data such as those provided by GNIP.
For creating GNIPDataEUagg, I thus used `prepsources()` on a large dataset that I had previously downloaded from GNIP (but that I am not allowed to include in the package).
So if you are running `prepsources() on GNIPDataEUagg, I am not surprised it does not work since it would try to filter on columns no longer there after aggregation and it would try to aggregate data already aggregated.
Do you see the problem?

Of course I could try to include an error message more explicit than "Error in `[.data.frame`(data, , col_year) : undefined columns selected"... (I just added an issue on GH: https://github.com/courtiol/IsoriX/issues/139, so I will do that one day, but I don't consider that to be a priority).

++

BEN JEMAA HSAN

unread,
Jan 3, 2022, 8:32:34 AM1/3/22
to IsoriX
It's clear but some columns exist for example: elev_ lat_long.
GNIPDataEUagg data.PNG

Alexandre Courtiol

unread,
Jan 3, 2022, 8:39:26 AM1/3/22
to IsoriX
Of course, the aggregated dataset does contains some information such as the geographic coordinates.
Without that it would not be possible to create an isoscape.
So if your goal is simply to filter the aggregated dataset (e.g. by location), simply use usual R code to filter dataset but do not use `prepsources()` for this purpose.

For example if you want only the latitudes between 20 and 40 you can do:

GNIPDataEUagg_filtered <- GNIPDataEUagg[GNIPDataEUagg$lat > 20 & GNIPDataEUagg$lat < 40, ]

or using tidyverse:

library(tidyverse)
GNIPDataEUagg %>%
  filter(lat > 20, lat < 40) -> GNIPDataEUagg_filtered

++

BEN JEMAA HSAN

unread,
Jan 3, 2022, 4:02:30 PM1/3/22
to iso...@googlegroups.com
Thank you for your reply, good Idea i will use this.

--
You received this message because you are subscribed to the Google Groups "IsoriX" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isorix+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isorix/86b6c48b-cd8e-434d-ab66-ad911a48e096n%40googlegroups.com.

BEN JEMAA HSAN

unread,
Jan 4, 2022, 7:11:16 AM1/4/22
to IsoriX
hello, I tried filtering the data frame GNIPDataEUagg but it didn't work. still the error message:
isorix erreur.PNG

Alexandre Courtiol

unread,
Jan 4, 2022, 7:21:35 AM1/4/22
to IsoriX
Hi again,

Your error message is expected:
I wrote GNIPDataEUagg[GNIPDataEUagg$lat > 20 & GNIPDataEUagg$lat < 40, ]
but you wrote GNIPDataEUagg[GNIPDataEUagg$lat > 20 & GNIPDataEUagg$lat < 40]
There is only one extra comma in my call, but in R language the difference is key.

++

BEN JEMAA HSAN

unread,
Jan 5, 2022, 4:05:21 AM1/5/22
to IsoriX
Thank you so much for your answer and also sorry for the late reply. 
Reply all
Reply to author
Forward
0 new messages