Skip to content

Commit aa6551e

Browse files
author
Arni Magnusson
committed
Sync with 2.18.0 on CRAN
1 parent 4eac346 commit aa6551e

File tree

9 files changed

+306
-264
lines changed

9 files changed

+306
-264
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ Description: Various R programming tools for data manipulation, including:
2323
Depends: R (>= 2.3.0)
2424
SystemRequirements: perl (>= 5.10.0)
2525
Imports: gtools, stats, methods, utils
26-
Version: 2.17.0
27-
Date: 2015-07-02
26+
Version: 2.18.0
27+
Date: 2017-06-05
2828
Author: Gregory R. Warnes, Ben Bolker, Gregor Gorjanc, Gabor
2929
Grothendieck, Ales Korosec, Thomas Lumley, Don MacQueen, Arni
3030
Magnusson, Jim Rogers, and others

NAMESPACE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export(
4444
trimSum,
4545
unmatrix,
4646
update.list,
47-
update.data.frame,
47+
#update.data.frame,
4848
upperTriangle,
4949
"upperTriangle<-",
5050
wideByFactor,
@@ -171,4 +171,4 @@ S3method(right, matrix)
171171

172172
# update methods for list, data.frame
173173
S3method(update, list)
174-
S3method(update, data.frame)
174+
#S3method(update, data.frame)

R/startsWith.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
startsWith <- function(str, pattern, trim=FALSE, ignore.case=FALSE)
22
{
33
if(trim) str <- trim(str)
4+
45
if(ignore.case)
56
{
67
str <- toupper(str)
78
pattern <- toupper(pattern)
8-
}
9-
substr(str,start=1,stop=nchar(pattern))==pattern
9+
}
10+
11+
#substr(str,start=1,stop=nchar(pattern))==pattern
12+
13+
base::startsWith(str, pattern)
1014
}

R/update.data.frame.R

Lines changed: 48 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,48 @@
1-
# This function replace rows in 'x' by corresponding rows in 'y' the have
2-
# the same value for 'by'
3-
update.data.frame <- function(x, y, by, by.x=by, by.y=by, append=TRUE, verbose=TRUE, ...)
4-
{
5-
retval <- x
6-
x.by <- x[[by.x]]
7-
y.by <- y[[by.y]]
8-
9-
matches.x <- match(y.by, x.by)
10-
matches.y <- which(!is.na(matches.x))
11-
nomatch.y <- which(is.na(matches.x))
12-
matches.x <- matches.x[!is.na(matches.x)]
13-
14-
if(length(matches.x)>0)
15-
retval[matches.x, ] <- y[matches.y,]
16-
17-
if(length(nomatch.y) && append)
18-
retval <- rbind(retval, y[nomatch.y,])
19-
20-
if(verbose)
21-
{
22-
cat("\n")
23-
cat("Number of rows in x :", nrow(x), "\n")
24-
cat("Number of rows in y :", nrow(y), "\n")
25-
cat("\n")
26-
cat("Number of rows replaced :", length(matches.x), "\n")
27-
cat("Number of rows appended :", length(nomatch.y), "\n")
28-
cat("\n")
29-
cat("Number of rows in result:", nrow(retval), "\n")
30-
cat("\n")
31-
}
32-
retval
33-
}
1+
# # This function replace rows in 'object' by corresponding rows in 'new' that have
2+
# # the same value for 'by'
3+
# update.data.frame <- function(object,
4+
# new,
5+
# by,
6+
# by.object=by,
7+
# by.new=by,
8+
# append=TRUE,
9+
# verbose=TRUE,
10+
# ...)
11+
# {
12+
# retval <- object
13+
#
14+
# if(length(by.object)>1)
15+
# stop("'by.object' can specify at most one column")
16+
#
17+
# if(length(by.new)>1)
18+
# stop("'by.new' can specify at most one column")
19+
#
20+
#
21+
# object.by <- object[[by.object]]
22+
# new.by <- new [[by.new ]]
23+
#
24+
# matches.object <- match(new.by, object.by)
25+
# matches.new <- which(!is.na(matches.object))
26+
# nomatch.new <- which(is.na(matches.object))
27+
# matches.object <- matches.object[!is.na(matches.object)]
28+
#
29+
# if(length(matches.object)>0)
30+
# retval[matches.object, ] <- new[matches.new,]
31+
#
32+
# if(length(nomatch.new) && append)
33+
# retval <- rbind(retval, new[nomatch.new,])
34+
#
35+
# if(verbose)
36+
# {
37+
# cat("\n")
38+
# cat("Number of rows in object:", nrow(object), "\n")
39+
# cat("Number of rows in new :", nrow(new), "\n")
40+
# cat("\n")
41+
# cat("Number of rows replaced :", length(matches.object), "\n")
42+
# cat("Number of rows appended :", length(nomatch.new), "\n")
43+
# cat("\n")
44+
# cat("Number of rows in result:", nrow(retval), "\n")
45+
# cat("\n")
46+
# }
47+
# retval
48+
# }

R/update.list.R

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
## this function updates the elements of list 'object' to contain all of the elements
22
## of 'new', overwriting elements with the same name, and (optionally) copying unnamed
33
## elements.
4-
update.list <- function(object, new, unnamed=FALSE, ...)
4+
update.list <- function(object,
5+
new,
6+
unnamed=FALSE,
7+
...)
58
{
69
retval <- object
710

@@ -17,4 +20,5 @@ update.list <- function(object, new, unnamed=FALSE, ...)
1720
}
1821

1922
retval
20-
}
23+
}
24+

0 commit comments

Comments
 (0)