nickmckay / GeoChronR

Development repository for GeoChronR
http://nickmckay.github.io/GeoChronR/
MIT License
32 stars 3 forks source link

R 4.2: _R_CHECK_LENGTH_1_CONDITION_ related error #68

Closed ggebbie closed 2 years ago

ggebbie commented 2 years ago

https://github.com/nickmckay/GeoChronR/blob/1be1ebe4803da975111229aecd8e39d555c00e8a/R/bacon.lipd.R#L377

R 4.2

variable cc is a collection (sorry, don't know my R terminology!)

returns error Error in if (is.na(cc)) { : the condition has length > 1

I thought this would be a solution, add to .Renviron _R_CHECK_LENGTH_1_CONDITION_=false

but I haven't gotten it to work yet.

nickmckay commented 2 years ago

cc is a variable that gets passed on to Bacon, and refers to the calibration curve to use. It should be an integer.

Calibration curve for C-14 dates: cc=1 for IntCal20 (northern hemisphere terrestrial), cc=2 for Marine20 (marine), cc=3 for SHCal20 (southern hemisphere terrestrial). For dates that are already on the cal BP scale use cc=0.

Let me know if this doesn't solve the problem

ggebbie commented 2 years ago

Nick, thanks so much for the reply! I confirm that the code runs on R 4.2 with cc = 0.

Perhaps this is a different issue, but is it possible to use a calibration curve for some dates and then to specify others using a different calibration curve or manually? I think this is where the collection of cc values came from.

nickmckay commented 2 years ago

It depends. It's pretty straight forward to run a model that has a mix of 14C and calibrated ages, and it will calibrate the 14C ages using the designated curve, and treat the other ages as a normal distribution. There are a couple ways to do this, but the easiest is to have separate age14C and ageCalibrated columns in the file, and it should handle it properly. If there's a mix of 14C ages that should be calibrated with different calibration curves, I don't think that's a use case that's come up yet. Also, you can use different reservoir offsets for different ages too, if that would be helpful

ggebbie commented 2 years ago

sounds good, I believe that this information is also encoded in the LiPD file. I will check the Bacon log output to make sure it's doing the right thing, and just use one value in cc. Thanks again and feel free to close this issue if you like.

nickmckay commented 2 years ago

Sounds good!