tag:blogger.com,1999:blog-359163792024-03-06T00:31:51.901-05:00Shige's Research BlogShigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.comBlogger1193125tag:blogger.com,1999:blog-35916379.post-82502357410017938972024-02-01T19:46:00.009-05:002024-02-01T19:46:54.715-05:00ABM using Julia<p>Just spent some time with <a href="https://juliadynamics.github.io/Agents.jl/stable/">Agents.jl</a>, then I discovered <a href="https://renusolanki.github.io/EasyABM.jl/dev/">EasyABM.jl</a>, which looks and works more like NetLogo. </p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-2193609943973207472024-01-22T07:09:00.001-05:002024-01-22T07:09:08.488-05:00An interesting article about Julia and Quarto<p> Very <a href="https://www.paltmeyer.com/blog/posts/julia-and-quarto-a-match-made-in-heaven/">informative</a>!</p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-76726050038312455602023-12-30T15:05:00.004-05:002023-12-30T15:05:30.472-05:00Adding and removing Jupyter kernels<p> Using the following command to see the currently installed kernels:</p><blockquote style="border: none; margin: 0 0 0 40px; padding: 0px;"><p style="text-align: left;"><span style="font-family: courier;">jupyter kernelspec list</span></p></blockquote><p>And the following command to remove an installed kernel (in my case an updated version has been installed):</p><blockquote style="border: none; margin: 0 0 0 40px; padding: 0px;"><p style="text-align: left;"><span style="font-family: courier;">jupyter kernelspec uninstall julia-1.9</span></p></blockquote><p>To add an updated version of Julia kernel into Jupyter, it is sufficient to:</p><blockquote style="border: none; margin: 0 0 0 40px; padding: 0px;"><p style="text-align: left;"><span style="font-family: courier;">Pkg.build("IJulia")</span></p></blockquote><p>These simple things need to become part of my muscle memory. </p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-46127558340459519742023-12-03T06:25:00.009-05:002023-12-03T06:25:49.985-05:00cargo-update<p> As the number of cargo-installed packages increases on my computer, I naturally wonder if there is a convenient way to keep them up-to-date. <a href="https://crates.io/crates/cargo-update">cargo-update</a> does exactly that. I can first do:</p><blockquote style="border: none; margin: 0 0 0 40px; padding: 0px;"><p style="text-align: left;"><span style="font-family: courier;">cargo install-update -l</span></p></blockquote><p>to see if any installed packages are out-of-date. If so, I can then:</p><blockquote style="border: none; margin: 0 0 0 40px; padding: 0px;"><p style="text-align: left;"><span style="font-family: courier;">cargo install-update <pkg></span></p></blockquote><p>to get it updated.</p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-66549957251055741622023-12-02T11:21:00.004-05:002023-12-02T11:22:46.688-05:00Zoxide<p> <a href="https://github.com/ajeetdsouza/zoxide#user-content-fn-2-6847cf1b069ea3f9ef942bc36a5181e5">Zoxide</a> is such a small, nice command line utility that significantly reduce the amount of typing. It works with the <a href="https://www.nushell.sh/">Nushell</a> nicely. </p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-69580224446718611492023-11-28T16:14:00.002-05:002023-12-02T11:25:10.918-05:00Rust, Helix, and Zellij<p>I know about <a href="https://www.rust-lang.org/">Rust</a> programming language for many years but did not think it will be a major player in the open source software world simply because there have been so many good programming languages and development tools. I recently stumbled into a couple of really good open source software, including the <a href="https://helix-editor.com/">Helix</a> file editor and the <a href="https://zellij.dev">Zellij</a> terminal multiplexer, both were developed using Rust. Also, there are at least two R packages, <a href="https://extendr.github.io/rextendr/">rextendr</a> and <a href="https://github.com/dbdahl/cargo-framework">cargo</a>, that facilitate the calling of Rust function from within R. Maybe it is time to pay more attention to Rust. </p><p>The <a href="https://www.nushell.sh/">Nushell</a> is another essential component of this Rust-centric free software ecosystem. </p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-49817020370931499552023-08-01T15:09:00.002-04:002023-08-01T15:09:53.315-04:00Cold War II: Niall Ferguson on The Emerging Conflict With China | Uncommon Knowledge<p>In this <a href="https://www.youtube.com/watch?v=KDLTUMIR4jg">interview</a>, Ferguson basically argued that the US needs a credible threat to pull its people together and China fits the bill ... so there will be a second Cold War and possibly a hot war. Wow ...</p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-17763223749374823762023-07-08T16:41:00.004-04:002023-07-08T16:41:52.846-04:008 ChatGPT tools for R programming<p><a href="https://www.infoworld.com/article/3694611/8-chatgpt-tools-for-r-programming.html">This</a> post is very informative and helpful.</p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-77950519187969494402023-06-25T08:42:00.005-04:002023-06-25T08:42:34.942-04:00Smart Connections<p><a href="https://github.com/brianpetro/obsidian-smart-connections#smart-view"> Smart Connections</a> is the best combination of Obsidian and ChatGPT so far. </p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-66275141462377992282023-01-09T08:41:00.009-05:002023-01-09T09:21:04.000-05:00Integrating Obsidian and Rstudio workflow<p>This little Obsidian plugin called <a href="https://github.com/danieltomasz/qmd-as-md-obsidian">qmd as md Obsidian plugin</a>. It enables <a href="https://quarto.org/">Obsidian</a> to recognize Quarto Markdown source file, which is the new generation of the widely used <a href="https://rmarkdown.rstudio.com/">R Markdown</a> format. As a result, now it is possible to index all the intermediate project source file and visualize their relationship. </p><p>This can fundamentally change my research life. </p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-28590514455038439402022-08-07T14:48:00.002-04:002022-08-07T14:48:29.470-04:00Marginalia<p> Very nice and comprehensive post on <a href="https://www.andrewheiss.com/blog/2022/05/20/marginalia/">marginal effects</a>. </p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-31349589789447450542022-04-27T16:12:00.006-04:002022-04-27T16:13:03.784-04:00Processing the sugar map<p> Different implementations of the Sugarscpe agent-based model have different ways to get up the sugar map. <a href="https://www.comses.net/codebases/4688/releases/1.1.0/">SugarscapeCW</a> used a built-in matrix (no space between each number) whereas the NetLogo model library uses an external text file with a blank space between each number. </p><p>The easy way to translate between these two different format is to use the <i>readr</i> R package, something like this:</p><p></p><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px;"><p>library(readr)</p></blockquote><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px;"><p>sugar_map1 <- read_fwf("~/tmp/sugar-map1.txt", fwf_widths(c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1), col_names = NULL))</p></blockquote><blockquote style="border: none; margin: 0px 0px 0px 40px; padding: 0px;"><p>write_delim(sugar_map1, "~/tmp/sugar-map-out.txt", delim = " ", col_names = FALSE)</p></blockquote>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-10012679094313769762021-12-29T06:56:00.004-05:002021-12-29T06:56:52.938-05:00Using Obsidian as a Markdown editor<p> I have been using the open source Typora editor for light editing. It appears to become commercial recently. I was about to purchase a licence when I realized that the recent upgrade of Obsidian (v. 0.13.14) has provided very nice Markdown editor feature and can complete replace a dedicated editor such as Typora. </p><p>I really like Obsidian!</p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-51292156480395408512021-08-18T10:49:00.003-04:002021-08-18T10:49:33.633-04:00The pandemic is back<p> According to <a href="https://www.washingtonpost.com/graphics/2020/national/coronavirus-us-cases-deaths/">this report</a>, despite the vaccination and other efforts, the daily new COVID-19 cases has reached the 200,000 mark on August 17 in the US. It appears that a new wave of the pandemic has begun. </p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-88876340747725615832021-08-11T12:17:00.002-04:002021-08-11T12:17:33.656-04:00Obsidian<p> I have been searching for a note taking/management tool for some time. From a book, I encountered <a href="https://roamresearch.com/">Roam</a>, which looks exactly what I need. After some research, I realized that is is a proprietary software using proprietary data storage format, and store all data on a remote cloud server. This, along with its not so modest price tag, raises a red flag. </p><p>Then I discovered <a href="https://obsidian.md/">Obsidian</a>, which is itself proprietary (as opposed to open source) but it works on local, plain text (including Markdown) files, which can be opened and modified by any text editors. For now, it looks really promising!</p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-30984004518000875072021-04-06T20:32:00.004-04:002021-04-06T20:32:32.809-04:00NetLogo code for Party Competition<p> Today I spent some time to manually convert the NetLogo code for <a href="https://press.princeton.edu/books/paperback/9780691139043/party-competition">Party Competition</a> from version 5 to version 6. </p><p>Fascinating book, by the way. </p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-64375115660466189932021-02-26T17:13:00.006-05:002021-02-26T17:13:50.168-05:00Thunderbird conversation mode<p> Just discovered <a href="https://github.com/thunderbird-conversations/thunderbird-conversations/wiki">Thunderbird conversations</a> extension that displays Thunderbird emails like Gmail. Very cool. </p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-26655442090905249122021-02-25T07:45:00.001-05:002021-02-25T07:45:19.968-05:00Convert email to event or task<p> I just found out that Thunderbird can convert an email into an event or task with deadline. This is extremely useful for me. </p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-69576360353587175702021-02-15T14:46:00.006-05:002021-02-15T14:46:56.075-05:00Using tikzDevice in R Markdown document<p> When I was LaTeX user in the past, I like TikZ and tikzDevice a lot. After switching to R Markdown, however, I gradually forgot about them. Today I spent some time figuring out how to make TikZ and tikzDevice work for R Markdown. Here is some simple code: </p><div style="text-align: left;"><span style="font-family: courier; font-size: x-small;">---<br /></span><span style="font-family: courier; font-size: x-small;">title: "Using tikzDevice"<br /></span><span style="font-family: courier; font-size: x-small;">output: <br /></span><span style="font-family: courier; font-size: x-small;"> pdf_document: <br /></span><span style="font-family: courier; font-size: x-small;"> latex_engine: xelatex<br /></span><span style="font-family: courier; font-size: x-small;"> keep_tex: yes<br /></span><span style="font-family: courier; font-size: x-small;"> includes:<br /></span><span style="font-family: courier; font-size: x-small;"> in_header: setup.tex<br /></span><span style="font-family: courier; font-size: x-small;">---</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;">```{r setup, include=FALSE}<br /></span><span style="font-family: courier; font-size: x-small;">knitr::opts_chunk$set(echo = FALSE)<br /></span><span style="font-family: courier; font-size: x-small;">```</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;">```{r, fig.cap="Without tikzDevice"}<br /></span><span style="font-family: courier; font-size: x-small;">x<- rnorm(10)<br /></span><span style="font-family: courier; font-size: x-small;">y<-x +rnorm(5,sd=0.25)</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;">model <- lm(y~x)<br /></span><span style="font-family: courier; font-size: x-small;">rsq<- summary(model)$r.squared<br /></span><span style="font-family: courier; font-size: x-small;">rsq<- signif(rsq,4)</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;">plot(x, y, main='Hello \\LaTeX!')<br /></span><span style="font-family: courier; font-size: x-small;">abline(model,col='red')</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;">mtext(paste("Linear model:$R^{2}=",<br /></span><span style="font-family: courier; font-size: x-small;"> rsq, "$"), line=0.5)</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;">legend('bottomright',legend=paste("$y = ",round(coef(model)[2],3),'x +',round(coef(model)[1],3),'$',sep =''), bty ='n')<br /></span><span style="font-family: courier; font-size: x-small;">```</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;">```{r, echo=FALSE}<br /></span><span style="font-family: courier; font-size: x-small;">library(tikzDevice)<br /></span><span style="font-family: courier; font-size: x-small;">```</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;">```{r, echo=FALSE, message=FALSE, results='hide'}<br /></span><span style="font-family: courier; font-size: x-small;">tikz('latexEx.tex',width=7,height=4.5)</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;">x<- rnorm(10)<br /></span><span style="font-family: courier; font-size: x-small;">y<-x +rnorm(5,sd=0.25)</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;">model <- lm(y~x)<br /></span><span style="font-family: courier; font-size: x-small;">rsq<- summary(model)$r.squared<br /></span><span style="font-family: courier; font-size: x-small;">rsq<- signif(rsq,4)</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;">plot(x, y, main='Hello \\LaTeX!')<br /></span><span style="font-family: courier; font-size: x-small;">abline(model,col='red')</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;">mtext(paste("Linear model:$R^{2}=",<br /></span><span style="font-family: courier; font-size: x-small;"> rsq, "$"), line=0.5)</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;">legend('bottomright',legend=paste("$y = ",round(coef(model)[2],3),'x +',round(coef(model)[1],3),'$',sep =''), bty ='n')</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;">dev.off()<br /></span><span style="font-family: courier; font-size: x-small;">```</span><span style="font-family: courier; font-size: x-small;"><br /></span><span style="font-family: courier; font-size: x-small;">```{r, fig.cap="With tikzDevice", message=FALSE, engine='tikz'}<br /></span><span style="font-family: courier; font-size: x-small;">\input{latexEx.tex}</span></div><div style="text-align: left;"><br /></div>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-10448141599749833032021-02-11T07:41:00.006-05:002021-02-11T07:41:58.379-05:00Getting Started With Pacman Commands in Arch-based Linux Distributions<p> Useful tips <a href="https://itsfoss.com/pacman-command/">here</a>.</p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-85935610098172965742021-02-11T07:40:00.008-05:002021-02-11T07:40:54.673-05:00Why you need to drop ifconfig for ip<p> Useful tip <a href="https://opensource.com/article/21/1/ifconfig-ip-linux">here</a>.</p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-49022830529563670542021-01-30T07:22:00.002-05:002021-01-30T07:22:12.963-05:00ggfittext<p><i><a href="https://wilkox.org/ggfittext/">ggfittext</a></i> provides some useful text displaying capability to <i>ggplot2</i>, including a new geom called <b>geom_bar_text</b>. </p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-53086469084126115822021-01-08T20:11:00.005-05:002021-01-08T20:11:37.288-05:00BayesPostEst<p> Finally a modern Bayesian implementation of the Zelig package <a href="https://github.com/ShanaScogin/BayesPostEst">here</a>.</p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-15148411825069850692020-12-30T08:21:00.006-05:002020-12-30T08:21:51.671-05:00Estimating and testing GLMs with `emmeans`<p><a href="https://shouldbewriting.netlify.app/posts/2020-04-13-estimating-and-testing-glms-with-emmeans/">This post</a> shows how to use <i>emmeans</i> package to generate first difference with confidence intervals. </p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0tag:blogger.com,1999:blog-35916379.post-90624740117490796892020-11-30T13:12:00.003-05:002020-11-30T13:12:33.577-05:00Getting past the little hiccups to getting plotly animations into slides<p> Very helpful <a href="http://dicook.org/2018/08/29/getting-past-the-little-hiccups-to-getting-plotly-animations-into-slides/#embedding-into-slides">post</a> regarding how to use plotly graph in xaringan slides. </p>Shigehttp://www.blogger.com/profile/05137341187022320380noreply@blogger.com0