carpentries-incubator / bioc-intro

Bioconductor data science introduction
https://carpentries-incubator.github.io/bioc-intro
Other
27 stars 28 forks source link

Error in rename(., isoform = isoform_num) #40

Closed kozo2 closed 2 years ago

kozo2 commented 2 years ago

Hi all, I'm Kozo. I am a member of the CAB Multilingual Working Group.

In order to translate this repository using https://bioconductor.crowdin.com/ + https://github.com/bioconductor-translations/bioc-intro-translation , I'm converting the Rmd files in this repo to md with the following command.

library(rmarkdown)
render("50-joining-tables.Rmd", md_document())

Then I got the following error.

> render("50-joining-tables.Rmd", md_document())

processing file: 50-joining-tables.Rmd
  |..                                                                                                               |   2%
  ordinary text without R code

  |....                                                                                                             |   3%
label: unnamed-chunk-1 (with options) 
List of 1
 $ include: logi FALSE

  |......                                                                                                           |   5%
  ordinary text without R code

  |........                                                                                                         |   7%
label: jdrinstall0 (with options) 
List of 1
 $ include: logi FALSE

  |..........                                                                                                       |   8%
  ordinary text without R code

  |...........                                                                                                      |  10%
label: jdrinstall (with options) 
List of 1
 $ eval: logi FALSE

  |.............                                                                                                    |  12%
  ordinary text without R code

  |...............                                                                                                  |  14%
label: joindata
  |.................                                                                                                |  15%
  ordinary text without R code

  |...................                                                                                              |  17%
label: jdf1
  |.....................                                                                                            |  19%
  ordinary text without R code

  |.......................                                                                                          |  20%
label: jdf2
  |.........................                                                                                        |  22%
  ordinary text without R code

  |...........................                                                                                      |  24%
label: join1
  |.............................                                                                                    |  25%
  ordinary text without R code

  |...............................                                                                                  |  27%
label: unnamed-chunk-2
  |.................................                                                                                |  29%
  ordinary text without R code

  |..................................                                                                               |  31%
label: joinby
  |....................................                                                                             |  32%
  ordinary text without R code

  |......................................                                                                           |  34%
label: joinex1 (with options) 
List of 1
 $ indent: chr "> > "

  |........................................                                                                         |  36%
  ordinary text without R code

  |..........................................                                                                       |  37%
label: unnamed-chunk-3 (with options) 
List of 6
 $ results  : chr "markup"
 $ fig.cap  : chr "An inner join matches pairs of observation matching in both tables, this dropping those that are unique to one "| __truncated__
 $ echo     : logi FALSE
 $ purl     : logi FALSE
 $ out.width: chr "70%"
 $ fig.align: chr "center"

  |............................................                                                                     |  39%
  ordinary text without R code

  |..............................................                                                                   |  41%
label: unnamed-chunk-4 (with options) 
List of 6
 $ results  : chr "markup"
 $ fig.cap  : chr "Outer joins match observations that appear in at least on table, filling up missing values with `NA` values. Fi"| __truncated__
 $ echo     : logi FALSE
 $ purl     : logi FALSE
 $ out.width: chr "70%"
 $ fig.align: chr "center"

  |................................................                                                                 |  42%
  ordinary text without R code

  |..................................................                                                               |  44%
label: leftjoinex1 (with options) 
List of 1
 $ indent: chr "> > "

  |....................................................                                                             |  46%
  ordinary text without R code

  |......................................................                                                           |  47%
label: rightjoinex1 (with options) 
List of 1
 $ indent: chr "> > "

  |........................................................                                                         |  49%
  ordinary text without R code

  |.........................................................                                                        |  51%
label: innerjoinex1 (with options) 
List of 1
 $ indent: chr "> > "

  |...........................................................                                                      |  53%
  ordinary text without R code

  |.............................................................                                                    |  54%
label: jdf6
  |...............................................................                                                  |  56%
  ordinary text without R code

  |.................................................................                                                |  58%
label: multexple
  |...................................................................                                              |  59%
  ordinary text without R code

  |.....................................................................                                            |  61%
label: unnamed-chunk-5
  |.......................................................................                                          |  63%
  ordinary text without R code

  |.........................................................................                                        |  64%
label: multproblem
  |...........................................................................                                      |  66%
  ordinary text without R code

  |.............................................................................                                    |  68%
label: unnamed-chunk-6 (with options) 
List of 7
 $ results  : chr "markup"
 $ fig.cap  : chr "Joins with duplicated keys in both tables, producing all possible combinations. Figure taken from *R for Data Science*."
 $ echo     : logi FALSE
 $ purl     : logi FALSE
 $ out.width: chr "70%"
 $ fig.align: chr "center"
 $ indent   : chr "> > "

  |...............................................................................                                  |  69%
  ordinary text without R code

  |................................................................................                                 |  71%
label: unnamed-chunk-7 (with options) 
List of 1
 $ indent: chr "> > "

  |..................................................................................                               |  73%
  ordinary text without R code

  |....................................................................................                             |  75%
label: unnamed-chunk-8
  |......................................................................................                           |  76%
  ordinary text without R code

  |........................................................................................                         |  78%
label: unnamed-chunk-9
  |..........................................................................................                       |  80%
  ordinary text without R code

  |............................................................................................                     |  81%
label: morekeys
  |..............................................................................................                   |  83%
  ordinary text without R code

  |................................................................................................                 |  85%
label: unnamed-chunk-10
Quitting from lines 316-321 (50-joining-tables.Rmd) 
Error in rename(., isoform = isoform_num) : 
  object 'isoform_num' not found

> 

Can you think of anything that might have caused it?

csoneson commented 2 years ago

Hi @kozo2, thanks for reporting this. I just tried to render the file, and I was not able to reproduce the error. Could you try

library("rWSBIM1207")
data(jdf)
head(jdf7)

just to make sure that you have an isoform_num column (it should be there since the chunk just before worked, but just to be sure)? If this looks ok, could it be that R finds the wrong rename function? Could you try rendering in a fresh R session (or explicitly specify dplyr::rename) and see if this helps?

kozo2 commented 2 years ago

Thanks @csoneson , I know something about rWSBIM1207. Come to think of it, the first time I ran the following, it got stucked.

> render("50-joining-tables.Rmd", md_document())

processing file: 50-joining-tables.Rmd
  |.                                                                            |   2%
  ordinary text without R code

  |...                                                                          |   3%
label: unnamed-chunk-1 (with options) 
List of 1
 $ include: logi FALSE

  |....                                                                         |   5%
  ordinary text without R code

  |.....                                                                        |   7%
label: jdrinstall0 (with options) 
List of 1
 $ include: logi FALSE

* installing *source* package 'rWSBIM1207' ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (rWSBIM1207)

and it was the second time I ran the previous comment. (I killed the above code quote once.) First I will check if library("rWSBIM1207") works in my environment. (By the way, now my RStudio is stuck with the above code quote.)

kozo2 commented 2 years ago

@csoneson I once killed my stucked RStudio and restarted RStudio + checked the following code in your advise. It worked well.

library("rWSBIM1207")
data(jdf)
head(jdf7)
R version 4.2.1 (2022-06-23 ucrt) -- "Funny-Looking Kid"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(rWSBIM1207)

This is 'rWSBIM1207' version 0.1.15 

> data(jdf)
> head(jdf7)
# A tibble: 5 × 6
  gene_name description                               uniprot organism isofor…¹ measure
  <chr>     <chr>                                     <chr>   <chr>       <dbl>   <dbl>
1 Rrbp1     Ribosome-binding protein 1                Q99PL5  Mmus            1     102
2 Rrbp1     Ribosome-binding protein 1                Q99PL5  Mmus            2       3
3 Iqgap1    Ras GTPase-activating-like protein IQGAP1 Q9JKF1  Mmus            1      13
4 Hspa5     78 kDa glucose-regulated protein          P20029  Mmus            1      54
5 Pdcd11    Protein RRP5 homolog                      Q6NS46  Mmus            1      28
# … with abbreviated variable name ¹​isoform_num
> 

Whe I can see the jdf7 like the above, I have successfully converted the Rmd to md. It seems that jdf7 was not acquired well the first time. Sorry for the trouble. I close this issue.

label: unnamed-chunk-13
  |..........................................................................   |  97%
  ordinary text without R code

  |............................................................................ |  98%
label: unnamed-chunk-14
  |.............................................................................| 100%
  ordinary text without R code

output file: 50-joining-tables.knit.md

"C:/Program Files/RStudio/bin/quarto/bin/tools/pandoc" +RTS -K512m -RTS 50-joining-tables.knit.md --to markdown_strict-yaml_metadata_block --from markdown+autolink_bare_uris+tex_math_single_backslash --output 50-joining-tables.md 

Output created: 50-joining-tables.md
>