Brought g and f functions out of simulateData
Brought g and f functions to m.r

Could put all of this in a separate file later that we call with source
later to maintain global variable status.
Merge pull request #7 from CY-Chan/master

g and f out of simulateData