Update chartjs htmlwidget

Sources: https://www.htmlwidgets.org/develop_intro.html https://www.chartjs.org/docs/latest/samples/area/line-datasets.html inst/htmlwidgets/ # directory to add css, js, yaml, libraries # To modify chartjs high level, go to chartjs/R/chartjs.R # To modify each line of graphs chartjs/R/series.R #…

R – here package

https://here.r-lib.org/articles/here.html it is a useful package to set project root directory # my project structure is following: #> /home/sunny/work/myproject #> ├── data_proc #> │ └── mycode.R #> ├── analysis #>…

Useful R codes

How to get min and max value and the associated year that min and max values occurred previous <- dfile %>%filter(YearLabel == "Previous") %>%group_by(MonthName) %>%summarize(min_extent = min(extent_mil),max_extent = max(extent_mil),year_min =…

Creating htmlwidget in RStudio

To set up required packages to create htmlwidget install.packages("htmlwidgets") install.packages("devtools") Scaffolding will provide a template (basic structure) for a widget development library(devtools) create("my_widget") htmlwidgets::scaffoldWidget("my_widget") document() # Update documentation build() #…

R data wrangling

This code snippet has nice examples of data wrangling From https://www.jumpingrivers.com/blog/r-d3-intro-r2d3/ scoobydoo = tuesdata$scoobydoo # wrangling data into nice shape monsters_caught = scoobydoo %>% select(date_aired, starts_with("caught")) %>% mutate(across(starts_with("caught"), ~ as.logical(.)))…