楼主: ReneeBK
1630 16

[Reading Notes]R in Action [推广有奖]

  • 1关注
  • 62粉丝

VIP

已卖:4897份资源

学术权威

14%

还不是VIP/贵宾

-

TA的文库  其他...

R资源总汇

Panel Data Analysis

Experimental Design

威望
1
论坛币
49635 个
通用积分
55.7537
学术水平
370 点
热心指数
273 点
信用等级
335 点
经验
57805 点
帖子
4005
精华
21
在线时间
582 小时
注册时间
2005-5-8
最后登录
2023-11-26

楼主
ReneeBK 发表于 2015-9-27 22:02:33 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

  • R in Action
  • By: Robert Kabacoff

  • Publisher: Manning Publications

  • Pub. Date: August 24, 2011

  • Print ISBN-10: 1-935182-39-0

  • Print ISBN-13: 978-1-935182-39-9

  • Pages in Print Edition: 472

  • Subscriber Rating: [5 Ratings] Subscriber Reviews



二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:reading Action notes DING READ Robert

回帖推荐

牛尾巴 发表于3楼  查看完整内容

这是最新第2版的 https://bbs.pinggu.org/thread-3914012-1-1.html

本帖被以下文库推荐

沙发
牛尾巴 发表于 2015-9-27 22:04:59
已有 1 人评分经验 收起 理由
ReneeBK + 20 Thanks

总评分: 经验 + 20   查看全部评分

藤椅
ReneeBK 发表于 2015-9-27 22:06:04
  1. Listing 2.2. Using matrix subscripts

  2. > x <- matrix(1:10, nrow=2)
  3. > x
  4.       [,1] [,2] [,3] [,4] [,5]
  5. [1,]     1    3    5    7    9
  6. [2,]    2    4    6    8    10
  7. > x[2,]
  8.   [1]  2  4  6  8 10
  9. > x[,2]
  10. [1] 3 4
  11. > x[1,4]
  12. [1] 7
  13. > x[1, c(4,5)]
  14. [1] 7 9
复制代码

板凳
ReneeBK 发表于 2015-9-27 22:08:37
Listing 2.4. Creating a data frame
A data frame is more general than a matrix in that different columns can contain different modes of data (numeric, character, etc.). It’s similar to the datasets you’d typically see in SAS, SPSS, and Stata. Data frames are the most common data structure you’ll deal with in R.

The patient dataset in table 2.1 consists of numeric and character data. Because there are multiple modes of data, you can’t contain this data in a matrix. In this case, a data frame would be the structure of choice.

A data frame is created with the data.frame() function:
  1. > patientID <- c(1, 2, 3, 4)
  2. > age <- c(25, 34, 28, 52)
  3. > diabetes <- c("Type1", "Type2", "Type1", "Type1")
  4. > status <- c("Poor", "Improved", "Excellent", "Poor")
  5. > patientdata <- data.frame(patientID, age, diabetes, status)
  6. > patientdata
  7.   patientID age  diabetes     status
  8. 1         1  25     Type1       Poor
  9. 2         2  34     Type2   Improved
  10. 3         3  28     Type1  Excellent
  11. 4         4  52     Type1       Poor
复制代码

报纸
ReneeBK 发表于 2015-9-27 22:21:04
  1. Entering data from the keyboard

  2. mydata <- data.frame(age=numeric(0),
  3.   gender=character(0), weight=numeric(0))
  4. mydata <- edit(mydata)
复制代码

地板
ReneeBK 发表于 2015-9-27 22:21:43
  1. Importing data from a delimited text file

  2. mydataframe <- read.table(file, header=logical_value,
  3.   sep="delimiter", row.names="name")
复制代码

7
ReneeBK 发表于 2015-9-27 22:23:49
  1. Importing data from Excel
  2. library(RODBC)
  3. channel <- odbcConnectExcel("myfile.xls")
  4. mydataframe <- sqlFetch(channel, "mysheet")
  5. odbcClose(channel)
复制代码
  1. library(xlsx)
  2. workbook <- "c:/myworkbook.xlsx"
  3. mydataframe <- read.xlsx(workbook, 1)
复制代码

8
ReneeBK 发表于 2015-9-27 22:25:27
  1. Import Data from SPSS
  2. library(Hmisc)
  3. mydataframe <- spss.get("mydata.sav", use.value.labels=TRUE)
复制代码

9
ReneeBK 发表于 2015-9-27 22:26:33
  1. Import Data From SAS
  2. mydata <- read.table("mydata.csv", header=TRUE, sep=",")
复制代码

10
ReneeBK 发表于 2015-9-27 22:27:15
  1. Importing data from Stata

  2. Importing data from Stata to R is straightforward. The necessary code looks like this:

  3. library(foreign)
  4. mydataframe <- read.dta("mydata.dta")
复制代码

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

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-5 13:10