[Re-blog] Set proxy and unset proxy for RStudio

If you want to set proxy server using RStudio, you might google and land on RStudio support site. However, the obvious solution might not be clear, so I have blogged about it almost 10 years ago.

Today, the solution still comes in handy.

So, to unset the proxy this time, simply do the following!


Import data from Excel to R using gdata library

There are several ways to import data into R.

The standard way, what it used to be, is from a text file using read.table() function.

For excel files, the most famous spreadsheet software on the world, several libraries can be used to import data from .xls file, for example


. In the past, the problem was with the xlsx file, which was not supported yet.

Recently, I discovered that


can be used to import xlsx file now. So, this bypass the step that I normally have to save the excel file to text file and do the regular file import.

Here’s how:

data <- read.xls(xls="myData.xlsx",sheet=1,header=TRUE, as.is=TRUE)

Transpose Table Sideway

I’ve come across a problem needing to transpose to wide table into a long format. I’m not talking about the longitudinal data quite yet, the one where you have one individual getting multiple measurements over time.

The question then is get a lot simpler than having to manipulate longitudinal data, which you can do with


in R. See:





Recently, the


has come into my rescue. With fread function reading in large data frame (or data table) has become much faster. Therefore, base on the simple fread and write.table. here comes the transpose function. You can get the script from my short script transposeR.r github Genetics Library (which has just recently been updated).

Rscript transposeR.r data_1.txt data_2.txt

You can also use wildcard.

Rscript transposeR.r data_?.txt

I mostly tested it on mac, if your windows machine doesn’t play with ls command then, the script might not work with multiple file wildcard.

A new way to install Bioconductor

In the past, whenever we want to install a package on Bioconductor. The first thing that we have to do is to “source” the


The good news is that there is a new package “BiocInstaller”, which can help you install Bioconductor package.

Here’s an example to install a library that will help to work with NHGRI’s GWAS catalog


Sourcing R script over HTTPS – Stack Overflow

You can use


to source your script from online resource.
However, source doesn’t work if you have https link,

Here’s some solutions I found on stack overflow.

eval(expr = parse( text = getURL"http://www.mayin.org/ajayshah/KB/R/tutorial.R", ssl.verifypeer=FALSE))

via Sourcing R script over HTTPS – Stack Overflow.

Configuring R to Use an HTTP Proxy / FAQ / Knowledge Base – RStudio Support

Feel like I’ve done this a million time since I came back to work in Thailand. This should work for R user not using R-studio as well. Configuring R to Use an HTTP Proxy / FAQ / Knowledge Base – RStudio Support. In brief, you can use the command template below in each of the R session.


I found that this is more convenient for me who carry my laptop around. And the only place that won’t let me work at ease is when I am at the office. So, the work around will need to be used occasionally.

If you would like to check your current proxy setting, you can do


*Note*: Please note the capital “S” at the beginning of the command follows by all small letters afterwards.