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

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.

主站蜘蛛池模板: 巩义市| 乐都县| 嘉黎县| 江阴市| 城市| 广宁县| 高阳县| 大余县| 北海市| 绥阳县| 奈曼旗| 崇明县| 南溪县| 宣汉县| 隆德县| 车致| 吕梁市| 新干县| 梨树县| 武乡县| 乌兰浩特市| 尼玛县| 潜江市| 德兴市| 鲁甸县| 嘉鱼县| 新蔡县| 临漳县| 玛多县| 永川市| 建宁县| 边坝县| 昌邑市| 宣武区| 宜宾市| 吉林省| 名山县| 杭锦旗| 定远县| 九龙坡区| 邹平县|