calc {GCDkit}R Documentation

Calculate a new variable

Description

Calculates a single numeric variable and appends it to the data.

Usage

calc()

Details

The formula can invoke any combination of names of existing numerical columns, with the constants, brackets, arithmetic operators +-*/^ and R functions. See calcCore for a correct syntax.

If the result is a vector of the length corresponding to the number of the samples in the system, the user is prompted for the name of the new data column. Unless a column with the specified name already exists or the given name is empty, the newly calculated column is appended to the data in memory ('WR').

Value

results

numerical vector with the results

Modifies, if appropriate, the numeric matrix 'WR'.

Author(s)

Vojtech Janousek, vojtech.janousek@geology.cz

See Also

selectColumnLabel.

Examples

## Not run: 
# examples of valid formulae....
(Na2O+K2O)/CaO
Rb^2
log10(Sr)
mean(SiO2)/10

# ... but this command is in fact a simple R shell - 
# meaning lots of fun for power users!
summary(Rb,na.rm=T)
cbind(SiO2/2,TiO2,Na2O+K2O)
cbind(major) 
hist(SiO2,col="red")
boxplot(Rb~factor(groups))

# possibilities are endless
plot(Rb,Sr,col="blue",pch="+",xlab="Rb (ppm)",ylab="Sr (ppm)",log="xy")

## End(Not run)

[Package GCDkit version 4.0 Index]