Data wrangling: conditional mutate using multiple variables in tidyverse

I am a RStudio beginner. I have this kind of dataset.


When I created plot using ggplot2, it showed as follow:

I want to remove all the dotted lines.
How can I code it?
Thanks in advance!

Screenshots are not very useful, Could you ask this with a proper minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.

If you've never heard of a reprex before, you might want to start by reading this FAQ:

1 Like

Dear andresrcs,
Here is the sample:

Ref_all_good <-
tibble::tribble(
  ~wlPGP,                 ~time,  ~Time1,        ~R_all_good,
  349.86, "2015-01-08 17:00:00", "17:00",                 NA,
  349.86, "2015-01-08 17:30:00", "17:30",                 NA,
  349.86, "2015-01-08 18:00:00", "18:00",                 NA,
  350.29, "2015-01-08 06:00:00", "06:00",                 NA,
  350.29, "2015-01-08 06:30:00", "06:30",                 NA,
  350.29, "2015-01-08 07:00:00", "07:00",                 NA,
  350.29, "2015-01-08 07:30:00", "07:30",  0.4540,
  350.29, "2015-01-08 08:00:00", "08:00",  0.1658,
  350.29, "2015-01-08 08:30:00", "08:30",   0.104,
  350.29, "2015-01-08 09:00:00", "09:00", 0.082,
  350.29, "2015-01-08 09:30:00", "09:30", 0.057,
  350.29, "2015-01-08 10:00:00", "10:00", 0.048,
  350.29, "2015-01-08 10:30:00", "10:30", 0.0384,
  350.29, "2015-01-08 11:00:00", "11:00", 0.0396,
  350.29, "2015-01-08 11:30:00", "11:30", 0.0374,
  350.29, "2015-01-08 12:00:00", "12:00", 0.037,
  350.29, "2015-01-08 12:30:00", "12:30", 0.0634,
  350.29, "2015-01-08 13:00:00", "13:00", 0.0531,
  350.29, "2015-01-08 13:30:00", "13:30", 0.0788,
  350.29, "2015-01-08 14:00:00", "14:00", 0.084,
  350.29, "2015-01-08 14:30:00", "14:30", 0.056,
  350.29, "2015-01-08 15:00:00", "15:00", 0.0756,
  350.29, "2015-01-08 15:30:00", "15:30", 0.0776,
  350.29, "2015-01-08 16:00:00", "16:00",  0.108,
  350.29, "2015-01-08 16:30:00", "16:30",  0.1919,
  350.29, "2015-01-08 17:00:00", "17:00",  0.459,
  350.29, "2015-01-08 17:30:00", "17:30",                 NA,
  350.29, "2015-01-08 18:00:00", "18:00",                 NA,
  350.71, "2015-01-08 06:00:00", "06:00",                 NA,
  350.71, "2015-01-08 06:30:00", "06:30",                 NA,
  350.71, "2015-01-08 07:00:00", "07:00",                 NA,
  350.71, "2015-01-08 07:30:00", "07:30",  0.4389,
  350.71, "2015-01-08 08:00:00", "08:00",  0.1633,
  350.71, "2015-01-08 08:30:00", "08:30",  0.10179,
  350.71, "2015-01-08 09:00:00", "09:00", 0.07924,
  350.71, "2015-01-08 09:30:00", "09:30", 0.0547,
  350.71, "2015-01-08 10:00:00", "10:00", 0.045,
  350.71, "2015-01-08 10:30:00", "10:30", 0.037,
  350.71, "2015-01-08 11:00:00", "11:00", 0.0378,
  350.71, "2015-01-08 11:30:00", "11:30", 0.03619,
  350.71, "2015-01-08 12:00:00", "12:00", 0.0370,
  350.71, "2015-01-08 12:30:00", "12:30", 0.0609,
  350.71, "2015-01-08 13:00:00", "13:00",  0.051,
  350.71, "2015-01-08 13:30:00", "13:30", 0.0762,
  350.71, "2015-01-08 14:00:00", "14:00", 0.083,
  350.71, "2015-01-08 14:30:00", "14:30", 0.0552,
  350.71, "2015-01-08 15:00:00", "15:00", 0.0726,
  350.71, "2015-01-08 15:30:00", "15:30",  0.07,
  350.71, "2015-01-08 16:00:00", "16:00",  0.10,
  350.71, "2015-01-08 16:30:00", "16:30",  0.185,
  350.71, "2015-01-08 17:00:00", "17:00",  0.448,
  350.71, "2015-01-08 17:30:00", "17:30",                 NA,
  350.71, "2015-01-08 18:00:00", "18:00",                 NA,
  351.13, "2015-01-08 06:00:00", "06:00",                 NA,
  351.13, "2015-01-08 06:30:00", "06:30",                 NA,
  351.13, "2015-01-08 07:00:00", "07:00",                 NA,
  351.13, "2015-01-08 07:30:00", "07:30",  0.435,
  351.13, "2015-01-08 08:00:00", "08:00",  0.159,
  351.13, "2015-01-08 08:30:00", "08:30", 0.099,
  351.13, "2015-01-08 09:00:00", "09:00", 0.0777,
  351.13, "2015-01-08 09:30:00", "09:30", 0.053,
  351.13, "2015-01-08 10:00:00", "10:00", 0.044,
  351.13, "2015-01-08 10:30:00", "10:30", 0.036,
  351.13, "2015-01-08 11:00:00", "11:00", 0.0375,
  351.13, "2015-01-08 11:30:00", "11:30", 0.0361,
  351.13, "2015-01-08 12:00:00", "12:00", 0.0365,
  351.13, "2015-01-08 12:30:00", "12:30",  0.0608,
  351.13, "2015-01-08 13:00:00", "13:00", 0.05096,
  351.13, "2015-01-08 13:30:00", "13:30", 0.0757,
  351.13, "2015-01-08 14:00:00", "14:00", 0.0828,
  351.13, "2015-01-08 14:30:00", "14:30", 0.0541,
  351.13, "2015-01-08 15:00:00", "15:00", 0.0702,
  351.13, "2015-01-08 15:30:00", "15:30", 0.0735,
  351.13, "2015-01-08 16:00:00", "16:00",  0.104,
  351.13, "2015-01-08 16:30:00", "16:30",   0.1804,
  351.13, "2015-01-08 17:00:00", "17:00",  0.443,
  351.13, "2015-01-08 17:30:00", "17:30",                 NA,
  351.13, "2015-01-08 18:00:00", "18:00",                 NA,
  351.56, "2015-01-08 06:00:00", "06:00",                 NA,
  351.56, "2015-01-08 06:30:00", "06:30",                 NA,
  351.56, "2015-01-08 07:00:00", "07:00",                 NA,
  351.56, "2015-01-08 07:30:00", "07:30",  0.4383,
  351.56, "2015-01-08 08:00:00", "08:00",  0.1595,
  351.56, "2015-01-08 08:30:00", "08:30", 0.098662,
  351.56, "2015-01-08 09:00:00", "09:00", 0.077,
  351.56, "2015-01-08 09:30:00", "09:30", 0.05242,
  351.56, "2015-01-08 10:00:00", "10:00", 0.04403,
  351.56, "2015-01-08 10:30:00", "10:30", 0.03667,
  351.56, "2015-01-08 11:00:00", "11:00", 0.036208,
  351.56, "2015-01-08 11:30:00", "11:30", 0.03579,
  351.56, "2015-01-08 12:00:00", "12:00", 0.0358,
  351.56, "2015-01-08 12:30:00", "12:30",  0.0585,
  351.56, "2015-01-08 13:00:00", "13:00", 0.04942,
  351.56, "2015-01-08 13:30:00", "13:30", 0.074104,
  351.56, "2015-01-08 14:00:00", "14:00", 0.08195,
  351.56, "2015-01-08 14:30:00", "14:30", 0.05337,
  351.56, "2015-01-08 15:00:00", "15:00", 0.06981,
  351.56, "2015-01-08 15:30:00", "15:30", 0.072535,
  351.56, "2015-01-08 16:00:00", "16:00",  0.1025,
  351.56, "2015-01-08 16:30:00", "16:30",  0.18191,
  351.56, "2015-01-08 17:00:00", "17:00",   0.45087,
  351.56, "2015-01-08 17:30:00", "17:30",                 NA,
  351.56, "2015-01-08 18:00:00", "18:00",                 NA,
  351.98, "2015-01-08 06:00:00", "06:00",                 NA,
  351.98, "2015-01-08 06:30:00", "06:30",                 NA,
  351.98, "2015-01-08 07:00:00", "07:00",                 NA,
  351.98, "2015-01-08 07:30:00", "07:30",  0.422,
  351.98, "2015-01-08 08:00:00", "08:00",  0.1547,
  351.98, "2015-01-08 08:30:00", "08:30", 0.09512,
  351.98, "2015-01-08 09:00:00", "09:00", 0.075174,
  351.98, "2015-01-08 09:30:00", "09:30", 0.050651,
  351.98, "2015-01-08 10:00:00", "10:00", 0.043994,
  351.98, "2015-01-08 10:30:00", "10:30", 0.03694,
  351.98, "2015-01-08 11:00:00", "11:00", 0.036138,
  351.98, "2015-01-08 11:30:00", "11:30", 0.035333,
  351.98, "2015-01-08 12:00:00", "12:00", 0.035003,
  351.98, "2015-01-08 12:30:00", "12:30", 0.05832,
  351.98, "2015-01-08 13:00:00", "13:00", 0.0491567,
  351.98, "2015-01-08 13:30:00", "13:30", 0.0722074907179667,
  351.98, "2015-01-08 14:00:00", "14:00", 0.0798751759396658,
  351.98, "2015-01-08 14:30:00", "14:30", 0.0532980372151059,
  351.98, "2015-01-08 15:00:00", "15:00", 0.0675252143153902,
  351.98, "2015-01-08 15:30:00", "15:30", 0.0702936500379434,
  351.98, "2015-01-08 16:00:00", "16:00",  0.100177519666195,
  351.98, "2015-01-08 16:30:00", "16:30",  0.176937738706942,
  351.98, "2015-01-08 17:00:00", "17:00",  0.441756368292674,
  351.98, "2015-01-08 17:30:00", "17:30",                 NA,
  351.98, "2015-01-08 18:00:00", "18:00",                 NA,
  352.41, "2015-01-08 06:00:00", "06:00",                 NA,
  352.41, "2015-01-08 06:30:00", "06:30",                 NA,
  352.41, "2015-01-08 07:00:00", "07:00",                 NA,
  352.41, "2015-01-08 07:30:00", "07:30",  0.421928675142543,
  352.41, "2015-01-08 08:00:00", "08:00",  0.153343157579239,
  352.41, "2015-01-08 08:30:00", "08:30", 0.0937083647530896,
  352.41, "2015-01-08 09:00:00", "09:00", 0.0739626961837519,
  352.41, "2015-01-08 09:30:00", "09:30", 0.0504123845620715,
  352.41, "2015-01-08 10:00:00", "10:00",  0.042945179449744,
  352.41, "2015-01-08 10:30:00", "10:30", 0.0354764721358599,
  352.41, "2015-01-08 11:00:00", "11:00", 0.0356644612047057,
  352.41, "2015-01-08 11:30:00", "11:30", 0.0342910141833746,
  352.41, "2015-01-08 12:00:00", "12:00",  0.034053062152629,
  352.41, "2015-01-08 12:30:00", "12:30", 0.0573224650079104,
  352.41, "2015-01-08 13:00:00", "13:00", 0.0476402783654145,
  352.41, "2015-01-08 13:30:00", "13:30", 0.0705973755987326,
  352.41, "2015-01-08 14:00:00", "14:00", 0.0782717036250671,
  352.41, "2015-01-08 14:30:00", "14:30", 0.0525424753612673,
  352.41, "2015-01-08 15:00:00", "15:00", 0.0680575148698709,
  352.41, "2015-01-08 15:30:00", "15:30", 0.0696740909676114,
  352.41, "2015-01-08 16:00:00", "16:00", 0.0981424100779965,
  352.41, "2015-01-08 16:30:00", "16:30",  0.172233730115226,
  352.41, "2015-01-08 17:00:00", "17:00",  0.435807194286804,
  352.41, "2015-01-08 17:30:00", "17:30",                 NA,
  352.41, "2015-01-08 18:00:00", "18:00",                 NA,
  352.83, "2015-01-08 06:00:00", "06:00",                 NA,
  352.83, "2015-01-08 06:30:00", "06:30",                 NA,
  352.83, "2015-01-08 07:00:00", "07:00",                 NA,
  352.83, "2015-01-08 07:30:00", "07:30",   0.40590740870051,
  352.83, "2015-01-08 08:00:00", "08:00",  0.149826686567901,
  352.83, "2015-01-08 08:30:00", "08:30", 0.0905384111375242,
  352.83, "2015-01-08 09:00:00", "09:00", 0.0751455457734497,
  352.83, "2015-01-08 09:30:00", "09:30", 0.0506759678072997,
  352.83, "2015-01-08 10:00:00", "10:00", 0.0417338364323393,
  352.83, "2015-01-08 10:30:00", "10:30", 0.0354400382559175,
  352.83, "2015-01-08 11:00:00", "11:00", 0.0350552301479045,
  352.83, "2015-01-08 11:30:00", "11:30", 0.0338774068120087,
  352.83, "2015-01-08 12:00:00", "12:00", 0.0337744102896297,
  352.83, "2015-01-08 12:30:00", "12:30", 0.0567488250676932,
  352.83, "2015-01-08 13:00:00", "13:00",  0.046466960365623,
  352.83, "2015-01-08 13:30:00", "13:30",  0.071150528532557,
  352.83, "2015-01-08 14:00:00", "14:00", 0.0754656440806596,
  352.83, "2015-01-08 14:30:00", "14:30", 0.0517929380069597,
  352.83, "2015-01-08 15:00:00", "15:00", 0.0667973451175913,
  352.83, "2015-01-08 15:30:00", "15:30", 0.0684974363233225,
  352.83, "2015-01-08 16:00:00", "16:00",    0.0987979422729,
  352.83, "2015-01-08 16:30:00", "16:30",  0.168253303296243,
  352.83, "2015-01-08 17:00:00", "17:00",   0.42843260856215,
  352.83, "2015-01-08 17:30:00", "17:30",                 NA,
  352.83, "2015-01-08 18:00:00", "18:00",                 NA,
  353.26, "2015-01-08 06:00:00", "06:00",                 NA,
  353.26, "2015-01-08 06:30:00", "06:30",                 NA,
  353.26, "2015-01-08 07:00:00", "07:00",                 NA,
  353.26, "2015-01-08 07:30:00", "07:30",  0.414162649621655,
  353.26, "2015-01-08 08:00:00", "08:00",  0.144663253249311,
  353.26, "2015-01-08 08:30:00", "08:30", 0.0910153896666063,
  353.26, "2015-01-08 09:00:00", "09:00", 0.0742874033410325,
  353.26, "2015-01-08 09:30:00", "09:30", 0.0495004139580218,
  353.26, "2015-01-08 10:00:00", "10:00", 0.0414601183879774,
  353.26, "2015-01-08 10:30:00", "10:30",  0.034883695504817,
  353.26, "2015-01-08 11:00:00", "11:00", 0.0343826222144986,
  353.26, "2015-01-08 11:30:00", "11:30", 0.0334310380762118,
  353.26, "2015-01-08 12:00:00", "12:00", 0.0331710947593835,
  353.26, "2015-01-08 12:30:00", "12:30", 0.0552680324528581,
  353.26, "2015-01-08 13:00:00", "13:00", 0.0451387135070054,
  353.26, "2015-01-08 13:30:00", "13:30", 0.0706568539336417,
  353.26, "2015-01-08 14:00:00", "14:00", 0.0735636039782176,
  353.26, "2015-01-08 14:30:00", "14:30", 0.0502532992213163,
  353.26, "2015-01-08 15:00:00", "15:00",  0.067247510963367,
  353.26, "2015-01-08 15:30:00", "15:30", 0.0679648061314247,
  353.26, "2015-01-08 16:00:00", "16:00", 0.0975024061752597,
  353.26, "2015-01-08 16:30:00", "16:30",  0.165846006237873,
  353.26, "2015-01-08 17:00:00", "17:00",  0.434609478888864,
  353.26, "2015-01-08 17:30:00", "17:30",                 NA,
  353.26, "2015-01-08 18:00:00", "18:00",                 NA,
  353.68, "2015-01-08 06:00:00", "06:00",                 NA,
  353.68, "2015-01-08 06:30:00", "06:30",                 NA,
  353.68, "2015-01-08 07:00:00", "07:00",                 NA,
  353.68, "2015-01-08 07:30:00", "07:30",  0.396349502594045,
  353.68, "2015-01-08 08:00:00", "08:00",  0.136741960997049,
  353.68, "2015-01-08 08:30:00", "08:30", 0.0881406725133313,
  353.68, "2015-01-08 09:00:00", "09:00", 0.0722787594575648,
  353.68, "2015-01-08 09:30:00", "09:30", 0.0480526899948475,
  353.68, "2015-01-08 10:00:00", "10:00", 0.0406065849896514,
  353.68, "2015-01-08 10:30:00", "10:30",  0.034360855905665,
  353.68, "2015-01-08 11:00:00", "11:00", 0.0341821925117433,
  353.68, "2015-01-08 11:30:00", "11:30", 0.0332612814448741,
  353.68, "2015-01-08 12:00:00", "12:00", 0.0332633391208075,
  353.68, "2015-01-08 12:30:00", "12:30", 0.0537910242749121,
  353.68, "2015-01-08 13:00:00", "13:00",  0.042849201063414,
  353.68, "2015-01-08 13:30:00", "13:30", 0.0692398852726619,
  353.68, "2015-01-08 14:00:00", "14:00", 0.0718007494155567,
  353.68, "2015-01-08 14:30:00", "14:30", 0.0498254409541717,
  353.68, "2015-01-08 15:00:00", "15:00", 0.0648757127950225,
  353.68, "2015-01-08 15:30:00", "15:30", 0.0665939156385016,
  353.68, "2015-01-08 16:00:00", "16:00", 0.0956574107997868,
  353.68, "2015-01-08 16:30:00", "16:30",  0.162339702554378,
  353.68, "2015-01-08 17:00:00", "17:00",  0.419478050773686,
  353.68, "2015-01-08 17:30:00", "17:30",                 NA,
  353.68, "2015-01-08 18:00:00", "18:00",                 NA,
   354.1, "2015-01-08 06:00:00", "06:00",                 NA,
   354.1, "2015-01-08 06:30:00", "06:30",                 NA,
   354.1, "2015-01-08 07:00:00", "07:00",                 NA,
   354.1, "2015-01-08 07:30:00", "07:30",  0.377160367452335,
   354.1, "2015-01-08 08:00:00", "08:00",  0.133209432804418,
   354.1, "2015-01-08 08:30:00", "08:30", 0.0850099027067398,
   354.1, "2015-01-08 09:00:00", "09:00", 0.0696642339211649,
   354.1, "2015-01-08 09:30:00", "09:30", 0.0464265847141541,
   354.1, "2015-01-08 10:00:00", "10:00", 0.0401462855780994,
   354.1, "2015-01-08 10:30:00", "10:30", 0.0328581735266026,
   354.1, "2015-01-08 11:00:00", "11:00", 0.0334049101600667,
   354.1, "2015-01-08 11:30:00", "11:30", 0.0326908043994939,
   354.1, "2015-01-08 12:00:00", "12:00", 0.0330851492892411,
   354.1, "2015-01-08 12:30:00", "12:30", 0.0532766600614867,
   354.1, "2015-01-08 13:00:00", "13:00", 0.0437176455539103,
   354.1, "2015-01-08 13:30:00", "13:30", 0.0667948863502241,
   354.1, "2015-01-08 14:00:00", "14:00",  0.070579726800188,
   354.1, "2015-01-08 14:30:00", "14:30", 0.0484789658713149,
   354.1, "2015-01-08 15:00:00", "15:00", 0.0629944531526254,
   354.1, "2015-01-08 15:30:00", "15:30", 0.0640470214793692,
   354.1, "2015-01-08 16:00:00", "16:00", 0.0909711557491359,
   354.1, "2015-01-08 16:30:00", "16:30",  0.156975118814649,
   354.1, "2015-01-08 17:00:00", "17:00",  0.396510781009163,
   354.1, "2015-01-08 17:30:00", "17:30",                 NA,
   354.1, "2015-01-08 18:00:00", "18:00",                 NA,
  354.53, "2015-01-08 06:00:00", "06:00",                 NA,
  354.53, "2015-01-08 06:30:00", "06:30",                 NA,
  354.53, "2015-01-08 07:00:00", "07:00",                 NA,
  354.53, "2015-01-08 07:30:00", "07:30",  0.365363499071006,
  354.53, "2015-01-08 08:00:00", "08:00",  0.133779572038827,
  354.53, "2015-01-08 08:30:00", "08:30", 0.0833256913118221,
  354.53, "2015-01-08 09:00:00", "09:00",  0.068765091430921,
  354.53, "2015-01-08 09:30:00", "09:30", 0.0450012362977005,
  354.53, "2015-01-08 10:00:00", "10:00", 0.0398209010882072,
  354.53, "2015-01-08 10:30:00", "10:30", 0.0324789323149319,
  354.53, "2015-01-08 11:00:00", "11:00", 0.0333261955367837,
  354.53, "2015-01-08 11:30:00", "11:30", 0.0321541635506617,
  354.53, "2015-01-08 12:00:00", "12:00", 0.0326194226263433,
  354.53, "2015-01-08 12:30:00", "12:30", 0.0526354370287629,
  354.53, "2015-01-08 13:00:00", "13:00", 0.0434542201523214,
  354.53, "2015-01-08 13:30:00", "13:30", 0.0655486335540668,
  354.53, "2015-01-08 14:00:00", "14:00", 0.0688946636852602,
  354.53, "2015-01-08 14:30:00", "14:30",   0.04731926766458,
  354.53, "2015-01-08 15:00:00", "15:00", 0.0618618606139436,
  354.53, "2015-01-08 15:30:00", "15:30",  0.062561500261635,
  354.53, "2015-01-08 16:00:00", "16:00", 0.0875671995839909,
  354.53, "2015-01-08 16:30:00", "16:30",  0.152821981822622,
  354.53, "2015-01-08 17:00:00", "17:00",  0.383825636576356,
  354.53, "2015-01-08 17:30:00", "17:30",                 NA,
  354.53, "2015-01-08 18:00:00", "18:00",                 NA,
  354.95, "2015-01-08 06:00:00", "06:00",                 NA,
  354.95, "2015-01-08 06:30:00", "06:30",                 NA,
  354.95, "2015-01-08 07:00:00", "07:00",                 NA,
  354.95, "2015-01-08 07:30:00", "07:30",  0.362210036332797,
  354.95, "2015-01-08 08:00:00", "08:00",  0.133643780902889,
  354.95, "2015-01-08 08:30:00", "08:30", 0.0823610078180268,
  354.95, "2015-01-08 09:00:00", "09:00", 0.0670842646077037,
  354.95, "2015-01-08 09:30:00", "09:30", 0.0458411953504187,
  354.95, "2015-01-08 10:00:00", "10:00", 0.0394198864130638,
  354.95, "2015-01-08 10:30:00", "10:30", 0.0328714131117426,
  354.95, "2015-01-08 11:00:00", "11:00", 0.0330499919828079,
  354.95, "2015-01-08 11:30:00", "11:30", 0.0330157679842997,
  354.95, "2015-01-08 12:00:00", "12:00", 0.0313691871997612,
  354.95, "2015-01-08 12:30:00", "12:30", 0.0517275815602528,
  354.95, "2015-01-08 13:00:00", "13:00", 0.0435859988169131,
  354.95, "2015-01-08 13:30:00", "13:30", 0.0652355383337946,
  354.95, "2015-01-08 14:00:00", "14:00", 0.0690290835354008,
  354.95, "2015-01-08 14:30:00", "14:30", 0.0469956798062596,
  354.95, "2015-01-08 15:00:00", "15:00", 0.0610973371877228,
  354.95, "2015-01-08 15:30:00", "15:30", 0.0630586185024059,
  354.95, "2015-01-08 16:00:00", "16:00", 0.0871257387961967,
  354.95, "2015-01-08 16:30:00", "16:30",  0.148995340442382,
  354.95, "2015-01-08 17:00:00", "17:00",  0.377881537603148,
  354.95, "2015-01-08 17:30:00", "17:30",                 NA,
  354.95, "2015-01-08 18:00:00", "18:00",                 NA,
  355.38, "2015-01-08 06:00:00", "06:00",                 NA,
  355.38, "2015-01-08 06:30:00", "06:30",                 NA,
  355.38, "2015-01-08 07:00:00", "07:00",                 NA,
  355.38, "2015-01-08 07:30:00", "07:30",  0.367698871954128,
  355.38, "2015-01-08 08:00:00", "08:00",  0.134314759981221,
  355.38, "2015-01-08 08:30:00", "08:30", 0.0831468295339265,
  355.38, "2015-01-08 09:00:00", "09:00", 0.0681187829381249,
  355.38, "2015-01-08 09:30:00", "09:30", 0.0453983831947372,
  355.38, "2015-01-08 10:00:00", "10:00",  0.039818053294366,
  355.38, "2015-01-08 10:30:00", "10:30", 0.0331216616948081,
  355.38, "2015-01-08 11:00:00", "11:00", 0.0331862062817077,
  355.38, "2015-01-08 11:30:00", "11:30", 0.0337224581865022,
  355.38, "2015-01-08 12:00:00", "12:00", 0.0336084023996603,
  355.38, "2015-01-08 12:30:00", "12:30", 0.0523111596164097,
  355.38, "2015-01-08 13:00:00", "13:00", 0.0433528312074985,
  355.38, "2015-01-08 13:30:00", "13:30", 0.0664368755548666,
  355.38, "2015-01-08 14:00:00", "14:00", 0.0700207306907908,
  355.38, "2015-01-08 14:30:00", "14:30", 0.0470516253364956,
  355.38, "2015-01-08 15:00:00", "15:00", 0.0614717718073145,
  355.38, "2015-01-08 15:30:00", "15:30",   0.06400947162044,
  355.38, "2015-01-08 16:00:00", "16:00",  0.090059336615263,
  355.38, "2015-01-08 16:30:00", "16:30",   0.14931602009191,
  355.38, "2015-01-08 17:00:00", "17:00",  0.385858904242798,
  355.38, "2015-01-08 17:30:00", "17:30",                 NA,
  355.38, "2015-01-08 18:00:00", "18:00",                 NA,
   355.8, "2015-01-08 06:00:00", "06:00",                 NA,
   355.8, "2015-01-08 06:30:00", "06:30",                 NA,
   355.8, "2015-01-08 07:00:00", "07:00",                 NA,
   355.8, "2015-01-08 07:30:00", "07:30",  0.365732630863811,
   355.8, "2015-01-08 08:00:00", "08:00",  0.136601876345234,
   355.8, "2015-01-08 08:30:00", "08:30", 0.0826873693461675,
   355.8, "2015-01-08 09:00:00", "09:00", 0.0666785232699719,
   355.8, "2015-01-08 09:30:00", "09:30", 0.0459212076983572,
   355.8, "2015-01-08 10:00:00", "10:00", 0.0390442227444334,
   355.8, "2015-01-08 10:30:00", "10:30",  0.032388174452454,
   355.8, "2015-01-08 11:00:00", "11:00",  0.033081346380349,
   355.8, "2015-01-08 11:30:00", "11:30", 0.0323735626546507,
   355.8, "2015-01-08 12:00:00", "12:00", 0.0324669414601199,
   355.8, "2015-01-08 12:30:00", "12:30", 0.0531024276820739,
   355.8, "2015-01-08 13:00:00", "13:00", 0.0437895134034907,
   355.8, "2015-01-08 13:30:00", "13:30", 0.0663413210582054,
   355.8, "2015-01-08 14:00:00", "14:00", 0.0713918268616856,
   355.8, "2015-01-08 14:30:00", "14:30", 0.0483839083928322,
   355.8, "2015-01-08 15:00:00", "15:00", 0.0618584054700899,
   355.8, "2015-01-08 15:30:00", "15:30", 0.0646696616075165,
   355.8, "2015-01-08 16:00:00", "16:00", 0.0901993320801782,
   355.8, "2015-01-08 16:30:00", "16:30",  0.149853699599208,
   355.8, "2015-01-08 17:00:00", "17:00",  0.380063620944505,
   355.8, "2015-01-08 17:30:00", "17:30",                 NA,
   355.8, "2015-01-08 18:00:00", "18:00",                 NA,
  356.22, "2015-01-08 06:00:00", "06:00",                 NA,
  356.22, "2015-01-08 06:30:00", "06:30",                 NA,
  356.22, "2015-01-08 07:00:00", "07:00",                 NA,
  356.22, "2015-01-08 07:30:00", "07:30",  0.373071490839793,
  356.22, "2015-01-08 08:00:00", "08:00",  0.135791360433058,
  356.22, "2015-01-08 08:30:00", "08:30", 0.0848018368849239,
  356.22, "2015-01-08 09:00:00", "09:00", 0.0680046086653626,
  356.22, "2015-01-08 09:30:00", "09:30",  0.046333281078539,
  356.22, "2015-01-08 10:00:00", "10:00", 0.0409310169065508,
  356.22, "2015-01-08 10:30:00", "10:30", 0.0329311167062647,
  356.22, "2015-01-08 11:00:00", "11:00", 0.0338272429171629,
  356.22, "2015-01-08 11:30:00", "11:30", 0.0331506653617825,
  356.22, "2015-01-08 12:00:00", "12:00", 0.0332573462501046,
  356.22, "2015-01-08 12:30:00", "12:30", 0.0532252366302092,
  356.22, "2015-01-08 13:00:00", "13:00", 0.0450779170852459,
  356.22, "2015-01-08 13:30:00", "13:30", 0.0660839069176748,
  356.22, "2015-01-08 14:00:00", "14:00", 0.0721787774873624,
  356.22, "2015-01-08 14:30:00", "14:30", 0.0487945613586863,
  356.22, "2015-01-08 15:00:00", "15:00", 0.0628898885305887,
  356.22, "2015-01-08 15:30:00", "15:30", 0.0648870908314962,
  356.22, "2015-01-08 16:00:00", "16:00", 0.0904850871651501,
  356.22, "2015-01-08 16:30:00", "16:30",  0.152560037497587,
  356.22, "2015-01-08 17:00:00", "17:00",  0.386881347261302,
  356.22, "2015-01-08 17:30:00", "17:30",                 NA,
  356.22, "2015-01-08 18:00:00", "18:00",                 NA,
  356.65, "2015-01-08 06:00:00", "06:00",                 NA,
  356.65, "2015-01-08 06:30:00", "06:30",                 NA,
  356.65, "2015-01-08 07:00:00", "07:00",                 NA,
  356.65, "2015-01-08 07:30:00", "07:30",  0.3767,
  356.65, "2015-01-08 08:00:00", "08:00",  0.1390,
  356.65, "2015-01-08 08:30:00", "08:30", 0.08762,
  356.65, "2015-01-08 09:00:00", "09:00", 0.07091,
  356.65, "2015-01-08 09:30:00", "09:30",  0.0477,
  356.65, "2015-01-08 10:00:00", "10:00", 0.03987,
  356.65, "2015-01-08 10:30:00", "10:30", 0.03356,
  356.65, "2015-01-08 11:00:00", "11:00",  0.03446,
  356.65, "2015-01-08 11:30:00", "11:30", 0.0351,
  356.65, "2015-01-08 12:00:00", "12:00", 0.0337,
  356.65, "2015-01-08 12:30:00", "12:30", 0.05421,
  356.65, "2015-01-08 13:00:00", "13:00",  0.0465,
  356.65, "2015-01-08 13:30:00", "13:30", 0.0672,
  356.65, "2015-01-08 14:00:00", "14:00", 0.072,
  356.65, "2015-01-08 14:30:00", "14:30", 0.0503,
  356.65, "2015-01-08 15:00:00", "15:00", 0.06484,
  356.65, "2015-01-08 15:30:00", "15:30", 0.0668,
  356.65, "2015-01-08 16:00:00", "16:00", 0.0908,
  356.65, "2015-01-08 16:30:00", "16:30",  0.154,
  356.65, "2015-01-08 17:00:00", "17:00",  0.383,
  356.65, "2015-01-08 17:30:00", "17:30",                 NA,
  356.65, "2015-01-08 18:00:00", "18:00",                 NA,
  357.07, "2015-01-08 06:00:00", "06:00",                 NA,
  357.07, "2015-01-08 06:30:00", "06:30",                 NA,
  357.07, "2015-01-08 07:00:00", "07:00",                 NA,
  357.07, "2015-01-08 07:30:00", "07:30",   0.388,
  357.07, "2015-01-08 08:00:00", "08:00",  0.14208,
  357.07, "2015-01-08 08:30:00", "08:30", 0.089,
  357.07, "2015-01-08 09:00:00", "09:00", 0.0742,
  357.07, "2015-01-08 09:30:00", "09:30", 0.0491,
  357.07, "2015-01-08 10:00:00", "10:00", 0.04166,
  357.07, "2015-01-08 10:30:00", "10:30", 0.0345,
  357.07, "2015-01-08 11:00:00", "11:00", 0.0350,
  357.07, "2015-01-08 11:30:00", "11:30", 0.035,
  357.07, "2015-01-08 12:00:00", "12:00", 0.0344,
  357.07, "2015-01-08 12:30:00", "12:30", 0.0560,
  357.07, "2015-01-08 13:00:00", "13:00", 0.047,
  357.07, "2015-01-08 13:30:00", "13:30",  0.068,
  357.07, "2015-01-08 14:00:00", "14:00",   0.0744,
  357.07, "2015-01-08 14:30:00", "14:30", 0.0506,
  357.07, "2015-01-08 15:00:00", "15:00",  0.06646,
  357.07, "2015-01-08 15:30:00", "15:30", 0.0691,
  357.07, "2015-01-08 16:00:00", "16:00", 0.09452,
  357.07, "2015-01-08 16:30:00", "16:30",  0.161,
  357.07, "2015-01-08 17:00:00", "17:00",  0.4010,
  357.07, "2015-01-08 17:30:00", "17:30",                 NA,
  357.07, "2015-01-08 18:00:00", "18:00",                 NA,
   357.5, "2015-01-08 06:00:00", "06:00",                 NA,
   357.5, "2015-01-08 06:30:00", "06:30",                 NA,
   357.5, "2015-01-08 07:00:00", "07:00",                 NA,
   357.5, "2015-01-08 07:30:00", "07:30",  0.40306,
   357.5, "2015-01-08 08:00:00", "08:00",  0.14423,
   357.5, "2015-01-08 08:30:00", "08:30", 0.09373,
   357.5, "2015-01-08 09:00:00", "09:00",  0.07588,
   357.5, "2015-01-08 09:30:00", "09:30", 0.049957,
   357.5, "2015-01-08 10:00:00", "10:00",   0.04310,
   357.5, "2015-01-08 10:30:00", "10:30", 0.035314,
   357.5, "2015-01-08 11:00:00", "11:00", 0.03495,
   357.5, "2015-01-08 11:30:00", "11:30", 0.03594,
   357.5, "2015-01-08 12:00:00", "12:00", 0.03477,
   357.5, "2015-01-08 12:30:00", "12:30", 0.05700,
   357.5, "2015-01-08 13:00:00", "13:00", 0.04808,
   357.5, "2015-01-08 13:30:00", "13:30", 0.0701,
   357.5, "2015-01-08 14:00:00", "14:00", 0.0758,
   357.5, "2015-01-08 14:30:00", "14:30", 0.0516,
   357.5, "2015-01-08 15:00:00", "15:00", 0.068,
   357.5, "2015-01-08 15:30:00", "15:30", 0.07181,
   357.5, "2015-01-08 16:00:00", "16:00", 0.0972,
   357.5, "2015-01-08 16:30:00", "16:30",  0.1685,
   357.5, "2015-01-08 17:00:00", "17:00",  0.4169,
   357.5, "2015-01-08 17:30:00", "17:30",                 NA,
   357.5, "2015-01-08 18:00:00", "18:00",                 NA,
  357.92, "2015-01-08 06:00:00", "06:00",                 NA,
  357.92, "2015-01-08 06:30:00", "06:30",                 NA,
  357.92, "2015-01-08 07:00:00", "07:00",                 NA,
  357.92, "2015-01-08 07:30:00", "07:30",  0.4099,
  357.92, "2015-01-08 08:00:00", "08:00",  0.1517,
  357.92, "2015-01-08 08:30:00", "08:30", 0.0957,
  357.92, "2015-01-08 09:00:00", "09:00", 0.0766,
  357.92, "2015-01-08 09:30:00", "09:30", 0.0508,
  357.92, "2015-01-08 10:00:00", "10:00", 0.04461,
  357.92, "2015-01-08 10:30:00", "10:30", 0.03635,
  357.92, "2015-01-08 11:00:00", "11:00", 0.03588,
  357.92, "2015-01-08 11:30:00", "11:30", 0.0357,
  357.92, "2015-01-08 12:00:00", "12:00", 0.03576,
  357.92, "2015-01-08 12:30:00", "12:30", 0.05914,
  357.92, "2015-01-08 13:00:00", "13:00",  0.0495,
  357.92, "2015-01-08 13:30:00", "13:30", 0.07342,
  357.92, "2015-01-08 14:00:00", "14:00", 0.07918,
  357.92, "2015-01-08 14:30:00", "14:30", 0.05194,
  357.92, "2015-01-08 15:00:00", "15:00", 0.06934,
  357.92, "2015-01-08 15:30:00", "15:30", 0.07168,
  357.92, "2015-01-08 16:00:00", "16:00",  0.0998,
  357.92, "2015-01-08 16:30:00", "16:30",  0.17153,
  357.92, "2015-01-08 17:00:00", "17:00",  0.43243,
  357.92, "2015-01-08 17:30:00", "17:30",                 NA,
  357.92, "2015-01-08 18:00:00", "18:00",                 NA,
  358.35, "2015-01-08 06:00:00", "06:00",                 NA,
  358.35, "2015-01-08 06:30:00", "06:30",                 NA,
  358.35, "2015-01-08 07:00:00", "07:00",                 NA,
  358.35, "2015-01-08 07:30:00", "07:30",  0.41302,
  358.35, "2015-01-08 08:00:00", "08:00",  0.147893,
  358.35, "2015-01-08 08:30:00", "08:30", 0.0952,
  358.35, "2015-01-08 09:00:00", "09:00", 0.077834,
  358.35, "2015-01-08 09:30:00", "09:30", 0.051070,
  358.35, "2015-01-08 10:00:00", "10:00", 0.045107,
  358.35, "2015-01-08 10:30:00", "10:30", 0.03711,
  358.35, "2015-01-08 11:00:00", "11:00", 0.037171,
  358.35, "2015-01-08 11:30:00", "11:30", 0.03687,
  358.35, "2015-01-08 12:00:00", "12:00", 0.03622,
  358.35, "2015-01-08 12:30:00", "12:30", 0.05999,
  358.35, "2015-01-08 13:00:00", "13:00", 0.04959,
  358.35, "2015-01-08 13:30:00", "13:30", 0.07449,
  358.35, "2015-01-08 14:00:00", "14:00", 0.08117,
  358.35, "2015-01-08 14:30:00", "14:30", 0.0530,
  358.35, "2015-01-08 15:00:00", "15:00", 0.0698,
  358.35, "2015-01-08 15:30:00", "15:30", 0.07153,
  358.35, "2015-01-08 16:00:00", "16:00",  0.10093,
  358.35, "2015-01-08 16:30:00", "16:30",  0.17014,
  358.35, "2015-01-08 17:00:00", "17:00",  0.43645,
  358.35, "2015-01-08 17:30:00", "17:30",                 NA,
  358.35, "2015-01-08 18:00:00", "18:00",                 NA,
  358.77, "2015-01-08 06:00:00", "06:00",                 NA,
  358.77, "2015-01-08 06:30:00", "06:30",                 NA,
  358.77, "2015-01-08 07:00:00", "07:00",                 NA,
  358.77, "2015-01-08 07:30:00", "07:30",  0.40961,
  358.77, "2015-01-08 08:00:00", "08:00",  0.1507,
  358.77, "2015-01-08 08:30:00", "08:30", 0.09534,
  358.77, "2015-01-08 09:00:00", "09:00", 0.07745,
  358.77, "2015-01-08 09:30:00", "09:30", 0.0521,
  358.77, "2015-01-08 10:00:00", "10:00", 0.0452,
  358.77, "2015-01-08 10:30:00", "10:30", 0.0372,
  358.77, "2015-01-08 11:00:00", "11:00", 0.03763,
  358.77, "2015-01-08 11:30:00", "11:30", 0.03814,
  358.77, "2015-01-08 12:00:00", "12:00", 0.03585,
  358.77, "2015-01-08 12:30:00", "12:30",  0.0606,
  358.77, "2015-01-08 13:00:00", "13:00",  0.04965,
  358.77, "2015-01-08 13:30:00", "13:30", 0.07653,
  358.77, "2015-01-08 14:00:00", "14:00", 0.08151,
  358.77, "2015-01-08 14:30:00", "14:30", 0.0538,
  358.77, "2015-01-08 15:00:00", "15:00", 0.0701,
  358.77, "2015-01-08 15:30:00", "15:30",  0.0727,
  358.77, "2015-01-08 16:00:00", "16:00",  0.101955,
  358.77, "2015-01-08 16:30:00", "16:30",  0.172333,
  358.77, "2015-01-08 17:00:00", "17:00",   0.430913,
  358.77, "2015-01-08 17:30:00", "17:30",                 NA,
  358.77, "2015-01-08 18:00:00", "18:00",                 NA,
  359.19, "2015-01-08 06:00:00", "06:00",                 NA,
  359.19, "2015-01-08 06:30:00", "06:30",                 NA,
  359.19, "2015-01-08 07:00:00", "07:00",                 NA,
  359.19, "2015-01-08 07:30:00", "07:30",  0.40344,
  359.19, "2015-01-08 08:00:00", "08:00",  0.14885,
  359.19, "2015-01-08 08:30:00", "08:30", 0.09304,
  359.19, "2015-01-08 09:00:00", "09:00", 0.0767,
  359.19, "2015-01-08 09:30:00", "09:30", 0.05169,
  359.19, "2015-01-08 10:00:00", "10:00",  0.04472,
  359.19, "2015-01-08 10:30:00", "10:30", 0.03664,
  359.19, "2015-01-08 11:00:00", "11:00", 0.0375,
  359.19, "2015-01-08 11:30:00", "11:30", 0.03667,
  359.19, "2015-01-08 12:00:00", "12:00", 0.03539,
  359.19, "2015-01-08 12:30:00", "12:30", 0.0594,
  359.19, "2015-01-08 13:00:00", "13:00", 0.04928,
  359.19, "2015-01-08 13:30:00", "13:30",   0.0762,
  359.19, "2015-01-08 14:00:00", "14:00", 0.07999,
  359.19, "2015-01-08 14:30:00", "14:30", 0.05472,
  359.19, "2015-01-08 15:00:00", "15:00",  0.06946,
  359.19, "2015-01-08 15:30:00", "15:30", 0.07259,
  359.19, "2015-01-08 16:00:00", "16:00",  0.10035,
  359.19, "2015-01-08 16:30:00", "16:30",  0.1706,
  359.19, "2015-01-08 17:00:00", "17:00",  0.4219,
  359.19, "2015-01-08 17:30:00", "17:30",                 NA,
  359.19, "2015-01-08 18:00:00", "18:00",                 NA,
  359.62, "2015-01-08 06:00:00", "06:00",                 NA,
  359.62, "2015-01-08 06:30:00", "06:30",                 NA,
  359.62, "2015-01-08 07:00:00", "07:00",                 NA,
  359.62, "2015-01-08 07:30:00", "07:30",  0.4063,
  359.62, "2015-01-08 08:00:00", "08:00",  0.1491,
  359.62, "2015-01-08 08:30:00", "08:30", 0.0940,
  359.62, "2015-01-08 09:00:00", "09:00", 0.074,
  359.62, "2015-01-08 09:30:00", "09:30", 0.0497,
  359.62, "2015-01-08 10:00:00", "10:00", 0.0434,
  359.62, "2015-01-08 10:30:00", "10:30", 0.0361,
  359.62, "2015-01-08 11:00:00", "11:00", 0.0368,
  359.62, "2015-01-08 11:30:00", "11:30", 0.0359,
  359.62, "2015-01-08 12:00:00", "12:00", 0.034,
  359.62, "2015-01-08 12:30:00", "12:30", 0.0581,
  359.62, "2015-01-08 13:00:00", "13:00",  0.048,
  359.62, "2015-01-08 13:30:00", "13:30", 0.0740,
  359.62, "2015-01-08 14:00:00", "14:00", 0.0761,
  359.62, "2015-01-08 14:30:00", "14:30", 0.05412,
  359.62, "2015-01-08 15:00:00", "15:00", 0.06887,
  359.62, "2015-01-08 15:30:00", "15:30", 0.07101,
  359.62, "2015-01-08 16:00:00", "16:00",   0.0981,
  359.62, "2015-01-08 16:30:00", "16:30",  0.1711,
  359.62, "2015-01-08 17:00:00", "17:00",  0.4169,
  359.62, "2015-01-08 17:30:00", "17:30",                 NA,
  359.62, "2015-01-08 18:00:00", "18:00",                 NA
 )

