test for data type is.numeric(), is.character(), is.vector(), is.matrix(), is.data.frame() convert it as.numeric(), as.character(), as.vector(), as.matrix(), as.data.frame) vector/matrix/data.frame to one long vector to matrix to data frame from ve
Classification 此博文是 An Introduction to Statistical Learning with Applications in R 的系列读书笔记,作为本人的一份学习总结,也希望和朋友们进行交流学习. 该书是The Elements of Statistical Learning 的R语言简明版,包含了对算法的简明介绍以及其R实现,最让我感兴趣的是算法的R语言实现. [转载时请注明来源]:http://www.cnblogs.com/runner-ljt/
R in Nutshell 前言 例子(nutshell包) 本书中的例子包括在nutshell的R包中,使用数据,需加载nutshell包 install.packages("nutshell") 第一部分:基础 第一章 批处理(Batch Mode) R provides a way to run a large set of commands in sequence and save the results to a file. 以batch mode运行R的一种方式是:使用系统
# Chinese translations for R package # Copyright (C) 2005 The R Foundation # This file is distributed under the same license as the PACKAGE package. # 陈斐 <feic@normipaiva.com>, 2006. # 邓小冬 DENG Xiaodong <xd_deng@hotmail.com>, 2015. # msgid &qu
a = matrix( c(2, 4, 3, 1, 5, 7), # the data elements nrow=2, # number of rows ncol=3, # number of columns byrow = TRUE) # fill matrix by rows class( (a[1,])[1] "numeric" class(a[c(1,2),])[1] &
Data Frame一般被翻译为数据框,感觉就像是R中的表,由行和列组成,与Matrix不同的是,每个列可以是不同的数据类型,而Matrix是必须相同的. Data Frame每一列有列名,每一行也可以指定行名.如果不指定行名,那么就是从1开始自增的Sequence来标识每一行. 初始化 使用data.frame函数就可以初始化一个Data Frame.比如我们要初始化一个student的Data Frame其中包含ID和Name还有Gender以及Birthdate,那么代码为: studen