findFirstLast: The first or the last occurence of a unique value.

Description Usage Arguments Details Author(s) See Also Examples

View source: R/findFirstLast.R

Description

This function can be used to find the first or the last occurence of each unique value in a column.

Usage

1
findFirstLast(myDF, findFirst = TRUE)

Arguments

myDF

a data.frame or a matrix.

findFirst

a logical variable indicating the first or the last occurence.

Details

By default, it finds the first occurence (i.e. findFirst = TRUE). If instead, we want to find the last, we must set findFirst = FALSE.

Author(s)

Artemis Toumazi <artemis.toumazi@gmail.com>, Sarah Zohar <sarah.zohar@inserm.fr>, Anand N. Vidyashankar <avidyash@gmu.edu>, Jie Xu <jxu13@gmu.edu> and Moreno Ursino <moreno.ursino@inserm.fr>

See Also

VarWT

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
  ################################################################
  ### Give a toxicity data for each simulation and each trial. ###
  ################################################################
  
  ### Using a toxicity data for each simulation and each trial including in the dfmeta package.
  
  data("Toxdata")
  dim(Toxdata)
  colnames(Toxdata)
  
  ## NOTE: The toxicity dataset must have the same structure as below. ##
  ## Check it before running the VarWT function! ##
  str(Toxdata)
  
  analyf0 <- Toxdata[order(Toxdata$simulation), ] # sort the imported data by simulation.
  
  ## Using the function findFirstLast to find when starts the first trial. ##
  first.trial = findFirstLast(analyf0)$Trial

dfmeta documentation built on May 1, 2019, 7:59 p.m.