ladbrokes.com

Tag Archives: Data Manipulation

Dive into Data Types in R (Vector , List , Matrix , DataFrames)

Everything in R world is an object . the way data objects organizes having different styles , or we call data types . Now, lets take a deep look into these data types Vector , List , Matrix and DataFrames .   Vector Vector is most basic data types and most simple one. it can be construct via c( ....) function .("c" stands for "Combine"  ).     Creating vector via 3 method is OK . > x <- c(1,2,3,4,5,6,7,8,9) #1 > c(1,2,3,4,5,6,7,8,9) -> z #2 > assign("Y",c(1,2,3,4,5,6,7,8,9) Read more [...]

Indexing vector in R

Indexing vector in R Simple Select: for example, we initiate a simple vector with numeric values to illustrate element select methods . x <- c(-1986,11,-20,2012,-2,25) Single Select : we can get a single value by pass in a location sequence into a bracket as blow: > x <- c(-1986,11,-20,2012,-2,25) > x[3] [1] -20 Pls be noted that all indexing in R is started with 1 other than 0 ,quite different from most other language such as Python , C/C++ Java. Multiple Select Read more [...]