Monday, 29 February 2016

Tax

The Most Overlooked Tax Deductions

MSN Money Tax

Friday, 19 February 2016

R gtable Package (Top,Bottom,Left and Right Extent)

Cited from Index Position in the gtable

"tlrb" refers to the index position in the gtable (think of it as a matrix): t=2, b=5 means that the grob will be placed from the second to the fifth row (inclusive).

R gtable Wiki

Constructing a gtable

R Grid Coordinates

Cited from grid Graphics

Each viewport has a number of coordinate systems available. There are four main types: absolute coordinates (e.g.,"inches", "cm") allow locations and sizes in terms of physical coordinates -- there is no dependence on the size of the page; normalised coordinates (e.g., "npc") allow locations and sizes as a proportion of the page size (or the current viewport); relative coordinates (i.e.,"native") allow locations and sizes relative to a user-de ned set of x- and y-ranges; referential coordinates (e.g., "strwidth") where locations and sizes are based on the size of some other graphical object.

"R Graphics" Book R Code

"R Graphics" R Code

R readPNG Function

readPNG (png package)

R Grid Package Introduction

Cited from the paper "Fun with the R Grid Package"

By default, the coordinates of the lower left corner of a viewport are (0, 0), and the upper right corner has coordinates 1.

upViewport(2)

The argument in brackets determines the number of generations to move up the viewport tree.

The use of col=NA prevents the outlines from being drawn.

The clip="on" makes it possible to “spill” an graphic object outside the viewport region.

Two ways to interact with a grob (graphic object):
Directly,
grid."shape"()

Indirectly,
"shape"Grob()

If modify we want a grob to draw by using one the of these functions grobs, we could use the and grid.draw() function. We can modify a grob by using the functions grid.edit() and editGrob().

The function gList() allows us to create a list of grobs. It facilitates the construction of several items in one plotting region together.

The function gTree() creates a tree-structure which can be used to organise the components of more complicated graphic objects. Such a tree-structure contains several grobs nested together. In a tree-structure, a grob can contain other grobs. The "children" argument specifies the components of the gTree. The children component is usually a list, constructed by gList.





Tuesday, 16 February 2016

Thursday, 11 February 2016

R: Environment and Frame

Cited from "R in a Nutshell"

" An environment is is an R object that contains the set of symbols available in a given context, the objects associated with those symbols, and a pointer to a parent environment. The symbols and associated objects are called a frame."

"The parent environment of a function is the environment in which the function was created."

======================================
Cited from How R Searches and Finds Stuff




R: Rle or RleList Objects

Cited from http://kasperdanielhansen.github.io/genbioconductor/html/GenomicRanges_Rle.html

The Rle (run length encoding) class in R is intended for representation genome-wide sequence coverage.

The Wig and BigWig files are used to store coverage data.

The run-length-encoded representation of a vector, represents the vector as a set of distinct runs with their own value. This class is integrated in the IRanges package. A base class called "rle" implements much less functionality.

runLength(), runValue() and as.numeric() function takes in the "Rle" class object.

RleList represents a list of Rles. It stores a genome wide coverage track where each element of the list is a different chromosome.

======================================
Cited from IRanges and GenomicRanges An introduction

aggregate() allows you to apply functions to the Rle inside an IRanges

aggregate(Rle_object, IRange_object, FUN=func_name)







Wednesday, 10 February 2016

How to Check If Folder Is Empty or Have Folder File Use Shell Script?

Cited from

if [ "$(ls -A $DIR 2> /dev/null)" == "" ];
then
    # The directory is empty
fi