-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
730bf2e
commit 97bab41
Showing
12 changed files
with
97 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
Package: gendata | ||
Type: Package | ||
Title: Generate and Modify Synthetic Datasets | ||
Version: 1.1 | ||
Date: 2015-02-27 | ||
Version: 1.2.0 | ||
Date: 2022-05-09 | ||
Author: Francis Huang <flh3@hotmail.com> | ||
Maintainer: Francis Huang <flh3@hotmail.com> | ||
Description: Set of functions to create datasets using a correlation matrix. | ||
License: GPL-3 | ||
Packaged: 2015-03-01 00:27:32 UTC; huangf | ||
NeedsCompilation: no | ||
Packaged: 2022-05-09 21:40:21 UTC; flh3 | ||
Repository: CRAN | ||
Date/Publication: 2015-03-01 08:20:17 | ||
Date/Publication: 2022-05-09 21:50:02 UTC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
d24062a9da5bf317849a4f9f55c7425b *DESCRIPTION | ||
df390c53434517b304ac5db487184641 *NAMESPACE | ||
342f1ce5c35aeb3cf31f40751e358665 *R/dtrans.R | ||
095100e3b3da1f45b3598b24015efb31 *R/genmvnorm.R | ||
01ef3ab6e2a122c3c91d6870bc17a2e6 *R/recalib.R | ||
4cbd5ff37108a8c4cd99a19946511f89 *R/revcode.R | ||
ee03b3f57121283e65077055b925d2e7 *man/dtrans.Rd | ||
0d518d37b4fcc76ec1c6fb54d1154925 *DESCRIPTION | ||
901331ca84ce9a4c48f13b6f3c345713 *NAMESPACE | ||
030758d4fc185b2e3dbd0eec5ae9f704 *NEWS.md | ||
c0205abf0548202c060f77fa82e712d7 *R/dtrans.R | ||
be085e3c9d0854c746af9ccff06bca44 *R/genmvnorm.R | ||
9b91c42e2e1b13213efd59e72a597bf8 *R/recalib.R | ||
94e1cc2fad3a571b2bafca401160171d *R/revcode.R | ||
f8b23867f24b2e0d1e66038f48228cc8 *README.md | ||
44d1f5b47fd8044323ad2b44f8e91375 *man/dtrans.Rd | ||
fba3faa2ba40f50b4a7edaa14e4320ff *man/gendata-package.Rd | ||
2e045b7357aa5e2ed17cb27a065962a0 *man/genmvnorm.Rd | ||
c1b548f7156dc9fcc7e51e5d55100240 *man/recalib.Rd | ||
9214c09fde33d3ec4e7842541fb05ff0 *man/genmvnorm.Rd | ||
f95f68cdd0f0073fc7c8a7aa9101b65d *man/recalib.Rd | ||
a0f1851ab48c58d59a1ec40b87589faa *man/revcode.Rd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
exportPattern("^[[:alpha:]]+") | ||
importFrom("stats", "rnorm") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# 2022.05.09 v. 1.2 | ||
- Adjusted spacing in function to make it more readable. | ||
- Updated package to use (based on e-mail from CRAN): | ||
|
||
Consider adding | ||
importFrom("stats", "rnorm") | ||
to your NAMESPACE file. | ||
|
||
# 2015-02-27 v. 1.1 | ||
- minor update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
#transform dataset to specified m and sd | ||
dtrans<-function(data,m,sd,rnd=F){ | ||
dtrans <- function(data, m, sd, rnd = FALSE){ | ||
#basic checking | ||
x<-dim(data)[2] #getting number of vars | ||
cat("Number of variables in dataset:", x,"\n")#number of vars | ||
cat("Number of means specified:", length(m),"\n") | ||
cat("Number of standard deviations in dataset:", length(sd),"\n") | ||
if(length(m) != length(sd)){stop("Number of means/SDs should match.")} | ||
if(length(m) != dim(data)[2]){stop("Incorrect number of means/SDs")} | ||
for (i in 1:x){ | ||
xrange<-range(data[,1]) | ||
if(xrange[1]-xrange[2]==0){stop("Constant value detected")} | ||
x <- dim(data)[2] #getting number of vars | ||
cat("Number of variables in dataset:", x,"\n")#number of vars | ||
cat("Number of means specified:", length(m),"\n") | ||
cat("Number of standard deviations in dataset:", length(sd),"\n") | ||
if(length(m) != length(sd)){stop("Number of means/SDs should match.")} | ||
if(length(m) != dim(data)[2]){stop("Incorrect number of means/SDs")} | ||
for (i in 1:x){ | ||
xrange <- range(data[,1]) | ||
if(xrange[1] - xrange[2] == 0){stop("Constant value detected")} | ||
} | ||
|
||
#transforming | ||
for (i in 1:x){ | ||
data[i]=m[i]+sd[i]*data[i] | ||
data[i] = m[i] + sd[i] * data[i] | ||
} | ||
if(rnd==T){return(round(data,0)) | ||
} else {return(data)} | ||
if(rnd == TRUE){return(round(data, 0)) | ||
} else { | ||
return(data)} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
recalib<-function(data,var,low,high){ | ||
nmin<-low | ||
nmax<-high | ||
if(low>high){ | ||
nmax<-low | ||
nmin<-high | ||
recalib<-function(data, var, low, high){ | ||
nmin <- low | ||
nmax <- high | ||
if(low > high){ | ||
nmax <- low | ||
nmin <- high | ||
} | ||
cmin<-min(data[,var]) | ||
cmax<-max(data[,var]) | ||
cmin <- min(data[,var]) | ||
cmax <- max(data[,var]) | ||
|
||
data[,var]<-(nmax-nmin)/(cmax-cmin)*(data[,var]-cmin)+nmin | ||
data[,var] <- (nmax - nmin) / (cmax - cmin) * (data[,var] - cmin) + nmin | ||
return(data) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
#reverse coding | ||
revcode<-function(data,vars){ | ||
x<-length(vars) | ||
revcode <- function(data, vars){ | ||
x <- length(vars) | ||
for (i in 1:x){ | ||
mx<-max(data[,vars[i]]) | ||
mn<-min(data[,vars[i]]) | ||
data[,vars[i]]<-(mx)-data[,vars[i]]+(mn) | ||
mx <- max(data[,vars[i]]) | ||
mn <- min(data[,vars[i]]) | ||
data[,vars[i]] <- (mx) - data[,vars[i]] + (mn) | ||
} | ||
return(data) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# gendata | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters