How to create a conda or mamba environment for R programming to enhance reproducibility (CC230)

Поділитися
Вставка
  • Опубліковано 25 жов 2024

КОМЕНТАРІ • 33

  • @stretch8390
    @stretch8390 2 роки тому +7

    You are a productivity machine. I don't know how you make time for all these videos but thank you!

    • @Riffomonas
      @Riffomonas  2 роки тому

      My pleasure! Thanks for watching 🤓

  • @arslantariqable
    @arslantariqable 2 роки тому +3

    I knew the conda environment and its usefulness regarding tools installation, but I didn't know about its use for reproducibility for data analysis.
    Thanks for giving such great information. Keep it up. 👍❤️❤️

    • @Riffomonas
      @Riffomonas  2 роки тому

      Wonderful - I’m glad you got something out of the video! 🤓

  • @MLesp
    @MLesp 7 місяців тому

    This is the best explanation ever! Great job!

  • @exotoxinslab
    @exotoxinslab Рік тому

    This is one of the best videos for reproducibility I have seen! 🥳 Thank you so much! I was about to give up the use of several programming languages in our projects, because a lot of blogs report that R is not compatible with Conda environments 🙄. And thank you for the warning about mixing renv with conda... I was about to do that!

  • @dmalarekable
    @dmalarekable 2 роки тому +2

    It is great that you show us not only how to analize the data in RStudio but also more complicated things like environments and version control. Thank you for that.
    I wrote a few custom functions for my microbial data analyses that I use with different datasets and I think that it would be interesting to see how to make custom R package and post it online. Or maybe there is another way to use custom functions in different projects in R?

    • @Riffomonas
      @Riffomonas  2 роки тому +3

      I love integrating different concepts! I’ve thought about putting up a package through a series. Let me see what I can come up with

    • @kylelima6768
      @kylelima6768 2 роки тому

      @@Riffomonas I think that would be a great series.

  • @marbacc
    @marbacc Рік тому +1

    Thank you for the information.
    By the way I stopped and paused the video on 7:02 and forgot to close it. After a few hours I come back and I thought I was watching Mr. Robot.

  • @tolga1292
    @tolga1292 Рік тому

    Great vid! How to activate the conda environment inside RStudio? So without calling RStudio from terminal.

    • @Riffomonas
      @Riffomonas  7 місяців тому +1

      I would love to know too!

  • @zhaoxiang3998
    @zhaoxiang3998 Рік тому

    Very clear video. Just one question, if we are not recommended to install packages in R, everytime we need one package we need to quit R to install it via mamba? then the data analysis process can always be interrupted? any solution for this?

  • @TURALOWEN
    @TURALOWEN Рік тому

    Thank you for the video! Quick question: whenever I try to create env with both tidyverse and tidymodels, it says "Found conflicts! Looking for incompatible packages.
    This can take several minutes. Press CTRL-C to abort." and then tries to solve it, but never manages to solve it. Do you have a solution for this? Thank you!

  • @SriramaBhamidipati
    @SriramaBhamidipati 2 роки тому +1

    Thank you for this.

    • @Riffomonas
      @Riffomonas  2 роки тому

      My pleasure! I’m glad you found it useful 🤓

  • @ahmed007Jaber
    @ahmed007Jaber 2 роки тому +1

    Hey Pat, I am having this issue and wonder what you suggest.
    been experiencing a weird issue. when I am using regex with arabic text and mutate a column I am getting nulls
    the issue I used the same approach with the same data set on my other laptop and it worked like a charm
    an addition to this grepl works fine in the faulty laptop
    any ideas?
    I am trying to figure out a way that copy:
    rstudio confirgrations
    locale configrations
    and implement those into my "faulty" laptop

    • @Riffomonas
      @Riffomonas  2 роки тому

      Sorry I’m not really sure. A google search got me this which I wonder if it will be helpful stackoverflow.com/questions/66586955/r-using-str-detect-function-with-arabic-text-or-other-right-to-left-languages

  • @JonathanFlowers-b9y
    @JonathanFlowers-b9y 3 місяці тому

    One of the frustrating limitations of the conda approach for R is that only a fraction of the packages in CRAN are compiled and installable via conda. Other packages are not in CRAN and its not clear how to install those via conda. Any thoughts on this?

    • @Riffomonas
      @Riffomonas  3 місяці тому

      I have found that the major packages are available in one of the conda collections. It's not a horrible process to contribute a conda package if you need to. This SO link is somewhat helpful stackoverflow.com/questions/52061664/install-r-package-from-github-using-conda

  • @caseyj1144
    @caseyj1144 2 роки тому

    I'm a bit lost on what directory the .Rprofile file should be in to correct the issue with tidyverse. (Also, I am working on a Windows computer and writing out the notes that are different if you do want to make a version for Windows I'd be happy to send them)

    • @caseyj1144
      @caseyj1144 2 роки тому

      anyone else - I just tried saving it in the general miniconda3/envs/ folder and it worked

    • @Riffomonas
      @Riffomonas  2 роки тому +1

      I'd think the .Rprofile file should be in the project root directory. Putting it in miniconda3/envs/ won't be portable if you share your code with someone else.

  • @filhodaanaedozizin4331
    @filhodaanaedozizin4331 2 роки тому

    Thank you, this is very useful indeed. Is there a way to add RStudio into dependencies? I tried with "rstudio-desktop" but it gave me "nothing provides requested rstudio-desktop". Same message when I tried to define the python version as "python=2.7" under dependencies.

    • @Riffomonas
      @Riffomonas  2 роки тому

      Are you possibly using a windows computer? It looks like the rstudio-desktop conda package only works on mac or linux. I suspect most people use a different IDE from RStudio if they're using conda environments anaconda.org/conda-forge/rstudio-desktop For python can you maybe try removing the version number and see what version it selects based on the other dependencies?

    • @filhodaanaedozizin4331
      @filhodaanaedozizin4331 2 роки тому

      @@Riffomonas thanks! I'm using Mac (M1) and don't have any RStudio installed either. The rstudio-desktop should have worked, but for whatever reason it didn't. Full disclosure, this is a brand new laptop and I installed miniconda. It could be the I have something missing in my laptop, but the error message doesn't say that. For python, if I don't give the version number it will use the (base) version.

    • @filhodaanaedozizin4331
      @filhodaanaedozizin4331 2 роки тому

      Would it make sense for me to activate my R env and, then, install RStudio from the downloadable file from their website? It's not critical that I define it in the yml dependencies, but it needs to run with what's installed in the R env

    • @Riffomonas
      @Riffomonas  2 роки тому +1

      I don't recommend using renv with conda. To get Rstudio to use your conda environment, you can go to your terminal and navigate to your project directory. From there, you can type "open project.Rproj" or "open my_file.R" and Rstudio will launch using your environment. To double check, you can run .libPaths() at the R prompt and you should see the path to your environment

    • @filhodaanaedozizin4331
      @filhodaanaedozizin4331 2 роки тому

      @@Riffomonas thanks again. Because I'm using Apple M1 silicon, I (painfully) learned that I first need to install miniforge (miniconda and anaconda apparently won't work properly), then I have to create env that run with compatibility with Intel osx-64 (CONDA_SUBDIR=osx-64 mamba env create -f config_env_r.yml). By following these steps, my M1 Macbook doesn't have compatibility issues with packages developed for Intel chip.

  • @caseyj1144
    @caseyj1144 2 роки тому +3

    you can automatically create a .yaml file to share the environment using conda ```conda env export --name ENVNAME > envname.yml```

    • @Riffomonas
      @Riffomonas  2 роки тому +1

      Thanks Casey! Yeah that's available. I find that is a less desirable approach because the output file is so verbose. When I just ran it the yml file was 350+ lines long! I prefer the compact format where I can quickly look at what is being installed. Your suggested approach is great if you don't plan on actually looking at the contents of the file.

    • @charleslehnen9636
      @charleslehnen9636 Рік тому

      @@Riffomonas not sure if this is an identical output from the one produced by CaseyJ's method or not, but I always use ```conda list --export > requirements.txt```