I used theis code:

ggplot(data = Ref_all_good) +
  geom_line(
    mapping = aes(x = wlPGP, y = R_all_good, group = time, color = time),
    show.legend = TRUE
  )

I want to remove the data with fragmented lines in plot. I want to use the complete data only. Thank you!

First of all, your reprex doesn't work as you, probably, expect. It is not reproduce the plot you posted as time - in the reprex the column "time" has class character, while in your original post it seems to be datetime. But even when converted to datetime I can not reproduce the behavior you observed. In my case, ggplot drop all NAs and build plot without them with Warning message

ggplot(data = Ref_all_good) +
  geom_line(
    mapping = aes(x = wlPGP, y = R_all_good, group = time, color = time),
    show.legend = TRUE
  )
#>Warning message:
#>Removed 118 row(s) containing missing values (geom_path). 

I don't know what you do differently, but the following should work:

Ref_all_good %>%
  filter(!is.na(R_all_good)) %>%
  ggplot() +
  geom_line(
    mapping = aes(x = wlPGP, y = R_all_good, group = time, color = time),
    show.legend = TRUE
  )

Thank you for your kind help. Using your code, I run my data. But I can't get what I expect. I want to remove the data with NA if the line is incomplete. For example, in my first picture, you may see the fragmented lines in the left and right upper parts. I want to remove such incomplete data in my dataset. Thanks again!

