由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - Ask for R help
相关主题
[R] a row of a matrix is not a matrix?统计 vs Cs
Sas问题, 有包子EE master 找 统计 工作
How to avoid if statement in R做Patient Claims Data Report 对以后找业界工作有多大帮助?
统计菜鸟请教问题:关于linear regression问一个排列组合问题
Re: principal component analysisCollapsing for GSEA
linear algebra question[分享]Probability and Statistics相关资料合集
求助:为什么box-cox transformed 后的varibale 不normal请问有这样的statistics么?
Matlab Out of Memory 的问题when to collapse groups in cumulative logit model
相关话题的讨论汇总
话题: row话题: ask话题: 010话题: 001话题: 3rd
进入Statistics版参与讨论
1 (共1页)
y***6
发帖数: 46
1
Hi all,
I am new to R and hope I can get some help here.
Say I have a matrix A as below
A<-[0 0 1, ->1st row
0 1 0, ->2nd row
0 0 1, ->3rd row
1 0 0] ->4th row
Now rows of A are considered to be factors, i.e. "001","010","100" in this
case. The output matrices B and C are desired,
B<-[001 2,->1st row
010 1,->2nd row
100 1]->3rd row
t**i
发帖数: 688
2
paste(A[1,], collapse=TRUE)
D*******a
发帖数: 207
3
data.frame(table(A))
D******n
发帖数: 2836
4
B=apply(A,1,function(x)(paste(x,collapse="")));
B=data.frame(table(B));

【在 D*******a 的大作中提到】
: data.frame(table(A))
y***6
发帖数: 46
5
I am amazed! Thanks a lot!!
y***6
发帖数: 46
6
Only the code given by Da Shagen is correct. I appreciate it.
1 (共1页)
进入Statistics版参与讨论
相关主题
when to collapse groups in cumulative logit modelRe: principal component analysis
请教proc sql处理missing value的问题linear algebra question
Positions in Statistics and Econometrics求助:为什么box-cox transformed 后的varibale 不normal
desired salaryMatlab Out of Memory 的问题
[R] a row of a matrix is not a matrix?统计 vs Cs
Sas问题, 有包子EE master 找 统计 工作
How to avoid if statement in R做Patient Claims Data Report 对以后找业界工作有多大帮助?
统计菜鸟请教问题:关于linear regression问一个排列组合问题
相关话题的讨论汇总
话题: row话题: ask话题: 010话题: 001话题: 3rd