Re: [R] 'Double to logical' error

2021-09-07 Thread John Tully
thanks

i get a red bar to the left of all of this

for (indiv_meta in to_include){
  graph_results$estimate[j]=results_list[[indiv_meta]]$b
  graph_results$lb[j]=results_list[[indiv_meta]]$ci.lb
  graph_results$ub[j]=results_list[[indiv_meta]]$ci.ub
  graph_results$p[j]=results_list[[indiv_meta]]$pval
  a <- as.character(results_list[[indiv_meta]]$slab)
  #this reduces the 'k' printed on the graph for instancews where sibsamples 
counted as sepearte studies
  b <- substr( a, start = nchar(a) - 1 , stop = nchar(a)-1)
  num_dups = sum(b==".")/2
  graph_results$k[j]=as.integer(results_list[[indiv_meta]]$k)-num_dups
  j=j+1
}






rlang last trace gives this


Assigned data `single_study_df` must be compatible with existing data.
ℹ Error occurred for column `third_ventricle_mn`.
x Can't convert from  to  due to loss of precision.
* Locations: 1, 2.
Backtrace:
 █
  1. ├─global::calc_bilat(study, region, r, df)
  2. │ ├─base::`[<-`(...) aspd_funcs.r:11:2
  3. │ └─tibble:::`[<-.tbl_df`(...) aspd_funcs.r:11:2
  4. │   └─tibble:::tbl_subassign(x, i, j, value, i_arg, j_arg, 
substitute(value))
  5. │ └─tibble:::tbl_subassign_row(x, i, value, value_arg)
  6. │   ├─base::withCallingHandlers(...)
  7. │   └─vctrs::`vec_slice<-`(`*tmp*`, i, value = value[[j]])
  8. │ └─(function () ...
  9. │   └─vctrs:::vec_cast.logical.double(...)
 10. │ └─vctrs::maybe_lossy_cast(out, x, to, lossy, x_arg = x_arg, 
to_arg = to_arg)
 11. │   ├─base::withRestarts(...)
 12. │   │ └─base:::withOneRestart(expr, restarts[[1L]])
 13. │   │   └─base:::doWithOneRestart(return(expr), restart)
 14. │   └─vctrs:::stop_lossy_cast(...)
 15. │ └─vctrs:::stop_vctrs(...)
 16. │   └─rlang::abort(message, class = c(class, 
"vctrs_error"), ...)
 17. │ └─rlang:::signal_abort(cnd)
 18. │   └─base::signalCondition(cnd)
 19. └─(function (cnd) ...


​



From: Bill Dunlap 
Sent: Tuesday, September 7, 2021 4:06 PM
To: John Tully 
Cc: r-help@R-project.org ; McCutcheon, Robert 

Subject: Re: [R] 'Double to logical' error

Thanks.  If you can still reproduce the problem, what did
rlang::last_trace()
report?

-Bill

On Tue, Sep 7, 2021 at 3:37 AM John Tully 
mailto:john.tu...@nottingham.ac.uk>> wrote:
Thank you

I ran:

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

Here is the output:


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





From: Bill Dunlap mailto:williamwdun...@gmail.com>>
Sent: Monday, September 6, 2021 5:36 PM
To: John Tully 
mailto:msz...@exmail.nottingham.ac.uk>>
Cc: r-help@R-project.org mailto:r-help@r-project.org>>; 
McCutcheon, Robert 
mailto:robert.mccutch...@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 
mailto:john.tu...@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  to 
>  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 

Re: [R] 'Double to logical' error

2021-09-07 Thread John Tully
I’m afraid I don’t know this. I ran rlang to no avail. Any other suggestion?

Get Outlook for iOS<https://aka.ms/o0ukef>

From: Duncan Murdoch 
Sent: Tuesday, September 7, 2021 2:27:55 PM
To: John Tully ; r-help@R-project.org 

Cc: McCutcheon, Robert 
Subject: Re: [R] 'Double to logical' error

And what is in the string that triggers the issue?

On 07/09/2021 9:23 a.m., John Tully wrote:
> Thank you Duncan
>
> we now resolved this
>
> However I have run into another problem with the section of script
> below- I am getting in reply
>
> Error in nchar(a) : invalid multibyte string, element 1
>
> Thanks
>
>
>
>
> SCRIPT SECTION:
>
> **
>
> **
>
> # fill data frame with meta results
> j=1
> for (indiv_meta in to_include){
>graph_results$estimate[j]=results_list[[indiv_meta]]$b
>graph_results$lb[j]=results_list[[indiv_meta]]$ci.lb
>graph_results$ub[j]=results_list[[indiv_meta]]$ci.ub
>graph_results$p[j]=results_list[[indiv_meta]]$pval
>a <- as.character(results_list[[indiv_meta]]$slab)
>#this reduces the 'k' printed on the graph for instancews where
> sibsamples counted as sepearte studies
>b <- substr( a, start = nchar(a) - 1 , stop = nchar(a)-1)
>num_dups = sum(b==".")/2
>graph_results$k[j]=as.integer(results_list[[indiv_meta]]$k)-num_dups
>j=j+1
> }
>
>
>
>
> 
> *From:* Duncan Murdoch 
> *Sent:* Monday, September 6, 2021 5:49 PM
> *To:* John Tully ; r-help@R-project.org
> 
> *Cc:* McCutcheon, Robert 
> *Subject:* Re: [R] 'Double to logical' error
> You get this error from this kind of operation on tibbles:
>
> library(tibble)
> t1 <- tibble(x = c(TRUE, FALSE))
> t2 <- tibble(x = c(1.2, 1.3))
> t1[1,] <- t2[1,]
> #> Error: Assigned data `t2[1, ]` must be compatible with existing data.
> #> ℹ Error occurred for column `x`.
> #> x Can't convert from  to  due to loss of precision.
> #> * Locations: 1.
>
> If t1 had been a data.frame instead of a tibble, this would convert t1$x
> to type double.  So it is possible some code you are using assumes
> things inheriting from class "data.frame" act like dataframes.  Or maybe
> they were just sloppy.  In any case, you might be able to fix it by
> changing single_study_df to a dataframe using
>
> single_study_df <- as.data.frame(single_study_df)
>
> Duncan Murdoch
>
>
> On 06/09/2021 12:34 p.m., Duncan Murdoch wrote:
>> On 06/09/2021 10:16 a.m., John Tully 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 
>>>>  to  due to loss of precision. * Locations: 1, 2. Run 
>>>> `rlang::last_error()` to see where the  error occurred.
>>
>> That certainly looks like a tidyverse error, specifically from the
>> tibble package.
>>
>> Duncan Murdoch
>>
>>>>
>>>> This follows the commands
>>>>
>>>> for (region in regions){
>>>>  for (study in unique(df$studyid)){
>>>>single_study_df <- df %>% filter(studyid==study)
>>>>if (is.na(single_study_df[sprintf('%s_mn', region)][[1]]) & 
>>>> !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 

Re: [R] 'Double to logical' error

2021-09-07 Thread John Tully
Thank you Duncan

we now resolved this

However I have run into another problem with the section of script below- I am 
getting in reply

Error in nchar(a) : invalid multibyte string, element 1

Thanks




SCRIPT SECTION:


# fill data frame with meta results
j=1
for (indiv_meta in to_include){
  graph_results$estimate[j]=results_list[[indiv_meta]]$b
  graph_results$lb[j]=results_list[[indiv_meta]]$ci.lb
  graph_results$ub[j]=results_list[[indiv_meta]]$ci.ub
  graph_results$p[j]=results_list[[indiv_meta]]$pval
  a <- as.character(results_list[[indiv_meta]]$slab)
  #this reduces the 'k' printed on the graph for instancews where sibsamples 
counted as sepearte studies
  b <- substr( a, start = nchar(a) - 1 , stop = nchar(a)-1)
  num_dups = sum(b==".")/2
  graph_results$k[j]=as.integer(results_list[[indiv_meta]]$k)-num_dups
  j=j+1
}





From: Duncan Murdoch 
Sent: Monday, September 6, 2021 5:49 PM
To: John Tully ; r-help@R-project.org 

Cc: McCutcheon, Robert 
Subject: Re: [R] 'Double to logical' error

You get this error from this kind of operation on tibbles:

library(tibble)
t1 <- tibble(x = c(TRUE, FALSE))
t2 <- tibble(x = c(1.2, 1.3))
t1[1,] <- t2[1,]
#> Error: Assigned data `t2[1, ]` must be compatible with existing data.
#> ℹ Error occurred for column `x`.
#> x Can't convert from  to  due to loss of precision.
#> * Locations: 1.

If t1 had been a data.frame instead of a tibble, this would convert t1$x
to type double.  So it is possible some code you are using assumes
things inheriting from class "data.frame" act like dataframes.  Or maybe
they were just sloppy.  In any case, you might be able to fix it by
changing single_study_df to a dataframe using

   single_study_df <- as.data.frame(single_study_df)

Duncan Murdoch


On 06/09/2021 12:34 p.m., Duncan Murdoch wrote:
> On 06/09/2021 10:16 a.m., John Tully 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 
>>>  to  due to loss of precision. * Locations: 1, 2. Run 
>>> `rlang::last_error()` to see where the error occurred.
>
> That certainly looks like a tidyverse error, specifically from the
> tibble package.
>
> Duncan Murdoch
>
>>>
>>> This follows the commands
>>>
>>> for (region in regions){
>>>  for (study in unique(df$studyid)){
>>>single_study_df <- df %>% filter(studyid==study)
>>>if (is.na(single_study_df[sprintf('%s_mn', region)][[1]]) & 
>>> !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@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]]

__
R-help@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.


Re: [R] 'Double to logical' error

2021-09-07 Thread Bill Dunlap
Thanks.  If you can still reproduce the problem, what did
rlang::last_trace()
report?

-Bill

On Tue, Sep 7, 2021 at 3:37 AM John Tully 
wrote:

> Thank you
>
> I ran:
>
> ```{r}
> rlang::last_error()
> ```
>
> Here is the output:
>
> 
> Assigned data `single_study_df` must be compatible with existing data.
> ℹ Error occurred for column `third_ventricle_mn`.
> x Can't convert from  to  due to loss of precision.
> * Locations: 1, 2.
> Backtrace:
> Run `rlang::last_trace()` to see the full context.
>
>
>
>
> --
> *From:* Bill Dunlap 
> *Sent:* Monday, September 6, 2021 5:36 PM
> *To:* John Tully 
> *Cc:* r-help@R-project.org ; McCutcheon, Robert <
> robert.mccutch...@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 
> 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
>  to  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(single_study_df[sprintf('%s_mn', region)][[1]]) & 
> > !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@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]]

__
R-help@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.


Re: [R] 'Double to logical' error

2021-09-07 Thread Duncan Murdoch

And what is in the string that triggers the issue?

On 07/09/2021 9:23 a.m., John Tully wrote:

Thank you Duncan

we now resolved this

However I have run into another problem with the section of script 
below- I am getting in reply


Error in nchar(a) : invalid multibyte string, element 1

Thanks




SCRIPT SECTION:

**

**

# fill data frame with meta results
j=1
for (indiv_meta in to_include){
   graph_results$estimate[j]=results_list[[indiv_meta]]$b
   graph_results$lb[j]=results_list[[indiv_meta]]$ci.lb
   graph_results$ub[j]=results_list[[indiv_meta]]$ci.ub
   graph_results$p[j]=results_list[[indiv_meta]]$pval
   a <- as.character(results_list[[indiv_meta]]$slab)
   #this reduces the 'k' printed on the graph for instancews where 
sibsamples counted as sepearte studies

   b <- substr( a, start = nchar(a) - 1 , stop = nchar(a)-1)
   num_dups = sum(b==".")/2
   graph_results$k[j]=as.integer(results_list[[indiv_meta]]$k)-num_dups
   j=j+1
}





*From:* Duncan Murdoch 
*Sent:* Monday, September 6, 2021 5:49 PM
*To:* John Tully ; r-help@R-project.org 


*Cc:* McCutcheon, Robert 
*Subject:* Re: [R] 'Double to logical' error
You get this error from this kind of operation on tibbles:

library(tibble)
t1 <- tibble(x = c(TRUE, FALSE))
t2 <- tibble(x = c(1.2, 1.3))
t1[1,] <- t2[1,]
#> Error: Assigned data `t2[1, ]` must be compatible with existing data.
#> ℹ Error occurred for column `x`.
#> x Can't convert from  to  due to loss of precision.
#> * Locations: 1.

If t1 had been a data.frame instead of a tibble, this would convert t1$x
to type double.  So it is possible some code you are using assumes
things inheriting from class "data.frame" act like dataframes.  Or maybe
they were just sloppy.  In any case, you might be able to fix it by
changing single_study_df to a dataframe using

    single_study_df <- as.data.frame(single_study_df)

Duncan Murdoch


On 06/09/2021 12:34 p.m., Duncan Murdoch wrote:

On 06/09/2021 10:16 a.m., John Tully 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  to  
due to loss of precision. * Locations: 1, 2. Run `rlang::last_error()` to see where the  
error occurred.


That certainly looks like a tidyverse error, specifically from the
tibble package.

Duncan Murdoch



This follows the commands

for (region in regions){
  for (study in unique(df$studyid)){
    single_study_df <- df %>% filter(studyid==study)
    if (is.na(single_study_df[sprintf('%s_mn', region)][[1]]) & 
!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@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help 

<https://stat.ethz.ch/mailman/listinfo/r-help>
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html 

<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.





__
R-help@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.


Re: [R] 'Double to logical' error

2021-09-07 Thread John Tully
Thank you

I ran:

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

Here is the output:


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





From: Bill Dunlap 
Sent: Monday, September 6, 2021 5:36 PM
To: John Tully 
Cc: r-help@R-project.org ; McCutcheon, Robert 

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 
mailto:john.tu...@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  to 
>  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@r-project.org<mailto:R-help@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]]

__
R-help@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.


Re: [R] 'Double to logical' error

2021-09-06 Thread Duncan Murdoch

You get this error from this kind of operation on tibbles:

library(tibble)
t1 <- tibble(x = c(TRUE, FALSE))
t2 <- tibble(x = c(1.2, 1.3))
t1[1,] <- t2[1,]
#> Error: Assigned data `t2[1, ]` must be compatible with existing data.
#> ℹ Error occurred for column `x`.
#> x Can't convert from  to  due to loss of precision.
#> * Locations: 1.

If t1 had been a data.frame instead of a tibble, this would convert t1$x 
to type double.  So it is possible some code you are using assumes 
things inheriting from class "data.frame" act like dataframes.  Or maybe 
they were just sloppy.  In any case, you might be able to fix it by 
changing single_study_df to a dataframe using


  single_study_df <- as.data.frame(single_study_df)

Duncan Murdoch


On 06/09/2021 12:34 p.m., Duncan Murdoch wrote:

On 06/09/2021 10:16 a.m., John Tully 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  to  
due to loss of precision. * Locations: 1, 2. Run `rlang::last_error()` to see where the 
error occurred.


That certainly looks like a tidyverse error, specifically from the
tibble package.

Duncan Murdoch



This follows the commands

for (region in regions){
 for (study in unique(df$studyid)){
   single_study_df <- df %>% filter(studyid==study)
   if (is.na(single_study_df[sprintf('%s_mn', region)][[1]]) & 
!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@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.





__
R-help@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.


Re: [R] 'Double to logical' error

2021-09-06 Thread Bill Dunlap
>  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 
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
>  to  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(single_study_df[sprintf('%s_mn', region)][[1]]) & 
> > !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@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.
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] 'Double to logical' error

2021-09-06 Thread Duncan Murdoch

On 06/09/2021 10:16 a.m., John Tully 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  to  
due to loss of precision. * Locations: 1, 2. Run `rlang::last_error()` to see where the 
error occurred.


That certainly looks like a tidyverse error, specifically from the 
tibble package.


Duncan Murdoch



This follows the commands

for (region in regions){
for (study in unique(df$studyid)){
  single_study_df <- df %>% filter(studyid==study)
  if (is.na(single_study_df[sprintf('%s_mn', region)][[1]]) & 
!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@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.



__
R-help@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.


[R] 'Double to logical' error

2021-09-06 Thread John Tully
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  to 
>  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(single_study_df[sprintf('%s_mn', region)][[1]]) & 
> !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@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.