updatevals {primate}R Documentation

Update the values of an AWP data.frame

Description

Update the values in an old dataframe with the values in a new dataframe. Useful for comparing a pre-existing or self-assembled dataset with AWP.

Usage

updatevals(x,y=NULL,v.old,v.new,verbose=TRUE,update=FALSE,
                    na.only=TRUE,all=TRUE,missing.only=TRUE)

Arguments

x

first dataframe

y

second dataframe

v.old

variable old

v.new

variable new

verbose

get all the messages

update

update all the old with everything new

na.only

just update the missing values in the old dataframe

all

perform merge on all columns

missing.only

update only those that have missing values

Value

values of one data frame are updated to reflect new data in another

Examples

pri.tab <- AWP.read.pkg.tab(tab.nm='Locomotion')
#pri.AWP <- AWP.get.SQL.table(tab.nm='Locomotion') 

dim(pri.tab) #should may be fewer cols or rows locally ...
#dim(pri.AWP) # than there are available online.

apply(pri.tab, 2, function(x) sum(is.na(x))) # also more missing values
#apply(pri.AWP, 2, function(x) sum(is.na(x))) #  locally than online

# update the "Comment" column locally with the same online

vars <- c('LocomotionID','Comment')
#tmp <- merge(x=pri.tab[,c(vars)] ,y=pri.AWP[,c(vars)], by='LocomotionID')

#out <- updatevals(x=tmp,y=NULL,v.old='Comment.x',v.new='Comment.y')


[Package primate version 0.2.0 Index]