addOn {GCDkit} | R Documentation |
Add missing columns ("what") to a matrix "where", fill with "value".
addOn(what,value=NA,where=WR)
what |
character or numeric, specifies the column in the matrix |
value |
numeric vector with the replacement |
where |
a matrix in which the replacement is to be done |
The function serves two purposes. If a column with the name 'what
' does not
exist in the numeric data matrix where
, it appends a new column and fills
it with 'value
'.
On the other hand, if the column 'what
' does exist, the function attempts
to replace only the empty (NA) values by the specified values '(value
)'.
Note that by default, no permanent assignment to the original data matrix is done.
Returns the modified version of the matrix where
.
Vojtěch Janoušek, vojtech.janousek@geology.cz
data(sazava) accessVar("sazava") # The original version of WR not affected addOn("MgO/FeO",WR[,"MgO"]/WR[,"FeOt"]) # Permanent assignment WR<-addOn("MgO/FeO",WR[,"MgO"]/WR[,"FeOt"])