[R] 'Double to logical' error

John Tully John@Tu||y @end|ng |rom nott|ngh@m@@c@uk
Tue Sep 7 12:37:41 CEST 2021


Thank you

I ran:

```{r}
rlang::last_error()
```

Here is the output:

<error/tibble_error_assign_incompatible_type>
Assigned data `single_study_df` must be compatible with existing data.
ℹ Error occurred for column `third_ventricle_mn`.
x Can't convert from <double> to <logical> due to loss of precision.
* Locations: 1, 2.
Backtrace:
Run `rlang::last_trace()` to see the full context.




________________________________
From: Bill Dunlap <williamwdunlap using gmail.com>
Sent: Monday, September 6, 2021 5:36 PM
To: John Tully <mszjt1 using exmail.nottingham.ac.uk>
Cc: r-help using R-project.org <r-help using r-project.org>; McCutcheon, Robert <robert.mccutcheon using kcl.ac.uk>
Subject: Re: [R] 'Double to logical' error

>  Run `rlang::last_error()` to see where the error occurred

What did rlang::last_error() show?

-Bill


On Mon, Sep 6, 2021 at 9:19 AM John Tully <John.Tully using nottingham.ac.uk<mailto:John.Tully using nottingham.ac.uk>> wrote:
Dear colleagues
>
> in conducting a meta-analysis (of MRI data) I am running into the repeated issue:
>
> Error: Assigned data `single_study_df` must be compatible with existing data. ℹ Error occurred for column `accumbens_sd`. x Can't convert from <double> to <logical> due to loss of precision. * Locations: 1, 2. Run `rlang::last_error()` to see where the error occurred.
>
> This follows the commands
>
> for (region in regions){
>    for (study in unique(df$studyid)){
>      single_study_df <- df %>% filter(studyid==study)
>      if (is.na<http://is.na>(single_study_df[sprintf('%s_mn', region)][[1]]) & !is.na<http://is.na>(single_study_df[sprintf('%s_mn_l', region)])){
>        df <- calc_bilat(study, region, r, df)
>      }
>    }
> }
>
>
> My colleague (cc'd) believed it may be an issue with tidyverse version, however using an older version (1.2.1), the issue persists. note 'accumbens' is the first of many columns so I suspect this is why it flags this up.
>
> I would greatly value your input on this matter
>
> Kind regards
>
> John Tully
>
>
>
>




This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please contact the sender and delete the email and
attachment.

Any views or opinions expressed by the author of this email do not
necessarily reflect the views of the University of Nottingham. Email
communications with the University of Nottingham may be monitored
where permitted by law.





        [[alternative HTML version deleted]]

______________________________________________
R-help using r-project.org<mailto:R-help using r-project.org> mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please contact the sender and delete the email and
attachment. 

Any views or opinions expressed by the author of this email do not
necessarily reflect the views of the University of Nottingham. Email
communications with the University of Nottingham may be monitored 
where permitted by law.





	[[alternative HTML version deleted]]



More information about the R-help mailing list