-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
trtAssign converts all columns to integer #172
Comments
After applying the trtAssign function, the values in randomEffect column changed and not anymore normally distributed. |
Hello @hebaalhosainyTU thanks for the report. Next time please consider using reprex (see below) as it makes it easier to reproduce issues. @kgoldfeld Reprex below is rendered with cran version of simstudy and indeed looks problematic. I haven't had time to look deeoer into it though. library(simstudy)
ydef <- defData(varname = "randomEffect", dist = "normal", formula = 0, variance = sqrt(3))
indData <- genData(24, ydef)
head(indData)
#> id randomEffect
#> 1: 1 2.9851502
#> 2: 2 0.9825252
#> 3: 3 -0.3632496
#> 4: 4 -0.3291816
#> 5: 5 0.4210097
#> 6: 6 1.5862488
indData <- trtAssign(indData, nTrt = 2, balanced = TRUE, grpName = "T")
head(indData)
#> id randomEffect T
#> 1: 1 2 1
#> 2: 2 0 1
#> 3: 3 0 1
#> 4: 4 0 1
#> 5: 5 0 1
#> 6: 6 1 0 Created on 2022-09-28 with reprex v2.0.2 |
Running the code a few times shows that the |
https://github.com/kgoldfeld/simstudy/blob/main/R/group_data.R#L401-L403 |
Yes - that is indeed a bug. If you want a quick workaround while that is fixed, you can do this:
But great catch, I will certainly fix that bug. |
@assignUser It is really strange how those lines of code got in there - must have been added to facilitate testing. And yet, testing did not pick that up. It is particularly odd since the output from |
@hebaalhosainyTU This has been fixed in the current development version. Thanks again. |
The text was updated successfully, but these errors were encountered: