Skip to content
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

fct_full_factorial - factor labels #6

Merged
merged 2 commits into from
Mar 21, 2021
Merged

fct_full_factorial - factor labels #6

merged 2 commits into from
Mar 21, 2021

Conversation

Prof-ThiagoOliveira
Copy link

@Prof-ThiagoOliveira Prof-ThiagoOliveira commented Mar 20, 2021

Hi,
I created a new argument to keep the data frame's factors labels when data is provided. If TRUE keeps data labels; otherwise, FALSE, the original numeric labels are kept.

Please, review my changes and adapt them to your own convenience.

  1. Original output (factorLabels = FALSE):
FACTORS <- rep(c("A", "B", "C"), c(2,3,2))
LEVELS <- c("a0", "a1", "b0", "b1", "b2", "c0", "c1")
data_factorial <- data.frame(list(FACTOR = FACTORS, LEVEL = LEVELS))
print(data_factorial)
# This in an RCBD arrangement with 5 reps in 3 locations.
fullFact2 <- full_factorial(setfactors = NULL, reps = 5, l = 3, type = 2,
                            plotNumber = c(101,1001,2001),
                            continuous = FALSE,
                            planter = "serpentine",
                            seed = 326,
                            locationNames = c("Loc1","Loc2","Loc3"),
                            factorLabels = FALSE,
                            data = data_factorial)
fullFact2$infoDesign
head(fullFact2$fieldBook,10)
  ID LOCATION PLOT REP FACTOR_A FACTOR_B FACTOR_C TRT_COMB
1   1     Loc1  101   1        1        4        7    1*4*7
2   2     Loc1  102   1        2        5        6    2*5*6
3   3     Loc1  103   1        2        4        6    2*4*6
4   4     Loc1  104   1        1        3        7    1*3*7
5   5     Loc1  105   1        2        3        6    2*3*6
6   6     Loc1  106   1        2        5        7    2*5*7
7   7     Loc1  107   1        2        4        7    2*4*7
8   8     Loc1  108   1        1        3        6    1*3*6
9   9     Loc1  109   1        1        5        7    1*5*7
10 10     Loc1  110   1        1        5        6    1*5*6
  1. New output (factorLabels = TRUE):
fullFact2 <- full_factorial(setfactors = NULL, reps = 5, l = 3, type = 2,
                            plotNumber = c(101,1001,2001),
                            continuous = FALSE,
                            planter = "serpentine",
                            seed = 326,
                            locationNames = c("Loc1","Loc2","Loc3"),
                            factorLabels = TRUE,
                            data = data_factorial)
fullFact2$infoDesign
head(fullFact2$fieldBook,10)

ID LOCATION PLOT REP FACTOR_A FACTOR_B FACTOR_C TRT_COMB
1   1     Loc1  101   1       a1       b0       c0    a1*b0*c0
2   2     Loc1  102   1       a1       b2       c0    a1*b2*c0
3   3     Loc1  103   1       a0       b2       c1    a0*b2*c1
4   4     Loc1  104   1       a0       b0       c1    a0*b0*c1
5   5     Loc1  105   1       a1       b1       c1    a1*b1*c1
6   6     Loc1  106   1       a1       b1       c0    a1*b1*c0
7   7     Loc1  107   1       a0       b0       c0    a0*b0*c0
8   8     Loc1  108   1       a1       b2       c1    a1*b2*c1
9   9     Loc1  109   1       a0       b2       c0    a0*b2*c0
10 10     Loc1  110   1       a1       b0       c1    a1*b0*c1
  1. Latin Square
  • I included the functions class, summary and print
  • Note I have included the output infoDesign (I think it should be important to standardize all functions to return this argument).
  1. Class - I suggest you include all classes as "fielDHub" - see Files Changed
    Again, all I have done here are suggestions that I think are important to contribute to the package's output for the end-user.

@DidierMurilloF DidierMurilloF merged commit e80c235 into DidierMurilloF:master Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants