tr: Matrix transpose

Description Usage Arguments Value Examples

Description

Function to test t(Matrix()) without import(Matrix), etc.

Usage

1
tr(x)

Arguments

x

an object to be transposed.

Value

t(x)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
M. <- M()
mt <- tr(as.matrix(M.))

# check

all.equal(as.matrix(M.), mt)


t(M.) # works --> BUT:
## Not run: 
Mt <- tr(M.)

# does NOT work,
# because Matrix is NOT in the NAMESPACE
# for tstPkg2

### R CMD check ends as follows:
* checking examples ... ERROR
Running examples in 'tstPkg2-Ex.R' failed
The error most likely occurred in:

> ### Name: tr
> ### Title: Matrix transpose
> ### Aliases: tr
> ### Keywords: manip
>
> ### ** Examples
>
> M. <- M()
> Mt <- tr(M.)
Error in t.default(x) : argument is not a matrix
Calls: tr -> t -> t.default
Execution halted

## End(Not run)

tstPkg2 documentation built on May 2, 2019, 4:46 p.m.

Related to tr in tstPkg2...