x object 'colour' not found

cal_all <- full_join(df_long, MDF, by="Sample") %>% mutate(colour = factor(colour)) %>% 
  mutate(colour=recode(colour, "yellow" = "1 year", "blue" = "20 days", "orange"="+6 days"))

cols <- c("1 year" = "yellow", "20 days" = "blue", "+6 days" = "orange")

ggplot(data = cal_all, aes(x=MDF, y=K_ARM_100))+geom_point(aes(group=colour,colour=colour))+xlab('MDF ARM (mT)')+
  ylab(bquote(λ[ARM]~"/IR"~M["100mT"]~" (units: E-5 m/A)")) + scale_colour_manual(values=cols)+
  scale_x_continuous(breaks=seq(0,30,5), limits=c(0,30))+
  scale_fill_discrete(name = "ARM corrected for pot", labels = c("20 days", "+6 days", "1 year"))
ggsave("Task2.jpeg", width=10, height=8, units='in')

Error: Problem with mutate() input colour.
x object 'colour' not found
i Input colour is recode(colour, yellow = "1 year", blue = "20 days", orange = "+6 days").

Hi, im trying to mutate my column data with colours but it isnt letting me do so, any help will be highly appreciated

Since this is making direct reference to the content of your data frame (there is no column called colour). Can you please share a small part of the data set in a copy-paste friendly format so we can try to help you?

In case you don't know how to do it, there are many options, which include:

  1. If you have stored the data set in some R object, dput function is very handy.

  2. In case the data set is in a spreadsheet, check out the datapasta package. Take a look at this link.

df<-tibble::tribble(
       ~Sample,         ~Id,                    ~Identity, ~Leaf.area,       ~Comments, ~`ARM.(Am-1)`, ~Volume.correction, ~`ARM.not.corrected.for.pot.(Am2)`, ~ARM.not.corrected.for.pot, ~`ARM.corrected.(Task.1.y-axis)`,     ~`ARM/2`, ~AF.demag.of.ARM, ~MDF_ARM1, ~MDF_ARM, ~ARM.corrected.for.pot, ~`IRM.(AM-1)`, ~Volume, ~IRM.not.corrected.for.pot, ~IRM.not.corrected.for.pot,        ~SIRM, ~SIRM.corrected.for.pot,    ~K_ARM, ~`K_ARM/IRM_100`, ~`HIRM_%`,
            NA,          NA,                           NA,         NA,              NA,            NA,                 NA,                                 NA,                     "0.00",                           "0 mT",           NA,           "5 mT",        NA,       NA,                    "0",            NA,      NA,                         NA,                       "20",       "1000",                     "1",        NA,               NA,        NA,
            NA,          NA,                           NA,    "[cm2]",              NA,            NA,         "[*10e-6)",                                 NA,               "[E-10 Am2]",                               NA, "[E-10 Am2]",     "[E-10 Am2]",        NA,   "[mT]",              "[E-6 A]",            NA,      NA,                         NA,               "[E-10 Am2]", "[E-10 Am2]",               "[E-6 A]", "[E-6 m]",      "[E-5 m/A]",     "[%]",
       "Pot_1",          NA,                           NA,         NA,              NA,            NA,                 NA,                                 NA,                     "0.55",                               NA,      "0.277",               NA,        NA,       NA,                     NA,            NA,      NA,                         NA,                         NA,      "29.80",                      NA,        NA,               NA,        NA,
      "Leaf_1",     "T1_AW",         "T1, 10ft from road",  "44.8337",              NA,       0.00264,         "1.00E-05",                           2.64e-08,                   "264.00",                         "263.45",      "132.0",          "224.0",      17.2,   "17.2",                 "5.88",            NA,      NA,                         NA,                     "4710",      "18730",                 "417.1",   "0.074",            "0.5",     "3.4",
      "Leaf_2",     "T4_TW",         "T4, 20ft from road",  "51.3405",              NA,            NA,         "1.00E-05",                                 NA,                   "135.20",                         "134.65",       "67.6",               NA,      19.2,   "19.2",                 "2.62",            NA,      NA,                         NA,                     "2170",       "8710",                 "169.1",   "0.033",            "0.5",     "3.9",
      "Leaf_3", "T1_20d_TW", "T1, 20 days growing season",   "39.672", "rotten leaves",            NA,         "1.00E-05",                                 NA,                    "43.70",                          "43.15",       "21.9",               NA,      16.6,   "16.6",                 "1.09",            NA,      NA,                         NA,                      "650",       "2260",                  "56.2",   "0.014",            "0.7",     "3.5"
      )

Created on 2021-05-02 by the reprex package (v2.0.0)

Thank you for getting back to me. Yes, I don't have a colour column, please let me know how to go around this. Kindest regards

What variable are you trying to color code? I can't see any variable containing values like "1 year", "20 days", etc as stated in your code. Also, your data seems very messy and part of the headers have been read as rows so you might want to check on that, otherwise, you are not going to be able to make any use of it.