Description Usage Arguments Value See Also Examples
View source: R/Vector2String.R
A simple utility function that transforms any vector into a single character
string, where the former vector elements are separated by commas. This is can
be useful, in some circumstances, for feeding a series of constant numeric
values to phasePortrait
(see examples). For most applications
we recommend, however, to use phasePortrait
's parameter
moreArgs
instead.
1 | vector2String(vec)
|
vec |
The (usually real or complex valued) vector to be converted. |
A string, where the former vector elements are separated by commas, enclosed between "c(" and ")".
Other helpers:
xlimFromYlim()
,
ylimFromXlim()
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 | # Make a vector of 77 complex random numbers inside the unit circle
n <- 77
a <- complex(n, modulus = runif(n), argument = 2*pi*runif(n))
a <- vector2String(a)
print(a)
# Use this for portraying a Blaschke product
# x11(width = 9.45, height = 6.30) # Screen device commented out
# due to CRAN test requirements.
# Use it when trying this example
op <- par(mar = c(1, 1, 1, 1), bg = "black")
n <- 77
a <- complex(n, modulus = runif(n), argument = 2*pi*runif(n))
a <- vector2String(a)
FUN <- paste("vapply(z, function(z, a){
return(prod(abs(a)/a * (a-z)/(1-Conj(a)*z)))
}, a =", a,
", FUN.VALUE = complex(1))", sep = "")
phasePortrait(FUN, pType = "p", axes = FALSE,
xlim = c(-3, 3), ylim = c(-2.0, 2.0),
nCores = 2) # Max. two cores allowed on CRAN
# not a limit for your own use
par(op)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.