Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
ProcMod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LECASofts
ProcMod
Commits
a0d24c8b
Commit
a0d24c8b
authored
Oct 16, 2019
by
Eric Coissac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make doParallel optionnal and should solve the windows problem during CRAN checks
parent
c4c6c590
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
12 deletions
+15
-12
DESCRIPTION
DESCRIPTION
+2
-2
NAMESPACE
NAMESPACE
+0
-1
R/covls.R
R/covls.R
+9
-5
R/simulate.R
R/simulate.R
+2
-2
man/simulate_correlation.Rd
man/simulate_correlation.Rd
+2
-2
No files found.
DESCRIPTION
View file @
a0d24c8b
...
...
@@ -16,7 +16,6 @@ Imports: MASS,
Matrix,
mvtnorm,
stats,
doParallel,
foreach,
Rdpack
Suggests: knitr,
...
...
@@ -24,7 +23,8 @@ Suggests: knitr,
roxygen2,
vegan,
testthat,
ade4
ade4,
doParallel
RdMacros: Rdpack
Collate:
'internals.R'
...
...
NAMESPACE
View file @
a0d24c8b
...
...
@@ -38,7 +38,6 @@ export(simulate_correlation)
export(simulate_matrix)
export(varls)
import(MASS)
import(doParallel)
import(foreach)
import(permute)
import(stats)
...
...
R/covls.R
View file @
a0d24c8b
#' @include procmod.R
#' @include procmod_frame.R
#' @include multivariate.R
#' @import doParallel
#' @import foreach
#' @import stats
#'
...
...
@@ -9,8 +8,8 @@
#' @author Eric Coissac
NULL
library
(
doParallel
)
registerDoParallel
(
1
)
.has_doParallel
<-
is.element
(
"doParallel"
,
installed.packages
()
)
if
(
.has_doParallel
)
require
(
doParallel
)
#' Compute the trace of a square matrix.
#'
...
...
@@ -193,10 +192,15 @@ varls <- function(...,
for
(
i
in
seq_len
(
nx
))
v_xs
[[
i
]]
<-
var
(
xs
[[
i
]])
if
(
!
getDoParRegistered
())
registerDoParallel
(
1
)
if
(
.has_doParallel
&&
getDoParRegistered
())
{
`%dp%`
<-
`%dopar%`
}
else
{
`%dp%`
<-
`%do%`
}
s_cov_xxs
<-
foreach
(
k
=
seq_len
(
nrand
),
.combine
=
cbind
)
%d
opar
%
{
.combine
=
cbind
)
%d
p
%
{
s1_cov_xxs
<-
matrix
(
0
,
nrow
=
nx
,
ncol
=
nx
)
r_xs
<-
vector
(
mode
=
"list"
,
nx
)
r_ys
<-
vector
(
mode
=
"list"
,
nx
)
...
...
R/simulate.R
View file @
a0d24c8b
...
...
@@ -61,10 +61,10 @@ simulate_matrix <- function(n, p, equal_var = TRUE) {
#' @return a numeric matrix of \code{nrow(reference)} rows and \code{p} columns
#'
#' @examples
#' sim1 <- simulate_matrix(
15,5
)
#' sim1 <- simulate_matrix(
25,10
)
#' class(sim1)
#' dim(sim1)
#' sim2 <- simulate_correlation(sim1,
1
0,0.8)
#' sim2 <- simulate_correlation(sim1,
2
0,0.8)
#' corls(sim1, sim2)^2
#'
#' @author Eric Coissac
...
...
man/simulate_correlation.Rd
View file @
a0d24c8b
...
...
@@ -35,10 +35,10 @@ The intensity of the correlation is determined by the \code{r2}
parameter.
}
\examples{
sim1 <- simulate_matrix(
15,5
)
sim1 <- simulate_matrix(
25,10
)
class(sim1)
dim(sim1)
sim2 <- simulate_correlation(sim1,
1
0,0.8)
sim2 <- simulate_correlation(sim1,
2
0,0.8)
corls(sim1, sim2)^2
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment