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

Add the date in format of data #48

Closed
priviere opened this issue May 8, 2017 · 2 comments
Closed

Add the date in format of data #48

priviere opened this issue May 8, 2017 · 2 comments
Assignees

Comments

@priviere
Copy link
Owner

priviere commented May 8, 2017

  • take into account the date in describe_data
@priviere
Copy link
Owner Author

update for

  • data("data_GxE")
  • data("data_model_1")
  • data("data_model_2")

@priviere priviere self-assigned this Jul 13, 2017
@priviere
Copy link
Owner Author

# data_GxE ----------
data("data_GxE")
data_GxE$"y1$date" = NA
data_GxE$"y1$date"[which(data_GxE$location == "L1")] = "2017-07-15"
data_GxE$"y1$date"[which(data_GxE$location == "L2")] = "2017-07-06"
data_GxE$"y1$date"[which(data_GxE$location == "L3")] = "2017-07-22"

data_GxE$"y2$date" = NA
data_GxE$"y2$date"[which(data_GxE$location == "L1")] = "2017-07-15"
data_GxE$"y2$date"[which(data_GxE$location == "L2")] = "2017-07-06"
data_GxE$"y2$date"[which(data_GxE$location == "L3")] = "2017-07-22"

data_GxE$"y3$date" = NA
data_GxE$"y3$date"[which(data_GxE$location == "L1")] = "2017-07-15"
data_GxE$"y3$date"[which(data_GxE$location == "L2")] = "2017-07-06"
data_GxE$"y3$date"[which(data_GxE$location == "L3")] = "2017-07-22"


data_GxE = cbind.data.frame(
  "location" = data_GxE$"location",
  "year" = data_GxE$"year",
  "germplasm" = data_GxE$"germplasm",
  "block" = data_GxE$"block",
  "X" = data_GxE$"X",
  "Y" = data_GxE$"Y",
  "y1" = data_GxE$"y1",
  "y1$date" = data_GxE$"y1$date",
  "y2" = data_GxE$"y2",
  "y2$date" = data_GxE$"y2$date",
  "y3" = data_GxE$"y3",
  "y3$date" = data_GxE$"y3$date"
  )

save(data_GxE, file = "./data/data_GxE.RData")

# data_model_1 ----------

data("data_model_1")
data_model_1$"tkw$date" = NA

vec_dates = c("2017-07-02",
"2017-07-06",
"2017-07-10",
"2017-07-15",
"2017-07-21",
"2017-07-22",
"2017-07-28",
"2017-07-29",
"2017-07-31")

a = sample(vec_dates, nlevels(data_model_1$location), replace = TRUE)
names(a) = levels(data_model_1$location)
data_model_1$"tkw$date" = a[data_model_1$location]

data_model_1 = cbind.data.frame(
  "location" = data_model_1$"location",
  "year" = data_model_1$"year",
  "germplasm" = data_model_1$"germplasm",
  "block" = data_model_1$"block",
  "X" = data_model_1$"X",
  "Y" = data_model_1$"Y",
  "tkw" =  data_model_1$"tkw",
  "tkw$date" =  data_model_1$"tkw$date",
  "mu_ij" =  data_model_1$"mu_ij",
  "beta_jk" =  data_model_1$"beta_jk",
  "epsilon_ijk" =  data_model_1$"epsilon_ijk",
  "sigma_j" =  data_model_1$"sigma_j"
  )

save(data_model_1, file = "./data/data_model_1.RData")


# data_model_2 ----------

data("data_model_2")
data_model_2$"y1$date" = NA
data_model_2$"y2$date" = NA
data_model_2$"y3$date" = NA


a = sample(vec_dates, nlevels(data_model_2$location), replace = TRUE)
names(a) = levels(data_model_2$location)
data_model_2$"y1$date" = a[data_model_2$location]

a = sample(vec_dates, nlevels(data_model_2$location), replace = TRUE)
names(a) = levels(data_model_2$location)
data_model_2$"y2$date" = a[data_model_2$location]

a = sample(vec_dates, nlevels(data_model_2$location), replace = TRUE)
names(a) = levels(data_model_2$location)
data_model_2$"y3$date" = a[data_model_2$location]


data_model_2 = cbind.data.frame(
  "location" = data_model_2$"location",
  "year" = data_model_2$"year",
  "germplasm" = data_model_2$"germplasm",
  "block" = data_model_2$"block",
  "X" = data_model_2$"X",
  "Y" = data_model_2$"Y",
  "y1" =  data_model_2$"y1",
  "y1$date" =  data_model_2$"y1$date",
  "alpha_i-1" =  data_model_2$"alpha_i-1",
  "beta_i-1" =  data_model_2$"beta_i-1",
  "theta_j-1" =  data_model_2$"theta_j-1",
  "y2" = data_model_2$"y2",
  "y2$date" = data_model_2$"y2$date",
  "y3" = data_model_2$"y3",
  "y3$date" = data_model_2$"y3$date"
)

save(data_model_2, file = "./data/data_model_2.RData")

priviere pushed a commit that referenced this issue Jul 13, 2017
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

No branches or pull requests

1 participant