24小时热门版块排行榜    

查看: 491  |  回复: 3
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

zxwinner

金虫 (小有名气)

[求助] R 语言编程 如何实现一个函数的功能 已有1人参与

如何定义一个函数可以产生散点图?

  make a function to generate a scatter plot of any two user-supplied arbitrary rows for the dataset. The three inputs will be the matrix, and the two columns to plot
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

FMStation

至尊木虫 (知名作家)

【答案】应助回帖

★ ★ ★ ★ ★
zxwinner: 金币+5 2016-12-08 07:32:04
http://www.dictionary.com/browse/composition
the act of combining parts or elements to form a whole.

https://tw.dictionary.search.yah ... on&fr2=dict
合成物,仿造物[C]

convert the variables in the matrix:

方法1.  divide each row value by its column sum.

方法2.
  for(i in 1:10){ r[,i] <- rnorm(nr, mean=m1, sd=5) }

方法3.
  for(i in 1:5){ r[1:size,i] <- rnorm(size, mean=m2, sd=5) }
4楼2016-10-18 21:56:32
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 4 个回答

FMStation

至尊木虫 (知名作家)

【答案】应助回帖

★ ★ ★
感谢参与,应助指数 +1
zxwinner: 金币+3, 有帮助 2016-10-18 21:39:46
CODE:
# Scatterplot Matrices from the glus Package
library(gclus)
dta <- mtcars[c(1,3,5,6)] # get data
dta.r <- abs(cor(dta)) # get correlations
dta.col <- dmat.color(dta.r) # get colors
# reorder variables so those with highest correlation
# are closest to the diagonal
dta.o <- order.single(dta.r)
cpairs(dta, dta.o, panel.colors=dta.col, gap=.5,
main="Variables Ordered and Colored by Correlation" )

2楼2016-10-17 22:42:09
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zxwinner

金虫 (小有名气)

引用回帖:
2楼: Originally posted by FMStation at 2016-10-17 22:42:09
# Scatterplot Matrices from the glus Package
library(gclus)
dta <- mtcars # get data
dta.r <- abs(cor(dta)) # get correlations
dta.col <- dmat.color(dta.r) # get colors
# reorder va ...

想问下 composition是什么意思,不太理解问题要让我干什么?
convert the variables in the matrix from function 1 to a composition in two different ways. The simplest way to do this is to divide each row value by its column sum. You may choose any two of the below methods.

function1: randomdataset <- function(s, nr, m1, m2){
  size <- s
  r <- matrix(data=NA, nrow=nr, ncol=s)
  for(i in 1:10){ r[,i] <- rnorm(nr, mean=m1, sd=5) }
  for(i in 1:5){ r[1:size,i] <- rnorm(size, mean=m2, sd=5) }
  return(r)
}
3楼2016-10-17 22:49:24
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 北科281学硕材料求调剂 +14 tcxiaoxx 2026-03-20 16/800 2026-03-25 23:14 by peike
[考研] 335分 | 材料与化工专硕 | GPA 4.07 | 有科研经历 +6 cccchenso 2026-03-23 6/300 2026-03-25 22:25 by 544594351
[考研] 一志愿中南大学化学学硕0703总分337求调剂 +7 niko- 2026-03-22 7/350 2026-03-25 20:14 by qingfeng258
[考研] 26考研-291分-厦门大学(085601)-柔性电子学院材料工程专业求调剂 +3 min3 2026-03-24 4/200 2026-03-25 18:22 by xcjcqu
[考研] 材料与化工考研调剂 +9 孅華 2026-03-22 9/450 2026-03-25 13:09 by cmz0325
[考研] 081700 调剂 267分 +10 迷人的哈哈 2026-03-23 10/500 2026-03-25 12:12 by userper
[考研] 293求调剂 +7 加一一九 2026-03-24 7/350 2026-03-25 12:02 by userper
[考研] 考研化学308分求调剂 +10 你好明天你好 2026-03-23 11/550 2026-03-25 10:23 by userper
[考研] 生物学学硕求调剂 +7 小羊睡着了? 2026-03-23 10/500 2026-03-25 02:24 by 清风拂扬。 m
[考研] 一志愿武理085500机械专业总分300求调剂 +3 an10101 2026-03-24 7/350 2026-03-25 00:00 by 山鬼0-
[考研] 300分,材料,求调剂,英一数二 +5 超赞的 2026-03-24 5/250 2026-03-24 21:07 by 星空星月
[考研] 一志愿北化315 求调剂 +3 akrrain 2026-03-24 3/150 2026-03-24 19:35 by 了了了了。。
[考研] 一志愿北京化工大学 070300 学硕 336分 求调剂 +7 vv迷 2026-03-22 7/350 2026-03-23 23:44 by Txy@872106
[考研] 298求调剂 +8 上岸6666@ 2026-03-20 8/400 2026-03-23 11:02 by laoshidan
[考研] 352求调剂 +3 大米饭! 2026-03-22 3/150 2026-03-22 23:28 by king123!
[考研] 求调剂 +5 Zhangbod 2026-03-21 7/350 2026-03-22 13:13 by Zhangbod
[考研] 285求调剂 +6 ytter 2026-03-22 6/300 2026-03-22 12:09 by 星空星月
[考研] 266求调剂 +3 哇呼哼呼哼 2026-03-20 3/150 2026-03-21 16:46 by barlinike
[基金申请] 学校已经提交到NSFC,还能修改吗? 40+4 babangida 2026-03-19 9/450 2026-03-21 16:12 by babangida
[考研] 265求调剂 +12 梁梁校校 2026-03-19 14/700 2026-03-21 13:38 by lature00
信息提示
请填处理意见