Skip to content

Commit

Permalink
Exclude selected varieties in the analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
Sungchan Oh committed Jul 6, 2024
1 parent 5bbad6f commit d301e1c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Data files
*.csv

# Output figures
*.png

# History files
.Rhistory
.Rapp.history
Expand Down
31 changes: 18 additions & 13 deletions calculate_repeatability.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# calculate_repeatability.r
#
# value ~ 1|EXP.ID + VARIETY + TREATMENT + GROWTH_STAGE
# value ~ 1|EXP.ID + VARIETY + TREATMENT Seth's model
# value ~ 1|EXP.ID + VARIETY Current model


library(dplyr)
library(lme4)
library(heritability)

Expand All @@ -8,8 +14,12 @@ library(heritability)
# Input long format data
path.rgb.long <- ("./df_rgb_long.csv")
path.hsi.long <- ("./df_hsi_long.csv")
path.rpt <- ("./rpt.csv")
path.rpt <- ("./rpt_no_public.csv")

# Define varieties that is excluded for repeatability measurement
exclude.variety <-c("P1", "P2", "P3", "P4")

# List of "factor (categorical)" variables
factor.col <- c('EXP.ID',
'POT_BARCODE',
'TREATMENT',
Expand All @@ -18,12 +28,17 @@ factor.col <- c('EXP.ID',
'View',
'frame_nr')


# Load RGB and HSI data in long format
message("Loading data...")
df.rgb <- read.csv(path.rgb.long)
df.hsi <- read.csv(path.hsi.long)

# Exclude varieties, as needed
if (length(exclude.variety)>0){
df.rgb <- df.rgb %>% filter(!VARIETY %in% exclude.variety)
df.hsi <- df.hsi %>% filter(!VARIETY %in% exclude.variety)
}

# Combine RGB and HSI data
df <- rbind(df.rgb, df.hsi)

Expand Down Expand Up @@ -56,7 +71,7 @@ for(i in 1:nrow(df.rpt)){
row$View,
row$frame_nr,
row$variable,
" (", i, "/", nrow(df.rpt), ")" sep=" "))
" (", i, "/", nrow(df.rpt), ")", sep=" "))
df.temp <- df[which(df$TREATMENT==row$TREATMENT &
df$GROWTH_STAGE==row$GROWTH_STAGE &
df$View==row$View &
Expand Down Expand Up @@ -89,14 +104,4 @@ write.csv(df.rpt, path.rpt, row.names=F)




# factor(EXP.ID, frame_nr, VARIETY, TREATMENT)
# value ~ 1|EXP.ID + VARIETY + TREATMENT + GROWTH_STAGE
# value ~ 1|EXP.ID + VARIETY + TREATMENT Seth
# value ~ 1|EXP.ID + VARIETY Current





# EOF

0 comments on commit d301e1c

Please sign in to comment.