24小时热门版块排行榜    

查看: 489  |  回复: 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的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 一志愿哈工大,085400,320,求调剂 +4 gdlf9999 2026-03-24 4/200 2026-03-25 23:01 by boxking200
[考研] 308求调剂 +5 墨墨漠 2026-03-25 5/250 2026-03-25 22:19 by 544594351
[考研] 机械学硕总分317求调剂!!!! +4 Acaciad 2026-03-25 4/200 2026-03-25 19:59 by hanserlol
[考研] 329求调剂 +3 钮恩雪 2026-03-25 3/150 2026-03-25 14:43 by 糖加冰
[考研] 284求调剂 +15 Zhao anqi 2026-03-22 15/750 2026-03-25 12:51 by wht0531
[考研] 303求调剂 +6 元夕元 2026-03-20 7/350 2026-03-25 12:00 by edmund7
[考研] 271求调剂 +4 生如夏花… 2026-03-22 4/200 2026-03-25 11:25 by userper
[考研] 上海电力大学材料防护与新材料重点实验室招收调剂研究生(材料、化学、电化学,环境) +4 我爱学电池 2026-03-23 4/200 2026-03-25 00:59 by 1027_324
[考研] 311求调剂 +3 冬十三 2026-03-24 3/150 2026-03-24 21:31 by peike
[考研] 食品专硕 一志愿双一流 328 +3 xiaom99 2026-03-21 4/200 2026-03-24 21:20 by lailaisimei
[考研] 材料调剂 +6 匹克i 2026-03-23 6/300 2026-03-24 21:09 by greychen00
[考研] 0854 考研调剂 招生了!AI 方向 +5 pk3725069 2026-03-19 17/850 2026-03-24 17:30 by zhouxuan..
[考研] 求调剂 +7 十三加油 2026-03-21 7/350 2026-03-23 23:48 by 热情沙漠
[考研] 328求调剂 +4 LHHL66 2026-03-23 4/200 2026-03-23 14:55 by lbsjt
[考研] 石河子大学(211、双一流)硕博研究生长期招生公告 +3 李子目 2026-03-22 3/150 2026-03-22 21:01 by 怎么释怀
[考研] 一志愿中南化学(0703)总分337求调剂 +9 niko- 2026-03-19 10/500 2026-03-22 16:08 by ColorlessPI
[考研] 一志愿华中科技大学071000,求调剂 +4 沿岸有贝壳6 2026-03-21 4/200 2026-03-22 07:21 by ilovexiaobin
[考研] 南京大学化学376求调剂 +3 hisfailed 2026-03-19 6/300 2026-03-20 23:43 by hisfailed
[考研] 求调剂一志愿南京航空航天大学289分 +3 @taotao 2026-03-19 3/150 2026-03-20 21:34 by JourneyLucky
[考研] 086500 325 求调剂 +3 领带小熊 2026-03-19 3/150 2026-03-20 18:38 by 尽舜尧1
信息提示
请填处理意见