Comments (3)
Whenever you use the c()
operator R will coerce the provided elements to the most general type. So, c(1.2, 1, TRUE)
, will change TRUE
to the value 1.0
. Consider what happens when you pass this c(1,2,'a')
.
If you want to keep the types constant return a data.frame()
in your Analyse()
step. That will allow the column elements to be of different type. Just change
ret <- c(coefficientInt=coef(summary(fit))[4,1], singular=singular)
to
ret <- data.frame(coefficientInt=coef(summary(fit))[4,1], singular=singular)
from simdesign.
Thanks, I feel silly for not catching that. However, I still run into issues when including a Boolean vector in the returned data frame from the Analyse function. When I implement your suggestion, I run into the following error code and traceback:
Error in FUN(X[[i]], ...) :
only defined on a data frame with all numeric variables
7.
stop("only defined on a data frame with all numeric variables")
6.
FUN(X[[i]], ...)
5.
lapply(args, function(x) {
x <- as.matrix(x)
if (!is.numeric(x) && !is.complex(x))
stop("only defined on a data frame with all numeric variables") ...
4.
Summary.data.frame(structure(list(singular = c(FALSE, FALSE,
TRUE, TRUE, FALSE)), row.names = c(NA, -5L), class = "data.frame"),
na.rm = TRUE)
3.
Functions$summarise(results = results, condition = condition,
fixed_objects = fixed_objects)
2.
Analysis(Functions = Functions, condition = design[i, ], replications = replications,
fixed_objects = fixed_objects, cl = cl, MPI = MPI, seed = seed,
bootSE = bootSE, boot_draws = boot_draws, save = save, save_results = save_results,
save_results_out_rootdir = out_rootdir, save_results_dirname = save_results_dirname, ...
1.
runSimulation(Design, replications = 5, verbose = FALSE, parallel = FALSE,
generate = Generate, analyse = Analyse, summarise = Summarise,
progress = TRUE)
The issue seems to occur with step 5, which I assume is part of the Summary.data.frame
type. I have fixed my issue for now by transforming my boolean into a vector of zeroes and ones (so that I can still easily sum up the counts of TRUE), but it seems that there are issues with returning values that are not numeric.
from simdesign.
In your runSimulation()
call, try using the edit
option for debugging. This will step into the respective function so you can play around with the state of the objects directly so that you can see what's going on. When I do this:
runSimulation(..., edit = 'summarise')
I see that
Browse[2] > str(results)
'data.frame': 5 obs. of 2 variables:
$ coefficientInt: num 1.04 -0.585 0.803 -0.383 -0.327
$ singular : logi FALSE FALSE FALSE FALSE FALSE
So, results
is a data.frame
object with 2 columns. Running the next line bias(results[1])
doesn't work because data.frames
should be indexed either by column (results[,1]
), the $ sign (results$coefficients
), or lists (results[[1]]
). Therefore, all you need to change is the [#]
components to [[#]]
to fix your code. HTH.
from simdesign.
Related Issues (20)
- Errors in analysis functions are catched and passed as input to `Summarise` when there are multiple analysis functions HOT 2
- Rstudio server crashes when debugging runSimulation() HOT 5
- Is it possible to capture all errors when using multiple analysis functions? HOT 9
- Error in load_packages(packages) : task 1 failed - "could not find function "load_packages"" HOT 6
- Code in SimDesign Package Won't Run for window 10!! HOT 1
- Implicit activation of parallelization can be risky HOT 8
- Question / Issue HOT 5
- Variable naming error when using `runSimulation()` HOT 5
- Implement sample size planning functions HOT 2
- Implement MCSE for performance measure functions HOT 2
- runSimulation fails if design and estimate are named the same HOT 1
- Validate function outputs HOT 4
- Random number seed management HOT 1
- Improve documentation on parallel processing HOT 5
- Features to support runnign as array jobs on a cluster HOT 15
- aggregate_simulations and selective loading of results HOT 5
- aggregate_simulations and summary results HOT 5
- Checking for incomplete designs in large simulations HOT 1
- Seeds and reproducibility in distributed simulations HOT 11
- Allow RAM testing considerations
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simdesign.