Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simulateDCE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dj44vuri
simulateDCE
Commits
cc59b5cf
Commit
cc59b5cf
authored
4 months ago
by
dj44vuri
Browse files
Options
Downloads
Patches
Plain Diff
small changes and test added
parent
fe964b8e
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
R/readdesign.R
+2
-2
2 additions, 2 deletions
R/readdesign.R
tests/testthat/test-readdesign.R
+14
-0
14 additions, 0 deletions
tests/testthat/test-readdesign.R
with
16 additions
and
2 deletions
R/readdesign.R
+
2
−
2
View file @
cc59b5cf
...
...
@@ -75,10 +75,10 @@ as.data.frame(designf)
# Extract alt as the alternative identifier
alt
=
sub
(
".*\\."
,
""
,
row_id
)
)
%>%
dplyr
::
select
(
-
row_id
)
%>%
# Drop the original row_id
dplyr
::
select
(
-
"
row_id
"
)
%>%
# Drop the original row_id
tidyr
::
pivot_wider
(
id_cols
=
"Choice.situation"
,
# Group by Choice.situation
names_from
=
alt
,
# Use alt to create column suffixes
names_from
=
"
alt
"
,
# Use alt to create column suffixes
values_from
=
-
c
(
"Choice.situation"
,
"alt"
),
# Values from other columns
names_glue
=
"{alt}.{.value}"
# Custom naming convention
)
...
...
This diff is collapsed.
Click to expand it.
tests/testthat/test-readdesign.R
+
14
−
0
View file @
cc59b5cf
...
...
@@ -84,3 +84,17 @@ design_path <- system.file("extdata","ValuGaps", "des1.RDS" ,package = "simulate
test_that
(
"all is correct with full spdesign objects"
,
{
expect_no_error
(
readdesign
(
design
=
design_path
,
designtype
=
"spdesign"
))
})
### Tests for idefix
design_idefix
<-
system.file
(
"extdata"
,
"Idefix_designs"
,
"test_design2.RDS"
,
package
=
"simulateDCE"
)
test_that
(
"all is correct with full idefix objects"
,
{
expect_no_error
(
readdesign
(
design_idefix
,
designtype
=
"idefix"
))
})
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment