OsloMet kompetanseheving

Course website: https://www.capro.dev/workshop_rproj/

https://hackmd.io/@drmowinckels/capro-oslomet-2023/edit

Share code, ideas and questions

by writing in this document we can have a collaborative document throughout the course.

usethis::use_course("rstats-wtf/wtf-explore-libraries")
library(usethis)
# saves project on desktop by default for most users
use_course("capro-uio/wtf-explore-renv")
library(usethis)
# saves project on desktop by default for most users
use_course("rstats-wtf/wtf-fix-paths")

About R and long file paths

Despite the long path support in Windows [since Win10 1607 from 2016] and efforts like this [changes to R outlined in the post], it will take “at least” very long before one could reliably rely on paths longer than 260 characters on Windows.

https://blog.r-project.org/2023/03/07/path-length-limit-on-windows/

IIUC the changes to R to support long paths on Windows were release with R 4.3.
The corresponding RStudio issue (if that's the IDE used in this case) is still open.

Other developers also suggest that this might also more likley occur on symlinked institutional paths, where the location seems to not be that long, but actually is a pointer to a path that truly is long.

Python path issues

https://stackoverflow.com/questions/74894455/what-does-error-in-file-existspythonpath-file-name-conversion-problem-na

Installing packages from source on TSD

We briefly discussed the renv cellar to get the .tar.gz files for the package you want to install and put that in the renv/cellar/ folder.

It was also pointed out that of course, some times you'd need to also resolve the dependencies of that package to get it working.
My package tsdrtools should be of help, but is not well tested on Windows.
It should in any case at least get all the package dependencies for you.
But beware, for packages with many dependencies this is quite slow!

We just got Posit Package Manager (still abbreviated to RSPM: RStudio Package Manager), and this can be a great thing to try and resolve your dependencies and lock versioning.
We have a working document trying to get down information as we test it:
https://share.educloud.no/s/nm4wMsYqk9YjzTr

Recoding categorical data in R

The best tool for this, in my opinion, is the forcats package:
https://forcats.tidyverse.org/

It has lots of great funcitonality for most (if not all) your categorical data handling needs!

R and the Tidyverse for working with datasets

Day 3 - 2023.12.12

Course materials: https://carpentries-incubator.github.io/r-tidyverse-4-datasets/

install.packages(c("tidyverse", "palmerpenguins"))

tidyselect tutorial
https://tidyselect.r-lib.org/articles/tidyselect.html

skrive / lese excel filer fra R

https://ycphs.github.io/openxlsx/articles/Formatting.html

Select a repo