2.2.2 Matrix
Matrix (Vector,nrow,ncol,byrow,dimnames,char_vector_rownames,char_vector_colnames)
which
Byrow=true/false, which is filled by row or column, is populated by column by default
2.2.4 Data Frame
1.attach,detach () and with ()
Attach (): Add data frame to search path
Detach (): Remove the data frame from the search path
With (): assignment is only valid in parentheses, if you want to take effect outside of parentheses, use <<-
2.2.5 Factor
Factor: A nominal variable and an ordered variable that corresponds to an integer value for such a variable
Factor (): Generates a factor vector, ordered=true after an ordered variable, levels parameter overrides the default sort, you can specify the order of ordinal variables corresponding to integer values
Usage:
Patientid <-C (1, 2, 3, 4)
Age <-C (25, 34, 28, 52)
Diabetes <-C ("Type1", "Type2", "Type1", "Type1")
Status <-C ("Poor", "improved", "excellent", "Poor")
Diabetes <-Factor (Diabetes) #会被编成1 2 1 1
Status <-factor (status, order = TRUE) #会被编成3 2 1 3
Patientdata <-Data.frame (Patientid, age, diabetes, status)
STR (patientdata) #str是显示对象结构 that can be shown to be encoded into what
Summary (Patientdata)
2.2.6 List
G <-"My first List"
H <-C (25, 26, 18, 39)
J <-Matrix (1:10, nrow = 5)
K <-C ("One", "one", "one", "three")
MyList <-List (title = g, ages = h, j, K)
MyList
2.3.2 importing data from a delimited text file
Read.table (File,header,sep,row.nanes), by default, character variables are converted to factors that can be set Stringsasfactors=false
2.5 Practical functions for processing data Objects, after reading the machine learning practice, I think these are pediatrics.
Length ()
Dim (): Display the dimensions of an object
STR (): Shows the structure of the object, R language This pit is dead named Ah, STR is not generally referred to as a string, so it becomes structure
Class ()
Names ()
Cbind ()
Rbind ()
Head ()
Tail ()
R Language Practical reading notes (ii) creating datasets