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

How it works…

The matrix() function takes the input of as a vector, number of rows, number of columns, and whether the arrangement should be by row or not. The function then places the elements of the vector into a two-dimensional arrangement based on the nrow and ncol values. By default, it fills the elements column by column if byrow is not explicitly specified. However, if byrow=TRUE is specified, then the elements fill by one row at a time.

The cbind() and rbind() functions are very similar to the concatenation function c(), but the cbind() function places the vector as columns in a two-dimensional representation and rbind() places the vectors as rows in a two-dimensional representation to create a matrix.

The array() function takes two necessary inputs: one is a vector of elements and another is a vector of dimensions. If you use only two numbers in the dim = argument, then this function will create a matrix and the elements will be filled column by column.

主站蜘蛛池模板: 汉中市| 吉安市| 祁东县| 乳山市| 客服| 眉山市| 宁河县| 夏邑县| 定安县| 台中县| 新昌县| 和平县| 水城县| 内丘县| 鹰潭市| 昌乐县| 大余县| 法库县| 七台河市| 昆明市| 高雄市| 丰原市| 亚东县| 岳阳市| 德兴市| 西乌珠穆沁旗| 福鼎市| 安宁市| 杨浦区| 子长县| 道孚县| 宣汉县| 赣榆县| 陇南市| 宜章县| 墨竹工卡县| 郴州市| 迁西县| 鄂州市| 廊坊市| 乐清市|