tests/testthat/test_readcsv-functions.R

context("readcsv-functions")

test_that("readcsv", {
  content <- "Protein Key,Peptide.seq,intensity\nA_B,ABCD,1\nA_D,DCBA,2"

  df <- data.frame("ProteinKey"=c("A_B", "A_D"), intensity=1:2,
                   stringsAsFactors=FALSE)
  colnames(df) <- c("Protein Key", "intensity")

  readcsv(content, keepCols=c("Protein Key" = "c", "intensity" = "d"))
  expect_equal(synapter:::readcsv(content, keepCols=c("Protein Key" = "c",
                                                      "intensity" = "d")), df, check.attributes=FALSE)
})

Try the synapter package in your browser

Any scripts or data that you put into this service are public.

synapter documentation built on Nov. 8, 2020, 6:25 p.m.