0% found this document useful (0 votes)
25 views3 pages

Fist Class Statistical Modellimg

Uploaded by

jeikob melaku
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views3 pages

Fist Class Statistical Modellimg

Uploaded by

jeikob melaku
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

> A=matrix(1:9,3,3)

> A
[,1] [,2] [,3]
[1,] 1 4 7
[2,] 2 5 8
[3,] 3 6 9

seq(...)

## Default S3 method:
seq(from = 1, to = 1, by = ((to - from)/(length.out - 1)),
length.out = NULL, along.with = NULL, ...)

seq.int(from, to, by, length.out, along.with, ...)

seq_along(along.with)
seq_len(length.out)

A1=matrix(1:20,5,4)
> A1
[,1] [,2] [,3] [,4]
[1,] 1 6 11 16
[2,] 2 7 12 17
[3,] 3 8 13 18
[4,] 4 9 14 19
[5,] 5 10 15 20
> dim(A1)
[1] 5 4

> A1[3,3]
[1] 13

> A1[2,]
[1] 2 7 12 17

>
> A1[,4]
[1] 16 17 18 19 20

matrix(data = NA, nrow = 1, ncol = 1, byrow = FALSE,


dimnames = NULL)

as.matrix(x, ...)
## S3 method for class 'data.frame'
as.matrix(x, rownames.force = NA, ...)

is.matrix(x)
x1=c(7,2,10,11,3,4)
x1
[1] 7 2 10 11 3 4
> is.matrix(x1)
[1] FALSE

> x3=c(4,7,2,"a",T)
> x3
[1] "4" "7" "2" "a" "TRUE"

x=1:10
> y=21:30
> z=cbind(x,y)
> z
x y
[1,] 1 21
[2,] 2 22
[3,] 3 23
[4,] 4 24
[5,] 5 25
[6,] 6 26
[7,] 7 27
[8,] 8 28
[9,] 9 29
[10,] 10 30

> z1=rbind(x,y)
> z1
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
x 1 2 3 4 5 6 7 8 9 10
y 21 22 23 24 25 26 27 28 29 30

letters[1:10]
[1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j"

cbind(x,letters[1:10])
x
[1,] "1" "a"
[2,] "2" "b"
[3,] "3" "c"
[4,] "4" "d"
[5,] "5" "e"
[6,] "6" "f"
[7,] "7" "g"
[8,] "8" "h"
[9,] "9" "i"
[10,] "10" "j"
> data.frame(x,letters[1:10])
x letters.1.10.
1 1 a
2 2 b
3 3 c
4 4 d
5 5 e
6 6 f
7 7 g
8 8 h
9 9 i
10 10 j

> array(1:10,c(1,10,1))
, , 1

[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] 1 2 3 4 5 6 7 8 9 10

> array(1:10,c(2,5,1))
, , 1

[,1] [,2] [,3] [,4] [,5]


[1,] 1 3 5 7 9
[2,] 2 4 6 8 10

You might also like