mathesong / kinfitr

kinfitr: PET Kinetic Modelling Using R
Other
33 stars 7 forks source link

jsondata no longer part of pbr28 dataset #24

Open mikegilchrist opened 1 year ago

mikegilchrist commented 1 year ago

In case anyone else runs into this issue, I'm trying to follow your blog (post)[https://www.granvillematheson.com/post/nonlinear-modelling-using-nls-nlme-and-brms/], but am am getting the following error when initially looking at the data


data(pbr28)

pbr28$jsondata[[1]]$Metabolite
## Warning: Unknown or uninitialised column: `jsondata`.
## NULL

I looked at the code in data-raw/pbr28_data_extraction.R and found the following

bidsdat <- jsondat %>%
  group_by(Subjname, PETNo) %>%
  mutate(petinfo = map(jsondata,   jsondat2petinfo),
         blooddata = map(jsondata, jsondat2bd),
         tactimes = map(jsondata,  jsondat2tactimes)) %>%
  select(-jsondata)

I have forked your repo and tried removing that line, installing the package from my repo, but that didn't fix things. I was able to work around this problem by installing an earlier version of your package. using remotes::install_github("mathesong/kinfitr", ref = "6ba08e7")

mathesong commented 1 year ago

Hi Mike,

Thanks so much for raising this issue! That's on me: the blog post is out of date. I removed that jsondata column a while back because it wasn't being used for anything any longer within kinfitr, but I'd forgotten that the blog still referenced it. I'll update the blog post soon! Really appreciate the heads up!

I realise you managed to get hold of the data after all, but for anyone else who might end up here before I've had a chance to update the blog, you can now get the same data with the following code:

pfdat <- pbr28 %>%
    mutate(pf = map(blooddata, ~bd_extract(.x, "parentFraction"))) %>%
    select(PET, Subjname, PETNo, Genotype, pf)

Thanks again!