Skip to content

Commit 4655cdb

Browse files
author
Lindsay Carr
committed
move indexing fix into function_args
1 parent a1a239c commit 4655cdb

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

R/function_args.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ function_args <- function(package, name, object, ..., use.default=paste0(name,'.
4545
names(params)[which(names(params) == "")] <- arg.names[seq_len(sum(names(params) == ""))]
4646
}
4747

48+
if(name %in% c('points', 'lines')){
49+
if(!is.null(params[['x']]) & is.null(params[['y']])){
50+
xy_args <- list(x = seq_along(params[['x']]),
51+
y = params[['x']])
52+
params <- append_replace(params, xy_args)
53+
}
54+
}
4855

4956
# // re-order
5057
sort.i <- seq_len(length(params))

R/set_args.R

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ set_args <- function(fun.name, ..., custom.config = FALSE, package='graphics'){
1414
config_args <- config(fun.name, custom.config = custom.config)
1515
user_args <- function_args(name=fun.name, package=package, ...)
1616

17-
if(fun.name %in% c('points', 'lines')){
18-
if(!is.null(user_args[['x']]) & is.null(user_args[['y']])){
19-
xy_args <- list(x = seq_along(user_args[['x']]),
20-
y = user_args[['x']])
21-
user_args <- append_replace(user_args, xy_args)
22-
}
23-
}
24-
2517
indicesToAdd <- !(names(config_args) %in% names(user_args))
2618
arguments <- append(user_args, config_args[indicesToAdd])
2719
return(arguments)

0 commit comments

Comments
 (0)