Comments (8)
Thanks for the quick fix!
from fieldhub.
Gregor,
I think the easier solution here is passing a data frame with the entry list by using the argument data
. It can be in Excel and read it in R or just creating one in R. When we pass a data frame through the argument data
the function partially_replicated()
is going to use the exact order as in the data.
For example, let us create a data frame where we want to replicate the first six entries:
# Replicated entries first
data_first <- data.frame(
ENTRY = 1:30,
NAME = paste0("G", 1:30),
REPS = c(rep(c(2,1),c(6,24)))
)
Then, create the randomization by passing the data frame by data = data_first
.
library(FielDHub)
mydes1 <- partially_replicated(nrows = 6, ncols = 6,
repGens = c(6,24),
repUnits = c(2,1),
data = data_first)
mydes1$dataEntry
plot(mydes1)
Now, similar to the first case we want to replicate the last six entries,
# Replicated entries last
data_last <- data.frame(
ENTRY = 1:30,
NAME = paste0("G", 1:30),
REPS = c(rep(c(1,2),c(24,6)))
)
Finally, get the randomization by passing data = data_last
,
mydes2 <- partially_replicated(nrows = 6, ncols = 6,
repGens = c(24,6),
repUnits = c(1,2),
data = data_last)
mydes2$dataEntry
plot(mydes2)
Even though this approach works well, it can be annoying when we want many different reps settings. I will take a look at the entry list code generation, and I will make sure it follows the user instructions on the replication order.
I hope this works for you.
Thanks for using FielDHub
Best,
Didier
from fieldhub.
Dear Didier,
this seems to work for me. Do I still have to pass the arguments regGens and repUnits if I supply this information via the data argument? The results seems to be the same if I omit them.
I will go forward with this solution and let you know if any issues come up. Thank you for the quick response.
Best, Gregor
from fieldhub.
Gregor,
If you wrap up that information via data
, you no longer need to pass the arguments regGens
and repUnits
.
library(FielDHub)
# Replicated entries first
data_first <- data.frame(
ENTRY = 1:30,
NAME = paste0("G", 1:30),
REPS = c(rep(c(2,1),c(6,24)))
)
mydes1 <- partially_replicated(nrows = 6,
ncols = 6,
data = data_first,
seed = 17)
mydes1$dataEntry
plot(mydes1)
# Replicated entries last
data_last <- data.frame(
ENTRY = 1:30,
NAME = paste0("G", 1:30),
REPS = c(rep(c(1,2),c(24,6)))
)
mydes2 <- partially_replicated(nrows = 6,
ncols = 6,
data = data_last,
seed = 35)
mydes2$dataEntry
plot(mydes2)
from fieldhub.
Hi Didier,
this fails to work if I extend to multilocation:
gens <- 30
locs <- 5
p-rep multi location
mydata <- data.frame(
LOCATION = rep(c(1:locs),c(rep(gens,locs))),
ENTRY = rep(1:gens,locs),
NAME = rep(paste0("G", 1:gens),locs),#paste(paste0("G", 1:(gens*locs)),
REPS = c(rep(c(2,1,1,1,1),rep(gens/locs,locs)),
rep(c(2,1,1,1,1),rep(gens/locs,locs)),
rep(c(2,1,1,1,1),rep(gens/locs,locs)),
rep(c(2,1,1,1,1),rep(gens/locs,locs)),
rep(c(2,1,1,1,1),rep(gens/locs,locs))))
mydes3 <- partially_replicated(nrows = 6, ncols = 6,
data = mydata,
multiLocationData = TRUE)
Best Gregor
from fieldhub.
I got it. It is a small issue with some input checks. So, I will push a new version to GitHub that works.
from fieldhub.
Dear Didier,
I am trying to generate a number of designs using FielDHub::partially_replicated. I would like to specify where in the list of the genotypes a particular replication appears i.e. have the replicated entries at the end or in the middle of the genotype list, but it seems the function orders the genotype IDs by replications and puts the higher replications first. Do you see a possiblity to circumvent this?
Best Gregor
replicated entries first
mydes1 <- partially_replicated(nrows = 6, ncols = 6, repGens = c(6,24), repUnits = c(2,1)) mydes1$dataEntry
replicated entries last
mydes2 <- partially_replicated(nrows = 6, ncols = 6, repGens = c(24,6), repUnits = c(1,2)) mydes2$dataEntry
Now the function partially_replicated()
generates the entry list following the order in the arguments repGens
and repUnits
Some examples:
- Replicate entries at first (G1-G6)
library(FielDHub)
# Replicate entries at first (G1-G6)
mydes1 <- partially_replicated(nrows = 6,
ncols = 6,
repGens = c(6,24),
repUnits = c(2,1),
seed = 7)
mydes1$dataEntry
plot(mydes1)
- Replicate entries in the middle (G19-G24)
# Replicate entries in the middle (G19-G24)
mydes2 <- partially_replicated(nrows = 6,
ncols = 6,
repGens = c(18,6,6),
repUnits = c(1,2,1),
seed = 17)
mydes2$dataEntry
plot(mydes2)
- Replicate the last six entries (G25-G30)
# Replicate the last six entries (G25-G30)
mydes3 <- partially_replicated(nrows = 6,
ncols = 6,
repGens = c(24,6),
repUnits = c(1,2),
seed = 35)
mydes3$dataEntry
plot(mydes3)
While I submit a new version to CRAN, you can install the GitHub version by using the following code:
remotes::install_github("DidierMurilloF/FielDHub")
from fieldhub.
Hi Didier,
this fails to work if I extend to multilocation:
gens <- 30 locs <- 5
p-rep multi location
mydata <- data.frame( LOCATION = rep(c(1:locs),c(rep(gens,locs))), ENTRY = rep(1:gens,locs), NAME = rep(paste0("G", 1:gens),locs),#paste(paste0("G", 1:(gens*locs)), REPS = c(rep(c(2,1,1,1,1),rep(gens/locs,locs)), rep(c(2,1,1,1,1),rep(gens/locs,locs)), rep(c(2,1,1,1,1),rep(gens/locs,locs)), rep(c(2,1,1,1,1),rep(gens/locs,locs)), rep(c(2,1,1,1,1),rep(gens/locs,locs))))
mydes3 <- partially_replicated(nrows = 6, ncols = 6, data = mydata, multiLocationData = TRUE)
Best Gregor
I fixed the issue.
library(FielDHub)
gens <- 30
locs <- 5
mydata <- data.frame(
LOCATION = rep(c(1:locs),c(rep(gens,locs))),
ENTRY = rep(1:gens,locs),
NAME = rep(paste0("G", 1:gens),locs),
REPS = c(rep(c(2,1,1,1,1),rep(gens/locs,locs)),
rep(c(2,1,1,1,1),rep(gens/locs,locs)),
rep(c(2,1,1,1,1),rep(gens/locs,locs)),
rep(c(2,1,1,1,1),rep(gens/locs,locs)),
rep(c(2,1,1,1,1),rep(gens/locs,locs)))
)
mydes3 <- partially_replicated(nrows = 6,
ncols = 6,
l = 5,
data = mydata,
multiLocationData = TRUE,
seed = 7)
print(mydes3)
plot(mydes3)
plot(mydes3, l = 2)
While I submit a new version to CRAN, you can install the GitHub version by using the following code:
remotes::install_github("DidierMurilloF/FielDHub")
Thanks for catching these bugs.
from fieldhub.
Related Issues (20)
- Authorship by function HOT 6
- Output treatment for factorial designs HOT 1
- Checks argument HOT 5
- Shiny table output HOT 3
- Shiny development HOT 3
- Add link to repository in JOSS paper and contributing information HOT 2
- Suggestions to improve documentation HOT 2
- add contributing.md file HOT 3
- Error for `alpha_lattice(t = 1:8, k = 2, r = 2)` HOT 1
- Issue when importing entries' list in CRD HOT 1
- Allow Fillers in P-reps design when the number of field plots ends up in a prime number.
- More options for field layout HOT 3
- save desplot resulting from `plot()` into object HOT 4
- Full optimisation row column design HOT 1
- P-Rep Design HOT 3
- Full Factorial Design Failure in Shiny App with Spaces in 'FACTOR' Column Entries
- Running as Docker image on URL sub-path HOT 6
- Row-column design randomization
- primitive crossprod() function
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 fieldhub.