pgirmess (version 1.6.9)

val4symb: Center a numerical vector on a parameter position and provides absolute values and colors according to negative and positive values

Description

Center a numerical vector on a parameter position and provides absolute values and colors according to negative and positive values

Usage

val4symb(x, FUN=mean, col = c("blue", "red"),...)

Arguments

x

a numerical vector

FUN

a function computing a position parameter, typically mean or median. Default to mean

col

a character vector of 2 values, default=c("blue","red"), blue for <0, red for >=0

optional arguments to 'FUN'

Value

A list with

size

the absolute values of the difference to the position parameter (eg mean, median)

col

a character vector with 2 colors, each corresponding to positive or negative values

See Also

symbols, mean, median, scale

Examples

Run this code
# NOT RUN {
x<-rnorm(30)
y<-rnorm(30)

z<-val4symb(rnorm(30))
symbols(x,y,circle=z$size,inches=0.2,bg=z$col)

z<-val4symb(scale(rnorm(30)))
symbols(x,y,circle=z$size,inches=0.2,bg=z$col)

z<-val4symb(rnorm(30),col=c("green","violet"))
symbols(x,y,circle=z$size,inches=0.2,bg=z$col)

z<-val4symb(rnorm(30),trim=0.025)
symbols(x,y,circle=z$size,inches=0.2,bg=z$col)

z<-val4symb(rnorm(30),median)
symbols(x,y,circle=z$size,inches=0.2,bg=z$col)

myfun<-function(x) 20 # passes an arbitrary constant
z<-val4symb(1:30,myfun)
symbols(x,y,circle=z$size,inches=0.2,bg=z$col)


# }

Run the code above in your browser using DataLab