楼主: Lisrelchen
5398 58

R Cookbook [推广有奖]

31
Lisrelchen 发表于 2015-9-6 12:26:59
  1. Inserting Data into a Vector

  2. Problem
  3. You want to insert one or more data items into a vector.

  4. Solution
  5. Despite its name, the append function inserts data into a vector by using the after parameter, which gives the insertion point for the new item or items:

  6. > append(vec, newvalues, after=n)
  7. Discussion
  8. The new items will be inserted at the position given by after. This example inserts 99 into the middle of a sequence:

  9. > append(1:10, 99, after=5)
  10. [1]  1  2  3  4  5 99  6  7  8  9 10
  11. The special value of after=0 means insert the new items at the head of the vector:

  12. > append(1:10, 99, after=0)
  13. [1] 99  1  2  3  4  5  6  7  8  9 10
复制代码

32
Nicolle 学生认证  发表于 2015-9-6 12:31:50
提示: 作者被禁止或删除 内容自动屏蔽

33
Nicolle 学生认证  发表于 2015-9-6 12:32:23
提示: 作者被禁止或删除 内容自动屏蔽

34
Nicolle 学生认证  发表于 2015-9-6 12:33:24
提示: 作者被禁止或删除 内容自动屏蔽

35
condmn 发表于 2015-9-6 12:39:47

36
flying81 发表于 2015-9-7 15:01:13
谢谢,看看。哈哈

37
duoduoduo 在职认证  发表于 2015-9-7 15:42:32
EN ,好书

38
lhf8059 发表于 2015-9-7 15:43:46
看看!

39
lwzxy 发表于 2015-9-7 16:01:27
谢谢分享

40
njuwxw 发表于 2015-9-7 16:01:28
~~~~~~~~~~

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-29 14:20