Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
9
Task/Map-range/R/map-range.r
Normal file
9
Task/Map-range/R/map-range.r
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
tRange <- function(aRange, bRange, s)
|
||||
{
|
||||
#Guard clauses. We could write some proper error messages, but this is all we really need.
|
||||
stopifnot(length(aRange) == 2, length(bRange) == 2,
|
||||
is.numeric(aRange), is.numeric(bRange), is.numeric(s),
|
||||
s >= aRange[1], s <= aRange[2])
|
||||
bRange[1] + ((s - aRange[1]) * (bRange[2] - bRange[1])) / (aRange[2] - aRange[1])
|
||||
}
|
||||
data.frame(s = 0:10, t = sapply(0:10, tRange, aRange = c(0, 10), bRange = c(-1, 0)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue