Learn R Programming

pgirmess (version 2.0.2)

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"),...)

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

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'

See Also

Examples

Run this code
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