由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - [R问题]how to make matrix from list (or the other way around)
相关主题
如何给一个matrix的rownames起个名字name?R问题求教!how to produce a matrix for lists in R
请教R Code, 多谢!弱问个统计问题,求帮助
sas programming questionSQL
菜鸟的SAS问题,向高手求助如何比较两个proc contents的结果?
在 R 里面如何循环调用变量名再问几个R的问题。
How to do 'look up' in R?Name list of certified SAS programer
quick question in R请问如何改变 data set's column 位置. 比如name, id 换成id, name.
在R里想做这个效果的图[合集] 求助,怎样在SAS里读数据的column name?
相关话题的讨论汇总
话题: matrix话题: list话题: names话题: make话题: aa
进入Statistics版参与讨论
1 (共1页)
j***3
发帖数: 142
1
there are N names (e.g. "A", "B", ...)
and there are a list of N*N scores (not ordered) of each directional pair
of names.
e.g.
AA 0
AB 2
AC 0
AD 3
...
how to make a matrix from the list so that:
[,A] [,B] [,C] .....
[A,] 0 2 0
[B,] 2 1 2
[C,] 0 1 2
.....
many thanks
b*****n
发帖数: 685
2
只好搞个for loop了
o**m
发帖数: 828
3
如果是有规则的, 那就
matrix(secondcolumn, N,N)

【在 j***3 的大作中提到】
: there are N names (e.g. "A", "B", ...)
: and there are a list of N*N scores (not ordered) of each directional pair
: of names.
: e.g.
: AA 0
: AB 2
: AC 0
: AD 3
: ...
: how to make a matrix from the list so that:

a********s
发帖数: 188
4
Use "unlist" and then "matrix".
s*r
发帖数: 2757
5
dim(x) <- c(3,3)
j***3
发帖数: 142
6
thank all for suggestions, it is easy with a simple perl script, but I just
wondering if I can do it directly in R.
there is a related question that might be easier in R, I hope, that is how I
can do it the other way, namely, from a known matrix and generate the list
of score for each pairs of names?
1 (共1页)
进入Statistics版参与讨论
相关主题
[合集] 求助,怎样在SAS里读数据的column name?在 R 里面如何循环调用变量名
请教R - 关于meanHow to do 'look up' in R?
[合集] SAS 问题:如何在使用macro的时候保护data。quick question in R
一个愚蠢的SAS loop 问题在R里想做这个效果的图
如何给一个matrix的rownames起个名字name?R问题求教!how to produce a matrix for lists in R
请教R Code, 多谢!弱问个统计问题,求帮助
sas programming questionSQL
菜鸟的SAS问题,向高手求助如何比较两个proc contents的结果?
相关话题的讨论汇总
话题: matrix话题: list话题: names话题: make话题: aa