Description Usage Arguments Value Examples
Function to test t(Matrix()) without import(Matrix), etc.
1 | tr(x)
|
x |
an object to be transposed. |
t(x)
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.