Description Usage Arguments Value Author(s) See Also Examples
Description: What the function does in more detail
1 2 |
term |
|
DF |
|
ROW.FUN |
|
COL.FUN |
|
named vector
with row & col location of search
Thomas P. Harte
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | tab<- read.csv(con<- textConnection(
"Name, Age, Salary
Derek , NA, 32k # <- NOTE: 'Derek '
Tom, 26, 21k
NA, NA, NA
Harry, 31, 50k"
), header=TRUE, colClasses=c("character","integer","character"), comment.char="#"); close(con)
match_col("NON-MATCHING-STRING", tab, ROW.FUN="first", COL.FUN="first")
match_col("NON-MATCHING-STRING", tab, ROW.FUN="first", COL.FUN="last")
match_col("NON-MATCHING-STRING", tab, ROW.FUN="last", COL.FUN="first")
match_col("NON-MATCHING-STRING", tab, ROW.FUN="last", COL.FUN="last")
result<- rep(NA,2)
names(result)<- c("row","col")
result["row"]<- 1; result["col"]<- 1
all.equal(match_col("k", tab, ROW.FUN=tutils::first, COL.FUN=tutils::first), result)
result["row"]<- 1; result["col"]<- 3
all.equal(match_col("k", tab, ROW.FUN=tutils::first, COL.FUN=tutils::last), result)
result["row"]<- 4; result["col"]<- 1
all.equal(match_col("r", tab, ROW.FUN=tutils::last, COL.FUN=tutils::first), result) # <- NOTE: testing for "r"
result["row"]<- 4; result["col"]<- 3
all.equal(match_col("k", tab, ROW.FUN=tutils::last, COL.FUN=tutils::last), result) # <- NOTE: testing for "k"
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.