官术网_书友最值得收藏!

Converting a matrix to a data frame and a data frame to a matrix

A matrix is a two-dimensional arrangement of data with rows and columns where each row/column is of the same data type, either all numeric, all character, or all logical. Moreover, the number of elements in each column should be the same, and the number of elements in each row should also be the same.

A data frame is also a two-dimensional arrangement of data with rows and columns, but each column could be of very different types; for example, a data frame may contain both character and numeric columns. However, the number of elements in each column should be the same. Since both data structures share some common properties, they could be converted from one structure to another. In this recipe, you will learn to convert a matrix to a data frame and a data frame to a matrix.

主站蜘蛛池模板: 师宗县| 宜君县| 通河县| 湘乡市| 涟源市| 潍坊市| 光山县| 肥乡县| 同心县| 石门县| 博客| 南溪县| 盖州市| 金堂县| 正镶白旗| 龙岩市| 山东| 潢川县| 怀仁县| 辉县市| 阿克陶县| 张掖市| 新乡市| 郴州市| 高密市| 新蔡县| 永州市| 思茅市| 科尔| 临邑县| 宁安市| 奉贤区| 岳阳县| 万源市| 从化市| 惠东县| 永川市| 陇西县| 洛南县| 民和| 五寨县|