That's why reprex so important))

Perhaps, this should solve the problem

Ref_all_good %>%
  group_by(time) %>%
  filter(all(!is.na(R_all_good))) %>%
  ggplot() +
  geom_line(
    mapping = aes(x = wlPGP, y = R_all_good, group = time, color = time),
    show.legend = TRUE
  )

I am sorry it doesn't work after filtering. All observations were lost. Actually, I want to keep the R_all_good data for the whole day (time - 06:00-18:00) in each wlPGP. I created the reprex using the guidelines for beginners. But my dataset is large, it can't be uploaded all. So, I tried to delete it as much as possible to include the important portion. Thanks indeed for your patient help.

Well, it seems that you have at least one NA in each group, hence when you filtering out groups that contain NAs you lose all data. You can quickly check whether it is a case by the following code. If there is any NA in a group the mean can not be defined and NA will be returned. Thus you can understand whether NAs present in all groups.

Ref_all_good %>%
  group_by(time) %>%
  summarise(contains_na = mean(R_all_good)) %>%
  view()

Ah, yes! Now I found where I made a mistake. There are so many NAs in other wlPGP values. After I subseted them, your code worked well.
Thanks indeed!

What about using geom_point() instead of geom_line()?
That will prevent ggplot from drawing those straight lines that connect the first and last element of a sequence of missing values.