[Tutorial] How to create and tune ridgeline density plot using ggridges
Today, I would like to introduce how to use the package ggridges to create a ridgeline density plot. Let’s start. Install the package install.packages("ggridges") First try library(ggplot2) library(ggridges) library(dplyr) ## ## Attaching package: 'dplyr' ## The following objects are masked from 'package:stats': ## ## filter, lag ## The following objects are masked from 'package:base': ## ## intersect, setdiff, setequal, union plt<-ggplot(iris, aes(x=Sepal.Width, y=Species, fill=Species)) plt<-plt+theme_bw() plt+geom_density_ridges() ## Picking joint bandwidth of 0.
2023-07-01   schedule 1 min 21 s  
[Tutorial] How to install Shiny server on Ubuntu 22.04
R shiny is a great tool for one to present research results in a dynamic and interactive way. Today, I’d introduce how to install R shiny server on Ubuntu 22.04. The content will include installation, configuration, and connecting to R shiny server. Installation Here I install the compiled version by downloading from the R shiny server website. As of my writing, the Ubuntu version supports Ubuntu 18.04 and above. If no compiled version is available, one can compile it by following the instruction here.
2023-06-30   schedule 2 min 13 s  
[Linux] User management in Linux
Here is a summary of commands for user management in Linux. see all existing groups 1 getent group get all groups a user belongs to 1 groups username create a new group 1 sudo groupadd new_group add user to a group 1 2 3 sudo adduser username groupname # or sudo usermod -aG groupname username create a new user
2023-05-28   schedule 27 s  
[R] install and configure Rstudio-server in ubuntu
Rstudio server provides an integrative environment for a data scientist to do data analysis in R and python and allows one to login into it via a browser anywhere. Today, I will going to show how to install Rstudio server in Ubuntu under AWS. Setup EC2 instance To access Rstudio server in an EC2 instance, one need to open correct port in the security group and set the Source to “Anywhere” (i.
2023-05-28   schedule 4 min 13 s  
[R] Compute stats on grouped data using dplyr
library(knitr) opts_chunk$set(echo=T, warning=T, fig.width=7, height=7) library(dplyr) dplyr is a great package to process data in a more smooth way: the output of one function can be inject to another function using the operator %>% easily. Today, I would like to share my experience on how to process grouped data and return multiple columns/rows data. Data We will generate some fake data for this test. g1<-rep(c("a","b","c"), each=10) g2<-rep(c("A","B"), each=5, length.out=30) x<-rnorm(30,0,10) dat<-data.
2023-05-27   schedule 2 min 30 s  
[R] What if plots don't show up in blogdown webpage?
Recently I found that the plots generated by R don’t show up in the webpage when I blogdown::serve_site() locally or at netlify.app. A quick google search gave me the following two solutions: Modify the file config.toml to remove the pattern _files$ from the ignoreFiles list. Add the option fig.path=some/folder in knitr::opts_chunk$set(). The first one is recommended by Yihui. For more details, see the following pages:
2023-05-27   schedule 19 s  
[R] Create ggplot histograms with y value being fractions
library(knitr) opts_chunk$set(echo=T, warning=F, fig.width=7, fig.height=7, fig.path="static/") library(ggplot2) ## Warning: package 'ggplot2' was built under R version 4.2.3 ggplot2 has been a great tool for making plots. Today, I would like to talk about histogram. It is straight forward to make a histogram with geom_histogram(), but not so when one wants to use fractions instead of counts as values on the y-axis, especially when data are separated into groups. Let’s dive in.
2023-05-26   schedule 1 min 53 s  
[Jupyter] Connect Jupyter notebook via SSH Tunnel
One can install Jupyter notebook on an AWS EC2 instance via the following command 1 pip install jupyterlab And then start it via the command 1 jupyter-lab --no-browser However, to access it from a client computer may need some tweaking in both AWS EC2 instance and the SSh connection. AWS EC2 setting Make sure the EC2 instance’s inbound port in security groups include the jupyter server’s port, normally 8888 SSH setting use the following command or alike connect to the EC2 instance
2023-05-23   schedule 1 min 17 s  
Setup bash in MacOS
I have used Bash in my career for many years and it is so convenient for data analysis. In MacOS, however, the default shell is zsh. To make use of bash in MacOS, one need the following steps: Install the latest version of bash One can use brew (the MacOS package manager) to install the latest bash. This will install bash to /usr/local/bin/bash. 1 brew install bash Change the default shell to /usr/local/bin/bash To change the default shell in MacOS, one need run the following command:
2023-05-22   schedule 1 min 16 s  
Disclaimer
The information provided on fortune9.netlify.app is for general informational purposes only. The website owners and authors do not make any warranties about the completeness, reliability, and accuracy of this information. Any action you take upon the information you find on this website is strictly at your own risk, and the owners and authors will not be liable for any losses and/or damages in connection with the use of our website.
2023-04-29   schedule 1 min 22 s