![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
swirl
Ariel暖暖和和
这个作者很懒,什么都没留下…
展开
-
swirl 7: Matrices and Data Frames
dim() The dim() function tells us the 'dimensions' of an object.> dim(my_vector)NULLvector的dimension是NULL.> length(my_vector)[1] 20length()返回vector matrix的“长度”,慎重使用。转载 2015-08-07 19:56:58 · 373 阅读 · 0 评论 -
swirl 9: Functions
To understand computations in R, two slogans are helpful: 1. Everything that exists is an object. 2. Everything that happens is a function call. Sys.Date() The Sys.Date() function returns a st转载 2015-08-10 16:15:48 · 1873 阅读 · 0 评论 -
swirl 1: Basic Building Blocks
swirl 1 Basic Building Blockshelp.start() 帮助命令?c 查询特定函数sqrt()abs()If the length of the shorter vector does not divide evenly into the length of the longer vector, R will still| apply t转载 2015-08-03 17:01:56 · 444 阅读 · 0 评论 -
swirl 5: Missing Values
is.na() The is.na() function tells us whether each element of a vector is NA.> my_data == NA [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA转载 2015-08-07 16:08:45 · 236 阅读 · 0 评论 -
swirl 8: Logic
&,&& You can use the `&` operator to evaluate AND across a vector. The `&&` version of AND only evaluates the first member of a vector.> TRUE & c(TRUE,FALSE,FALSE)[1] TRUE FALSE FALSE> TRUE转载 2015-08-10 12:15:36 · 308 阅读 · 0 评论 -
swirl 2: Workspace and Files
getwd() getting working directoryls() List all the objects in your local workspace using ls()list.files() or dir() List all the files in your working directory using list.files() or dir()ar转载 2015-08-04 17:44:35 · 532 阅读 · 0 评论 -
swirl 3: Sequences of Numbers
> pi:10[1] 3.141593 4.141593 5.141593 6.141593 7.141593 8.141593 9.141593不同于 MATLAB,a:b,a\b均可以不是整数。> 15:1 [1] 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1可以倒着来| Remember that if you have转载 2015-08-06 18:09:52 · 298 阅读 · 0 评论 -
swirl 4: Vectors
Vectors come in two different flavors: atomic vectors and lists.所以list 也是vector的一种。paste() Right now, my_char is a character vector of length 3. Let's say we want to join the elements of my_char t转载 2015-08-07 15:23:28 · 208 阅读 · 0 评论 -
swirl 6: Subsetting Vectors
> x[x>0] [1] NA 1.212753086 1.226772040 1.859602576 0.763847244 NA 1.791336311 NA NA[10] NA NA NA NA NA 0.439779205转载 2015-08-07 19:41:47 · 311 阅读 · 0 评论 -
swirl 10: lapply and sapply
These powerful functions, along with their close relatives (vapply() and tapply(), among others) offer a concise and convenient means of implementing theSplit-Apply-Combine strategy for data analysi转载 2015-08-13 12:01:18 · 626 阅读 · 0 评论