andrewcparnell / Bchron

A Bayesian radiocarbon chronology model with R
http://andrewcparnell.github.io/Bchron/
36 stars 10 forks source link

Bchronology seems to be ignoring ids argument #24

Closed cmbarton closed 3 years ago

cmbarton commented 3 years ago

When I set ids (to a factor) it doesn't seem to show up in the bchronology object produced anywhere.

andrewcparnell commented 3 years ago

Can you provide a reproducible example? They show up in the plots and summaries for me, but perhaps you're talking about somewhere else.

cmbarton commented 3 years ago

didn't work yesterday but works today. Yesterday, I was just getting date1, date2, etc for the labels even after I set the ids column. I am noticing that the plot works very very slowly, especially if the date curves are turned on. I have a column with 28 dates and it takes a very long time to plot

andrewcparnell commented 3 years ago

Glad it works today! Can you give an example of where it's working slowly? I'll see if it can be sped up.

cmbarton commented 3 years ago

Andy,

Here is the data set from the 2017 paper of mine and the new code (with ggplot calls now) I used to get the attached graphs. Without the date curves, the plot takes a second or two to render. With the curves, it takes several minutes.

As I noted in GitHub, I have the newest Mac OS (11.3.1), R, and bchron. I have an older but still useful Mac with 64 Gb RAM and a 4.2 GHz Quad-Core i7 processor (4 actual and 8 virtual cores).

Michael

Code:

LR.bchron = with( lariera.dates2,
Bchronology( ages=C14mean, ageSds = C14SD, calCurves = calib.curve, positions = depth, extractDate = 6000, positionThicknesses = thickness, jitterPositions = T, predictPositions = seq(.2,2.6, by=.1), ids = level))

Plot results using ggplot code

plot(LR.bchron, dateHeight = .1) + labs(x='calibrated age BP', y='depth (m below surface)', title='La Riera Age Depth Model' ) + geom_hline(yintercept = unique(lariera.dates2$depth), lwd=.1, lty = "solid", col='blue') + annotate("text", x=5000, y= unique(lariera.dates2$depth)-.05, label = paste("level ", unique(lariera.dates2$level.num)), size = 3, color="blue") + xlim(30000,5000) + theme_bw(base_size = 14) + theme(panel.grid.major.y = element_blank(), panel.grid.minor.y = element_blank())

Here is the plotted result.

Here is the data file:

On May 13, 2021, at 8:32 AM, Andrew Parnell @.***> wrote:

Can you provide a reproducible example? They show up in the plots and summaries for me, but perhaps you're talking about somewhere else.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/andrewcparnell/Bchron/issues/24#issuecomment-840641586, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACENLLZJY5N2GTLYFHUPTFTTNPWKHANCNFSM44ZTHQOQ.

andrewcparnell commented 3 years ago

Hi. Finally fixed the other one and getting round to this one - but I can't seem to see the data file? Can you re-send. (Or just use dput as advised previously).

Andrew

cmbarton commented 3 years ago

Here you go. I guess I can't put an RDA on GitHub.

Michael

On Jun 3, 2021, at 4:07 AM, Andrew Parnell @.***> wrote:

Hi. Finally fixed the other one and getting round to this one - but I can't seem to see the data file? Can you re-send. (Or just use dput as advised previously).

Andrew

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/andrewcparnell/Bchron/issues/24#issuecomment-853786509, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACENLL4GDGMETDUOVPYVE5LTQ5O6JANCNFSM44ZTHQOQ.

cmbarton commented 3 years ago

I see my email went to GitHub instead of you and I can't send an RDA. Here it is zipped to make it acceptable. lariera_dates.rda.zip

andrewcparnell commented 3 years ago

OK had a look through this data set. Looks like you've got non-unique IDs which is causing it to crash when plotting. I've updated Bchron to check for non-unique IDs and report an error.

Let me know if this fixed it or not.

Andrew

cmbarton commented 3 years ago

OK. Thanks much. I could not use the cool tricks you showed me for a double axis graph any more because they depended on using R base plotting routines and the new version uses ggplot2. I worked out an alternative way to do it.

Michael

On Jun 8, 2021, at 9:46 AM, Andrew Parnell @.***> wrote:

OK had a look through this data set. Looks like you've got non-unique IDs which is causing it to crash when plotting. I've updated Bchron to check for non-unique IDs and report an error.

Let me know if this fixed it or not.

Andrew

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/andrewcparnell/Bchron/issues/24#issuecomment-856928361, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACENLL3O4ZHMWGEWLAVAVBLTRZCOXANCNFSM44ZTHQOQ.

andrewcparnell commented 3 years ago

OK glad to hear it's all working for you now. Let me know if anything changes.