[R] language study notes --- R language data structure

R python will feel to learn to be a lot easier

vector

Vector is the basic unit of language in the R data storage and management, and other data structures are born on the basis of the vector, the vector is therefore also an atomic
vector type must be of the same elemental composition
substantially vector types : logical, integer , real number, complex, character and the byte
assignment symbol <-combining functionc()
Here Insert Picture Description

Matrix :

Creating Matrix:
Here Insert Picture Description
Here Insert Picture Description
selecting a matrix of an element ( not starting with 0 ):

Here Insert Picture Description
Select line:
Here Insert Picture Description
selecting a plurality of rows:
Here Insert Picture Description
remove one or more rows (negative indexes):
Here Insert Picture Description
Here Insert Picture Description
using a vector are combined into a new matrix:
row composition
Here Insert Picture Description
by a combination of column:
Here Insert Picture Description
rownames()for renaming
colnames()Rename a column

Array

dim()Returns the maximum value of each dimension
Here Insert Picture Description
, if the above code vector is less than 30 ( 5 3 2 5*3*2 ), the principle of the R cycle in accordance with the language data padded:
Here Insert Picture Description

Data block (DataFrame)

Create:
Here Insert Picture Description
index and matrix similar to the
$symbols used:
Here Insert Picture Description

factor

The main factor for managing discrete categorical variables, functions factor()
created:
Here Insert Picture Description
obviously see it as the default alphabetical ABCD
change the default sort order:
Here Insert Picture Description
data levels specified in the parameter level and vectors appear to match, otherwise there will be missing values
Ordered:
Here Insert Picture Description

List

Allowing the element contains a list of different types of
create a list:
Here Insert Picture Description
a list of query:
Here Insert Picture Description

sequentially

The time series is a special class of vector or matrix, the time series object can ts()be created
Here Insert Picture Description
Here Insert Picture Description

Published 125 original articles · won praise 56 · views 70000 +

Guess you like

Origin blog.csdn.net/Nicht_sehen/article/details/103149371