When I try converting a matrix to a data frame, it works for me:

 > x <- matrix(1:6,ncol=2,dimnames=list(LETTERS[1:3],letters[24:25]))
> data.frame(x)
x y
A 1 4
B 2 5
C 3 6
> str(data.frame(x))
`data.frame': 3 obs. of 2 variables:
$ x: int 1 2 3
$ y: int 4 5 6
> You can also use as.data.frame() to convert a matrix to a data.frame
(but note that if colnames are missing form the matrix, as.data.frame()
constructs different colnames than does data.frame(). =========================================
> data <- c(0.1, 0.2, 0.3, 0.3, 0.4, 0.5)
> dimnames <- list(time=c(0, 0.5, 1), name=c("C_0", "C_1"))
> mat <- matrix(data, ncol=2, nrow=3, dimnames=dimnames)
> as.data.frame(as.table(mat))
time name Freq
1 0 C_0 0.1
2 0.5 C_0 0.2
3 1 C_0 0.3
4 0 C_1 0.3
5 0.5 C_1 0.4
6 1 C_1 0.5
=========================================
REF:
https://stackoverflow.com/questions/15885111/create-data-frame-from-a-matrix-in-r
https://stat.ethz.ch/pipermail/r-help/2006-January/085978.html
 
												

最新文章

  1. 普通硬件就能破解GSM A5加密算法
  2. 如何用SQL语句实现Mysql数据库的备份与还原
  3. [2016.01.18]文本替换专家 v5.3
  4. Eclipse+Tomcat+MAVEN+SVN项目完整环境搭建
  5. Codeforces Round #222 (Div. 1) C. Captains Mode 对弈+dp
  6. JRE下的rt.jar、tools.jar
  7. 自制单片机之十一……模数转换IC ADC0809
  8. java decompiler如何去掉行号
  9. flask-session组件
  10. HDP2.0.6+hadoop2.2.0+eclipse(windows和linux下)调试环境搭建
  11. Dynamics CRM2013 任务列表添加自定义按钮
  12. 【Android 应用开发】Android开发 使用 adb logcat 显示 Android 日志
  13. 无依赖简单易用的Dynamics 365实体记录数计数器并能计算出FetchXml返回的记录数
  14. Python第7天
  15. tesseract安装及问题处理
  16. 转载 c# automapper 使用(一) https://www.cnblogs.com/caoyc/p/6367828.html
  17. NOIP模拟赛20180917 隐藏题目
  18. TypeError: atlas.getSpriteFrame is not a function
  19. php正则的使用
  20. java泛型学习(1)

热门文章

  1. centos 7 安装python3和pip
  2. PostgreSQL判断是否为空coalesce
  3. tmux使用及配置
  4. (原创)舌尖上的c++--相逢
  5. javascript基础拾遗(六)
  6. 【Mysql】Fedora下 Mysql 安装及配置
  7. Windows / VS下不同类型变量转换
  8. 猥琐百度杯猥琐CTF
  9. Android 程序drawable资源保存到data目录
  10. win8中的参数传递