summaryrefslogtreecommitdiff
path: root/conversion
blob: bac5a340222761b7d86a242e888c8970be9a1469 (plain)
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
28
29
30
31
########################################################################   f2c#   convert evil Fahrenheit to Celcius#   SJP     April 2007f2c <- function(deg, sc='F', string=FALSE){#   sc == scale (default is f therefore cvt tfrom F to C)  sc <- substr(toupper(sc),1,1)       # clean input	if (sc=='F'){	    res <- (deg - 32) * (5/9)	    to <- 'C'	} else {	    res <- deg * 1.8 + 32	    to <- 'F'; sc <- 'C'	}	if (string) res <- sprintf('Converted from %i %1s to %i %1s.', 						round(deg, 0), sc, round(res, 0), to)	return(res)}###########  Exponential growth functions #####################################################################################################   convert growth rate ('interest rate' version) to doubling timedblTime <- function(x) {	return(log(2)/log(1 + x))}########################################################################	convert doubling time to 'interest rate'intRate <- function(x) {	return((exp(log(2)/x))-1)}