- 博客(10)
- 资源 (1)
- 收藏
- 关注
转载 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 the Split-Apply-Combine strategy for data analysi
2015-08-13 12:01:18
711
转载 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
1971
转载 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
366
转载 swirl 7: Matrices and Data Frames
dim() The dim() function tells us the 'dimensions' of an object. > dim(my_vector) NULL vector的dimension是NULL. > length(my_vector) [1] 20 length()返回vector matrix的“长度”,慎重使用。
2015-08-07 19:56:58
423
转载 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
382
转载 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
304
转载 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
268
转载 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
351
转载 swirl 2: Workspace and Files
getwd() getting working directory ls() 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
611
转载 swirl 1: Basic Building Blocks
swirl 1 Basic Building Blocks help.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
530
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