Seeking Inspiration from Random Learning
[This article was first published on r on Everyday Is A School Day, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Inspiration
This was inspired by wanting to read a textbook Mandell, Douglas, and Bennett’s Principles and Practice of Infectious Diseases. But, I didn’t want to read the textbook in sequence. Hence, I figured that if I read a paragraph a day in a random chapter, I might be able to benefit from random learning! This is also great for idea generation for some of our mysterious cases when we are still building differential diagnoses. But, how do we do that?
Thought process
- 2 different workstations (personal and work)
- Hence I will have 2 different directories. Need a system for this
- Get all the pdf files of the textbook in my directory
- Randomly select 1 pdf
- Use
DT
to project the link to browser to read the pdf file
2 different workstations (personal and work)
# Get Sys.info compname <- Sys.info() # if the login is so_and_so, assign home as TRUE if (compname["login"]=="so_and_so") { home <- TRUE } else { home <-FALSE } # if home is TRUE then assign the following link if (home) { pathurl <- "G:/My%20Drive/mandell/" path <- "G:/My Drive/mandell/" } else { path <- "C:/Users/so_and_so/Documents/googledrive/mandell/" pathurl <- "C:/Users/so_and_so/Documents/googledrive/mandell/" }
- you can skip this if you are only using 1 computer, or computers with the same login
- Obviously the
so_and_so
is a false login name, you will need to change that. - same with the
path
andpathurl
as well, change it to whatever resource you want to point to - Note to self: I have to insert
%20
in any white space of the directory in order for the URL to actually work
Get all the pdf files of the textbook in my directory
file <- list.files(paste0(path))
Randomly select 1 pdf
ran <- sample(file,1)
Use DT
to project the link to browser to read the pdf file
library(tidyverse) library(DT) data <- tibble(link = paste0('<a target=_blank href=file:///',pathurl, ran,'>',ran,'</a>' )) datatable(data, escape=F)
Have to make sure that the html
code <a target=_blank href=file:///
and sandwiches the pathurl
and ran
which is the actual file name
![](rightclick.png) Then you can `right-click` on it and then click `Open link in browser` to open onto default PDF reader
Conclusion/Lessons Learnt:
- Everyday random learning is fantastic! Sometimes it inspires me to think a bit differently when I approach a case
- Learnt to add
%20
to any white space if I want to use it as a URL link - Learnt about
list.files
- Learnt
<a target=_blank href=file:///
- Learnt that I could use
DT
to project the URL after putting into atibble
- Daily tips: I usually just highlight the end of paragraph where I left off and resume the next time if I stumble upon the same pdf
To leave a comment for the author, please follow the link and comment on their blog: r on Everyday Is A School Day.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.