admin管理员组

文章数量:1124380

I have a similar dataframe

    structure(list(timepoint = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L), levels = c("Diagnosis", "Timepoint1"), class = "factor"), 
    functional.cluster = c("CD4.CTL_EOMES", "CD4.CTL_EOMES", 
    "CD4.CTL_EOMES", "CD4.CTL_EOMES", "CD4.CTL_EOMES", "CD4.CTL_GNLY", 
    "CD4.CTL_GNLY", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.Treg", 
    "CD4.CTL_EOMES", "CD4.CTL_EOMES", "CD4.CTL_GNLY", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.Treg"), CTaa = c("CAATFLSGSARQLTF_CASSPGNSKQYF", "CAMSGIAPIIQGAQKLVF_CASSHRDEQFF", 
    "CAVQAPRNTDKLIF_CASSGPGQGVGGYTF", "CILRTNFGNEKLTF_CASSRRGTERGHRTGELFF", 
    "NA_CASGGTGGAAGELFF", "CAGAGQGGKLIF;CAYSSNAGKSTF_CSAPQPTSGSYEQYF", 
    "NA_CASSFPGQGSTEAFF", "CAAAGGGFKTIF_CASSLEGETQYF", "CAAAPSSGSARQLTF_CASSPRTSGSFFTQYF", 
    "CAAIQGAQKLVF_CASSLTGGTTYEQYF", "CAAIYFGSNYQLIW;CVVNAGKSTF_CSARGGGTGDSYNSPLHF", 
    "CAAKPPGGTASKLTF_CASSFVGVNQPQHF", "CAALTNAGKSTF_CSARSRGLGQNQPQHF", 
    "CAANSNSGYALNF_CAISEQLTEQFF", "CAARGGNNRKLIW_CASYGQADGYTF", 
    "CAARGNSGGSNYKLTF;CALSEGYAGNNRKLIW_CASSQLTGSGGYTF", "CAASDGGSNYKLTF_CASSSGGGRTTQYF", 
    "CAASEVGGSQGNLIF_CASSPTGSRNTDTQYF", "CAASLGSGGFKTIF_CSASRGSGSGTGELFF", 
    "CAASPYSGAGSYQLTF_CASRDLKETQYF", "CAASRNNAGNMLTF_CASSFENTGELFF", 
    "CAASSGFGNVLHC_CSAGHNEQFF", "CAATRAGGTSYGKLTF_CASAINGGGTDTQYF", 
    "CAATTAQGGSEKLVF_CASSGTITGAGEQYF", "CAAYTSGGYQKVTF_CASSITQGSGELFF", 
    "CAENGANNLFF_CASSLRGIGNQPQHF", "CAENPGGYNKLIF_CASSQEGTKPQHF", 
    "CAETPYNFNKFYF_CSARDRLAGVGEQYF", "CAFMTSGSRLTF_CASQRGPGVSGGAKNIQYF", 
    "CAFRGGTSYGKLTF_CASSPRDRSGSSLAKNIQYF", "CAGARSGAGSYQLTF_CASSAQRPGLGLGNTIYF", 
    "CAGLDNYGQNFVF_CSARVGVETQYF", "CAGPANDYKLSF_CASSPGVGRETQYF", 
    "CAGPTGNQFYF_CSGSGGDTLPAEAFF", "CAGQGAQKLVF;CAVIVSGSNYKLTF_CASSQGQYGYTF", 
    "CAGQRMGGGADGLTF;CGAPSHAGNNRKLIW_CASSQVEAGGYTF", "CAGQRNYGGATNKLIF_CASNAGQTYEQYF", 
    "CAGSNFGNEKLTF_CASSLGARRDTQYF", "CAGTQGGGSEKLVF_CASSRQGTGNTIYF", 
    "CAGTRVSNYQLIW_CASSPPVWSDGDTGELFF", "CALARGNNARLMF_CSARQGDGELFF", 
    "CALDSSRGSGNTGKLIF_CASHRGDEQFF", "CALGGYSSASKIIF_CASSLDPGQGAVGYTQYF", 
    "CALGLYSGGGADGLTF_CASSLEGITEAFF", "CALHGSGNTGKLIF_CASSYQATSGANVLTF", 
    "CALHLGFGNVLHC_CSAPPSAVMGIQYF", "CALPTIGFGNVLHC_CASSLSQSGANVLTF", 
    "CALQTGGSQGNLIF_CASSLTGGSGNEQFF", "CALREAGNTPLVF_CASSLLAGSAGGELFF", 
    "CALRPSTTSGTYKYIF_CSAVPGGPSYNEQFF", "CALSDTSGSRLTF_CASSLVGLAGGDTDTQYF", 
    "CALSEAQVASGTYKYIF;CAVKMDSNYQLIW_CASSLRGRGNEQFF", "CALSEGNNARLMF_CASSQEASSNEQFF", 
    "CALSERETSGSRLTF_CASSLLARNTEAFF", "CALSGSGGSNYKLTF_CASSKQGASGNTIYF", 
    "CALSPRGSGTYKYIF_CASSEDGQRNTEAFF", "CALSVAGGTSYGKLTF_CASSLAGTKNIQYF", 
    "CALTSGGGADGLTF_CASSRTGGSTDTQYF", "CAMREASLHGSSNTGKLIF_CASARRAQAMENYGYTF", 
    "CAMSAADNFNKFYF_CASRQGLGNSPLHF", "CAMSARAGNNRKLIW_CASSLALPDTQYF", 
    "CAPMDSNYQLIW_CASRISDSNYGYTF", "CAPRGGWDMRF_CASSLGLAGPSTDTQYF", 
    "CASPRNKLIF_CASTKKGTGFTNTEAFF", "CAVESRAQKLVF_CASRHGANYGYTF", 
    "CAVETGANNLFF_CSARPGQVNEKLFF", "CAVETNTGFQKLVF_CSARAEPGLAGSYNEQFF", 
    "CAVGSGGYQKVTF_CASSEQGAKQETQYF", "CAVGTGGGNKLTF_CASRVGTSRQETQYF", 
    "CAVKGIGGGGADGLTF_CASSLEGGPLYGYTF", "CAVKNSGNTPLVF_CASSISSQNTGELFF", 
    "CAVLDSNYQLIW_CASSRGPDTGELFF", "CAVLDSNYQLIW_CASSYSSGRTTGELFF", 
    "CAVNADNQGGKLIF_CATSRDGRPIMEGQPQHF", "CAVNDYKLSF_CASSPPTANQETQYF", 
    "CAVPSTDSWGKLQF;CAVEDYNTDKLIF_CASSDRGGTDTQYF", "CAVPTSGTYKYIF_CASSFNPLAGGPERFF", 
    "CAVQALNFGNEKLTF_CASSQDRGFAEAFF", "CAVQAPRNTDKLIF_CASSGPGQGVGGYTF", 
    "CAVRDMDSNYQLIW_CAWSKGTLGELFF", "CAVRESSASKIIF;CAPPTGGGNKLTF_CATSDLRVDTGELFF", 
    "CAVRNNNARLMF_CASSRPRNRNNEKLFF", "CAVRWRGGATNKLIF_CASSSQTGGWETQYF", 
    "CAVSDRGGYQKVTF_CASSPSGGGNYNEQFF", "CAVSDYQAGTALIF_CASSQGTGNSPLHF", 
    "CAVSEGGATNKLIF_CASSSNPSGTVTWEQYF", "CAVSEPPGQKLLF_CASSFAGQPTDTQYF", 
    "CAVSESGGSYIPTF_CSARAAGQGGNTEAFF", "CAVSRGSNFGNEKLTF_CASSLGHNPLNTEAFF", 
    "CAVSSSGNQFYF_CAWRRTSGYTGELFF", "CAVSSSGSARQLTF_CASSLAGRDSGNTIYF", 
    "CAVSVPRGRDDKIIF_CASSLTSGNPFSYNEQFF", "CAVSVVVQTGANNLFF_CASSLSSPGVNTEAFF", 
    "CAVTLIQGAQKLVF_CAISAGGRETQYF", "CAVVFLSSGTYKYIF_CASSPNRGLSRHEQYF", 
    "CAVWPLGW_CSATFQGLGEQYF", "CAVYSSASKIIF_CSAIRRGSRTEAFF", 
    "CAYKWSNFGNEKLTF_CASSYPRDRGRETQYF", "CAYRGHTGTASKLTF_CASIPPGSNQPQHF", 
    "CAYRGPDKLIF_CSAGQDRWYEQYF", "CAYRKGGSEKLVF_CASRLDSTYGYTF", 
    "CAYRRGGLSGSARQLTF_CASRWTSGHTDTQYF", "CAYRRNTGTASKLTF_CASSPPGGSNEKLFF", 
    "CAYRTILSAGGTSYGKLTF_CASSSMGLAGGPGHEQYF", "CGADRNYGQNFVF_CASSQDRGRSYNSPLHF", 
    "CILKRQGGSEKLVF_CASSQGYTEAFF", "CILSTQGGSEKLVF_CASKKVLIEGYTF", 
    "CIPKEYGNKLVF_CASSFKGSTMYNEQFF", "CIVRGPGGSSNTGKLIF_CASSTSGASGELFF", 
    "CIVRPVTGANNLFF_CASSPAGTVPYEQYF", "CIVRVATETDKLIF_CASSLVGTTHIETQYF", 
    "CIVRVDGAQKLVF_CASSTGTSPGTQYF", "CIVRVGGGNAGNMLTF_CSAPGLLNEQFF", 
    "CLLGETSGSRLTF_CSARGMVRDGNNEQFF", "CLLVIKAAGNKLTF;CAIGGTSYGKLTF_CSARPQGVQVGTEAFF", 
    "CVVKGRDDKIIF_CASSVELAYTGELFF", "CVVREGAGNMLTF_CSVDLPGGGLGYTF", 
    "CVVSAKGGSQGNLIF_CASSQDWGGHNEQFF", "CVVSAQAAGNKLTF_CASSTNSGSEAFF", 
    "CVVSATGNTPLVF_CASSSPAGEAFF", "CVVSEGNNARLMF_CASSQGRAWADTQYF", 
    "CVVTTQTGANNLFF_CASRGTPTGELFF", "NA_CASGGTGGAAGELFF", "NA_CASSFPGQGSTEAFF", 
    "NA_CASSLDPGQGAVGYTQYF", "NA_CASSLGGPLHF", "NA_CASSLGGTGGETQYF", 
    "NA_CASSLPPYYEQYF", "NA_CASSLQGGTEAFF", "NA_CASSLTSGNPFSYNEQFF", 
    "NA_CASSPPGYTDTQYF", "NA_CASSPRGGNTEAFF", "NA_CASSPTGNTGELFF", 
    "NA_CASSPYQAYEQYF", "NA_CASSQGPGEGGYTF", "NA_CASSQGYTEAFF", 
    "NA_CASSRENTGELFF", "NA_CASSRQGTGNTIYF", "NA_CSARVGVETQYF", 
    "NA_CSVARQGNNEQFF", "NA_CSVEGTSANTGELFF", "CAVGSGYSTLTF_CASSFTSGSDTQYF", 
    "CAATFLSGSARQLTF_CASSPGNSKQYF", "CAENPGGYNKLIF_CASSQEGTKPQHF", 
    "CVVTTQTGANNLFF_CASRGTPTGELFF", "CAAAGGGFKTIF_CASSLEGETQYF", 
    "CAAAPSSGSARQLTF_CASSPRTSGSFFTQYF", "CAAIQGAQKLVF_CASSLTGGTTYEQYF", 
    "CAAIYFGSNYQLIW;CVVNAGKSTF_CSARGGGTGDSYNSPLHF", "CAAKPPGGTASKLTF_CASSFVGVNQPQHF", 
    "CAALTNAGKSTF_CSARSRGLGQNQPQHF", "CAANSNSGYALNF_CAISEQLTEQFF", 
    "CAARGGNNRKLIW_CASYGQADGYTF", "CAARGNSGGSNYKLTF;CALSEGYAGNNRKLIW_CASSQLTGSGGYTF", 
    "CAASDGGSNYKLTF_CASSSGGGRTTQYF", "CAASEVGGSQGNLIF_CASSPTGSRNTDTQYF", 
    "CAASLGSGGFKTIF_CSASRGSGSGTGELFF", "CAASPYSGAGSYQLTF_CASRDLKETQYF", 
    "CAASRNNAGNMLTF_CASSFENTGELFF", "CAASSGFGNVLHC_CSAGHNEQFF", 
    "CAATRAGGTSYGKLTF_CASAINGGGTDTQYF", "CAATTAQGGSEKLVF_CASSGTITGAGEQYF", 
    "CAAYTSGGYQKVTF_CASSITQGSGELFF", "CAENGANNLFF_CASSLRGIGNQPQHF", 
    "CAENPGGYNKLIF_CASSQEGTKPQHF", "CAETPYNFNKFYF_CSARDRLAGVGEQYF", 
    "CAFMTSGSRLTF_CASQRGPGVSGGAKNIQYF", "CAFRGGTSYGKLTF_CASSPRDRSGSSLAKNIQYF", 
    "CAGAGQGGKLIF;CAYSSNAGKSTF_CSAPQPTSGSYEQYF", "CAGARSGAGSYQLTF_CASSAQRPGLGLGNTIYF", 
    "CAGLDNYGQNFVF_CSARVGVETQYF", "CAGPANDYKLSF_CASSPGVGRETQYF", 
    "CAGPTGNQFYF_CSGSGGDTLPAEAFF", "CAGQGAQKLVF;CAVIVSGSNYKLTF_CASSQGQYGYTF", 
    "CAGQRMGGGADGLTF;CGAPSHAGNNRKLIW_CASSQVEAGGYTF", "CAGQRNYGGATNKLIF_CASNAGQTYEQYF", 
    "CAGSNFGNEKLTF_CASSLGARRDTQYF", "CAGTQGGGSEKLVF_CASSRQGTGNTIYF", 
    "CAGTRVSNYQLIW_CASSPPVWSDGDTGELFF", "CALARGNNARLMF_CSARQGDGELFF", 
    "CALDSSRGSGNTGKLIF_CASHRGDEQFF", "CALGGYSSASKIIF_CASSLDPGQGAVGYTQYF", 
    "CALGLYSGGGADGLTF_CASSLEGITEAFF", "CALHGSGNTGKLIF_CASSYQATSGANVLTF", 
    "CALHLGFGNVLHC_CSAPPSAVMGIQYF", "CALPTIGFGNVLHC_CASSLSQSGANVLTF", 
    "CALQTGGSQGNLIF_CASSLTGGSGNEQFF", "CALREAGNTPLVF_CASSLLAGSAGGELFF", 
    "CALRPSTTSGTYKYIF_CSAVPGGPSYNEQFF", "CALSDTSGSRLTF_CASSLVGLAGGDTDTQYF", 
    "CALSEAQVASGTYKYIF;CAVKMDSNYQLIW_CASSLRGRGNEQFF", "CALSEGNNARLMF_CASSQEASSNEQFF", 
    "CALSERETSGSRLTF_CASSLLARNTEAFF", "CALSGSGGSNYKLTF_CASSKQGASGNTIYF", 
    "CALSPRGSGTYKYIF_CASSEDGQRNTEAFF", "CALSVAGGTSYGKLTF_CASSLAGTKNIQYF", 
    "CALTSGGGADGLTF_CASSRTGGSTDTQYF", "CAMREASLHGSSNTGKLIF_CASARRAQAMENYGYTF", 
    "CAMSAADNFNKFYF_CASRQGLGNSPLHF", "CAMSARAGNNRKLIW_CASSLALPDTQYF", 
    "CAMSGIAPIIQGAQKLVF_CASSHRDEQFF", "CAPMDSNYQLIW_CASRISDSNYGYTF", 
    "CAPRGGWDMRF_CASSLGLAGPSTDTQYF", "CASPRNKLIF_CASTKKGTGFTNTEAFF", 
    "CAVESRAQKLVF_CASRHGANYGYTF", "CAVETGANNLFF_CSARPGQVNEKLFF", 
    "CAVETNTGFQKLVF_CSARAEPGLAGSYNEQFF", "CAVGSGGYQKVTF_CASSEQGAKQETQYF", 
    "CAVGSGYSTLTF_CASSFTSGSDTQYF", "CAVGTGGGNKLTF_CASRVGTSRQETQYF", 
    "CAVKGIGGGGADGLTF_CASSLEGGPLYGYTF", "CAVKNSGNTPLVF_CASSISSQNTGELFF", 
    "CAVLDSNYQLIW_CASSRGPDTGELFF", "CAVLDSNYQLIW_CASSYSSGRTTGELFF", 
    "CAVNADNQGGKLIF_CATSRDGRPIMEGQPQHF", "CAVNDYKLSF_CASSPPTANQETQYF", 
    "CAVPSTDSWGKLQF;CAVEDYNTDKLIF_CASSDRGGTDTQYF", "CAVPTSGTYKYIF_CASSFNPLAGGPERFF", 
    "CAVQALNFGNEKLTF_CASSQDRGFAEAFF", "CAVQAPRNTDKLIF_CASSGPGQGVGGYTF", 
    "CAVRDMDSNYQLIW_CAWSKGTLGELFF", "CAVRESSASKIIF;CAPPTGGGNKLTF_CATSDLRVDTGELFF", 
    "CAVRNNNARLMF_CASSRPRNRNNEKLFF", "CAVRWRGGATNKLIF_CASSSQTGGWETQYF", 
    "CAVSDRGGYQKVTF_CASSPSGGGNYNEQFF", "CAVSDYQAGTALIF_CASSQGTGNSPLHF", 
    "CAVSEGGATNKLIF_CASSSNPSGTVTWEQYF", "CAVSEPPGQKLLF_CASSFAGQPTDTQYF", 
    "CAVSESGGSYIPTF_CSARAAGQGGNTEAFF", "CAVSRGSNFGNEKLTF_CASSLGHNPLNTEAFF", 
    "CAVSSSGNQFYF_CAWRRTSGYTGELFF", "CAVSSSGSARQLTF_CASSLAGRDSGNTIYF", 
    "CAVSVPRGRDDKIIF_CASSLTSGNPFSYNEQFF", "CAVSVVVQTGANNLFF_CASSLSSPGVNTEAFF", 
    "CAVTLIQGAQKLVF_CAISAGGRETQYF", "CAVVFLSSGTYKYIF_CASSPNRGLSRHEQYF", 
    "CAVWPLGW_CSATFQGLGEQYF", "CAVYSSASKIIF_CSAIRRGSRTEAFF", 
    "CAYKWSNFGNEKLTF_CASSYPRDRGRETQYF", "CAYRGHTGTASKLTF_CASIPPGSNQPQHF", 
    "CAYRGPDKLIF_CSAGQDRWYEQYF", "CAYRKGGSEKLVF_CASRLDSTYGYTF", 
    "CAYRRGGLSGSARQLTF_CASRWTSGHTDTQYF", "CAYRRNTGTASKLTF_CASSPPGGSNEKLFF", 
    "CAYRTILSAGGTSYGKLTF_CASSSMGLAGGPGHEQYF", "CGADRNYGQNFVF_CASSQDRGRSYNSPLHF", 
    "CILKRQGGSEKLVF_CASSQGYTEAFF", "CILRTNFGNEKLTF_CASSRRGTERGHRTGELFF", 
    "CILSTQGGSEKLVF_CASKKVLIEGYTF", "CIPKEYGNKLVF_CASSFKGSTMYNEQFF", 
    "CIVRGPGGSSNTGKLIF_CASSTSGASGELFF", "CIVRVATETDKLIF_CASSLVGTTHIETQYF", 
    "CIVRVDGAQKLVF_CASSTGTSPGTQYF", "CIVRVGGGNAGNMLTF_CSAPGLLNEQFF", 
    "CLLGETSGSRLTF_CSARGMVRDGNNEQFF", "CLLVIKAAGNKLTF;CAIGGTSYGKLTF_CSARPQGVQVGTEAFF", 
    "CVVKGRDDKIIF_CASSVELAYTGELFF", "CVVREGAGNMLTF_CSVDLPGGGLGYTF", 
    "CVVSAKGGSQGNLIF_CASSQDWGGHNEQFF", "CVVSAQAAGNKLTF_CASSTNSGSEAFF", 
    "CVVSATGNTPLVF_CASSSPAGEAFF", "CVVSEGNNARLMF_CASSQGRAWADTQYF", 
    "CVVTTQTGANNLFF_CASRGTPTGELFF", "NA_CASGGTGGAAGELFF", "NA_CASSFPGQGSTEAFF", 
    "NA_CASSLDPGQGAVGYTQYF", "NA_CASSLGGPLHF", "NA_CASSLGGTGGETQYF", 
    "NA_CASSLPPYYEQYF", "NA_CASSLQGGTEAFF", "NA_CASSLTSGNPFSYNEQFF", 
    "NA_CASSPPGYTDTQYF", "NA_CASSPRGGNTEAFF", "NA_CASSPTGNTGELFF", 
    "NA_CASSPYQAYEQYF", "NA_CASSQGPGEGGYTF", "NA_CASSQGYTEAFF", 
    "NA_CASSRENTGELFF", "NA_CASSRQGTGNTIYF", "NA_CSARVGVETQYF", 
    "NA_CSVARQGNNEQFF", "NA_CSVEGTSANTGELFF", "CIVRPVTGANNLFF_CASSPAGTVPYEQYF"
    ), count = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L)), row.names = c(NA, -283L), class = c("tbl_df", "tbl", 
"data.frame"))

I would like to plot an alluvial/sankey with on the x-axis functional.clusters according to timepoints linked by ribbons corresponding to CTaa to evaluate the migration of CTaa across functional.cluster and timepoint.

So far I have tried with:

   cd4.surv.meta <- cd4.surv.meta %>%
  pivot_wider(names_from = timepoint, values_from = functional.cluster)

cd4.surv.meta <- cd4.surv.meta %>% 
  group_by(CTaa, Diagnosis, Timepoint1, lks) %>% 
  summarise(freq=n())


ggplot(cd4.surv.meta,
       aes(axis1 = Diagnosis, axis2 = Timepoint1, y=freq)) + geom_alluvium(aes(fill=CTaa))+
  geom_stratum()+ geom_text(stat = "stratum",
            aes(label = after_stat(stratum)))+facet_wrap(~lks)+
  theme(legend.position = "none")

which really has not treated me that well. The issue is that NA generated from celltype present at one timepoint are labelled as NA in the following and are plotted as a stratum (? don't know if this is the correct word) also in axis2. Any help? Thank you in advance

I have a similar dataframe

    structure(list(timepoint = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L), levels = c("Diagnosis", "Timepoint1"), class = "factor"), 
    functional.cluster = c("CD4.CTL_EOMES", "CD4.CTL_EOMES", 
    "CD4.CTL_EOMES", "CD4.CTL_EOMES", "CD4.CTL_EOMES", "CD4.CTL_GNLY", 
    "CD4.CTL_GNLY", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.Treg", 
    "CD4.CTL_EOMES", "CD4.CTL_EOMES", "CD4.CTL_GNLY", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", "CD4.NaiveLike", 
    "CD4.Treg"), CTaa = c("CAATFLSGSARQLTF_CASSPGNSKQYF", "CAMSGIAPIIQGAQKLVF_CASSHRDEQFF", 
    "CAVQAPRNTDKLIF_CASSGPGQGVGGYTF", "CILRTNFGNEKLTF_CASSRRGTERGHRTGELFF", 
    "NA_CASGGTGGAAGELFF", "CAGAGQGGKLIF;CAYSSNAGKSTF_CSAPQPTSGSYEQYF", 
    "NA_CASSFPGQGSTEAFF", "CAAAGGGFKTIF_CASSLEGETQYF", "CAAAPSSGSARQLTF_CASSPRTSGSFFTQYF", 
    "CAAIQGAQKLVF_CASSLTGGTTYEQYF", "CAAIYFGSNYQLIW;CVVNAGKSTF_CSARGGGTGDSYNSPLHF", 
    "CAAKPPGGTASKLTF_CASSFVGVNQPQHF", "CAALTNAGKSTF_CSARSRGLGQNQPQHF", 
    "CAANSNSGYALNF_CAISEQLTEQFF", "CAARGGNNRKLIW_CASYGQADGYTF", 
    "CAARGNSGGSNYKLTF;CALSEGYAGNNRKLIW_CASSQLTGSGGYTF", "CAASDGGSNYKLTF_CASSSGGGRTTQYF", 
    "CAASEVGGSQGNLIF_CASSPTGSRNTDTQYF", "CAASLGSGGFKTIF_CSASRGSGSGTGELFF", 
    "CAASPYSGAGSYQLTF_CASRDLKETQYF", "CAASRNNAGNMLTF_CASSFENTGELFF", 
    "CAASSGFGNVLHC_CSAGHNEQFF", "CAATRAGGTSYGKLTF_CASAINGGGTDTQYF", 
    "CAATTAQGGSEKLVF_CASSGTITGAGEQYF", "CAAYTSGGYQKVTF_CASSITQGSGELFF", 
    "CAENGANNLFF_CASSLRGIGNQPQHF", "CAENPGGYNKLIF_CASSQEGTKPQHF", 
    "CAETPYNFNKFYF_CSARDRLAGVGEQYF", "CAFMTSGSRLTF_CASQRGPGVSGGAKNIQYF", 
    "CAFRGGTSYGKLTF_CASSPRDRSGSSLAKNIQYF", "CAGARSGAGSYQLTF_CASSAQRPGLGLGNTIYF", 
    "CAGLDNYGQNFVF_CSARVGVETQYF", "CAGPANDYKLSF_CASSPGVGRETQYF", 
    "CAGPTGNQFYF_CSGSGGDTLPAEAFF", "CAGQGAQKLVF;CAVIVSGSNYKLTF_CASSQGQYGYTF", 
    "CAGQRMGGGADGLTF;CGAPSHAGNNRKLIW_CASSQVEAGGYTF", "CAGQRNYGGATNKLIF_CASNAGQTYEQYF", 
    "CAGSNFGNEKLTF_CASSLGARRDTQYF", "CAGTQGGGSEKLVF_CASSRQGTGNTIYF", 
    "CAGTRVSNYQLIW_CASSPPVWSDGDTGELFF", "CALARGNNARLMF_CSARQGDGELFF", 
    "CALDSSRGSGNTGKLIF_CASHRGDEQFF", "CALGGYSSASKIIF_CASSLDPGQGAVGYTQYF", 
    "CALGLYSGGGADGLTF_CASSLEGITEAFF", "CALHGSGNTGKLIF_CASSYQATSGANVLTF", 
    "CALHLGFGNVLHC_CSAPPSAVMGIQYF", "CALPTIGFGNVLHC_CASSLSQSGANVLTF", 
    "CALQTGGSQGNLIF_CASSLTGGSGNEQFF", "CALREAGNTPLVF_CASSLLAGSAGGELFF", 
    "CALRPSTTSGTYKYIF_CSAVPGGPSYNEQFF", "CALSDTSGSRLTF_CASSLVGLAGGDTDTQYF", 
    "CALSEAQVASGTYKYIF;CAVKMDSNYQLIW_CASSLRGRGNEQFF", "CALSEGNNARLMF_CASSQEASSNEQFF", 
    "CALSERETSGSRLTF_CASSLLARNTEAFF", "CALSGSGGSNYKLTF_CASSKQGASGNTIYF", 
    "CALSPRGSGTYKYIF_CASSEDGQRNTEAFF", "CALSVAGGTSYGKLTF_CASSLAGTKNIQYF", 
    "CALTSGGGADGLTF_CASSRTGGSTDTQYF", "CAMREASLHGSSNTGKLIF_CASARRAQAMENYGYTF", 
    "CAMSAADNFNKFYF_CASRQGLGNSPLHF", "CAMSARAGNNRKLIW_CASSLALPDTQYF", 
    "CAPMDSNYQLIW_CASRISDSNYGYTF", "CAPRGGWDMRF_CASSLGLAGPSTDTQYF", 
    "CASPRNKLIF_CASTKKGTGFTNTEAFF", "CAVESRAQKLVF_CASRHGANYGYTF", 
    "CAVETGANNLFF_CSARPGQVNEKLFF", "CAVETNTGFQKLVF_CSARAEPGLAGSYNEQFF", 
    "CAVGSGGYQKVTF_CASSEQGAKQETQYF", "CAVGTGGGNKLTF_CASRVGTSRQETQYF", 
    "CAVKGIGGGGADGLTF_CASSLEGGPLYGYTF", "CAVKNSGNTPLVF_CASSISSQNTGELFF", 
    "CAVLDSNYQLIW_CASSRGPDTGELFF", "CAVLDSNYQLIW_CASSYSSGRTTGELFF", 
    "CAVNADNQGGKLIF_CATSRDGRPIMEGQPQHF", "CAVNDYKLSF_CASSPPTANQETQYF", 
    "CAVPSTDSWGKLQF;CAVEDYNTDKLIF_CASSDRGGTDTQYF", "CAVPTSGTYKYIF_CASSFNPLAGGPERFF", 
    "CAVQALNFGNEKLTF_CASSQDRGFAEAFF", "CAVQAPRNTDKLIF_CASSGPGQGVGGYTF", 
    "CAVRDMDSNYQLIW_CAWSKGTLGELFF", "CAVRESSASKIIF;CAPPTGGGNKLTF_CATSDLRVDTGELFF", 
    "CAVRNNNARLMF_CASSRPRNRNNEKLFF", "CAVRWRGGATNKLIF_CASSSQTGGWETQYF", 
    "CAVSDRGGYQKVTF_CASSPSGGGNYNEQFF", "CAVSDYQAGTALIF_CASSQGTGNSPLHF", 
    "CAVSEGGATNKLIF_CASSSNPSGTVTWEQYF", "CAVSEPPGQKLLF_CASSFAGQPTDTQYF", 
    "CAVSESGGSYIPTF_CSARAAGQGGNTEAFF", "CAVSRGSNFGNEKLTF_CASSLGHNPLNTEAFF", 
    "CAVSSSGNQFYF_CAWRRTSGYTGELFF", "CAVSSSGSARQLTF_CASSLAGRDSGNTIYF", 
    "CAVSVPRGRDDKIIF_CASSLTSGNPFSYNEQFF", "CAVSVVVQTGANNLFF_CASSLSSPGVNTEAFF", 
    "CAVTLIQGAQKLVF_CAISAGGRETQYF", "CAVVFLSSGTYKYIF_CASSPNRGLSRHEQYF", 
    "CAVWPLGW_CSATFQGLGEQYF", "CAVYSSASKIIF_CSAIRRGSRTEAFF", 
    "CAYKWSNFGNEKLTF_CASSYPRDRGRETQYF", "CAYRGHTGTASKLTF_CASIPPGSNQPQHF", 
    "CAYRGPDKLIF_CSAGQDRWYEQYF", "CAYRKGGSEKLVF_CASRLDSTYGYTF", 
    "CAYRRGGLSGSARQLTF_CASRWTSGHTDTQYF", "CAYRRNTGTASKLTF_CASSPPGGSNEKLFF", 
    "CAYRTILSAGGTSYGKLTF_CASSSMGLAGGPGHEQYF", "CGADRNYGQNFVF_CASSQDRGRSYNSPLHF", 
    "CILKRQGGSEKLVF_CASSQGYTEAFF", "CILSTQGGSEKLVF_CASKKVLIEGYTF", 
    "CIPKEYGNKLVF_CASSFKGSTMYNEQFF", "CIVRGPGGSSNTGKLIF_CASSTSGASGELFF", 
    "CIVRPVTGANNLFF_CASSPAGTVPYEQYF", "CIVRVATETDKLIF_CASSLVGTTHIETQYF", 
    "CIVRVDGAQKLVF_CASSTGTSPGTQYF", "CIVRVGGGNAGNMLTF_CSAPGLLNEQFF", 
    "CLLGETSGSRLTF_CSARGMVRDGNNEQFF", "CLLVIKAAGNKLTF;CAIGGTSYGKLTF_CSARPQGVQVGTEAFF", 
    "CVVKGRDDKIIF_CASSVELAYTGELFF", "CVVREGAGNMLTF_CSVDLPGGGLGYTF", 
    "CVVSAKGGSQGNLIF_CASSQDWGGHNEQFF", "CVVSAQAAGNKLTF_CASSTNSGSEAFF", 
    "CVVSATGNTPLVF_CASSSPAGEAFF", "CVVSEGNNARLMF_CASSQGRAWADTQYF", 
    "CVVTTQTGANNLFF_CASRGTPTGELFF", "NA_CASGGTGGAAGELFF", "NA_CASSFPGQGSTEAFF", 
    "NA_CASSLDPGQGAVGYTQYF", "NA_CASSLGGPLHF", "NA_CASSLGGTGGETQYF", 
    "NA_CASSLPPYYEQYF", "NA_CASSLQGGTEAFF", "NA_CASSLTSGNPFSYNEQFF", 
    "NA_CASSPPGYTDTQYF", "NA_CASSPRGGNTEAFF", "NA_CASSPTGNTGELFF", 
    "NA_CASSPYQAYEQYF", "NA_CASSQGPGEGGYTF", "NA_CASSQGYTEAFF", 
    "NA_CASSRENTGELFF", "NA_CASSRQGTGNTIYF", "NA_CSARVGVETQYF", 
    "NA_CSVARQGNNEQFF", "NA_CSVEGTSANTGELFF", "CAVGSGYSTLTF_CASSFTSGSDTQYF", 
    "CAATFLSGSARQLTF_CASSPGNSKQYF", "CAENPGGYNKLIF_CASSQEGTKPQHF", 
    "CVVTTQTGANNLFF_CASRGTPTGELFF", "CAAAGGGFKTIF_CASSLEGETQYF", 
    "CAAAPSSGSARQLTF_CASSPRTSGSFFTQYF", "CAAIQGAQKLVF_CASSLTGGTTYEQYF", 
    "CAAIYFGSNYQLIW;CVVNAGKSTF_CSARGGGTGDSYNSPLHF", "CAAKPPGGTASKLTF_CASSFVGVNQPQHF", 
    "CAALTNAGKSTF_CSARSRGLGQNQPQHF", "CAANSNSGYALNF_CAISEQLTEQFF", 
    "CAARGGNNRKLIW_CASYGQADGYTF", "CAARGNSGGSNYKLTF;CALSEGYAGNNRKLIW_CASSQLTGSGGYTF", 
    "CAASDGGSNYKLTF_CASSSGGGRTTQYF", "CAASEVGGSQGNLIF_CASSPTGSRNTDTQYF", 
    "CAASLGSGGFKTIF_CSASRGSGSGTGELFF", "CAASPYSGAGSYQLTF_CASRDLKETQYF", 
    "CAASRNNAGNMLTF_CASSFENTGELFF", "CAASSGFGNVLHC_CSAGHNEQFF", 
    "CAATRAGGTSYGKLTF_CASAINGGGTDTQYF", "CAATTAQGGSEKLVF_CASSGTITGAGEQYF", 
    "CAAYTSGGYQKVTF_CASSITQGSGELFF", "CAENGANNLFF_CASSLRGIGNQPQHF", 
    "CAENPGGYNKLIF_CASSQEGTKPQHF", "CAETPYNFNKFYF_CSARDRLAGVGEQYF", 
    "CAFMTSGSRLTF_CASQRGPGVSGGAKNIQYF", "CAFRGGTSYGKLTF_CASSPRDRSGSSLAKNIQYF", 
    "CAGAGQGGKLIF;CAYSSNAGKSTF_CSAPQPTSGSYEQYF", "CAGARSGAGSYQLTF_CASSAQRPGLGLGNTIYF", 
    "CAGLDNYGQNFVF_CSARVGVETQYF", "CAGPANDYKLSF_CASSPGVGRETQYF", 
    "CAGPTGNQFYF_CSGSGGDTLPAEAFF", "CAGQGAQKLVF;CAVIVSGSNYKLTF_CASSQGQYGYTF", 
    "CAGQRMGGGADGLTF;CGAPSHAGNNRKLIW_CASSQVEAGGYTF", "CAGQRNYGGATNKLIF_CASNAGQTYEQYF", 
    "CAGSNFGNEKLTF_CASSLGARRDTQYF", "CAGTQGGGSEKLVF_CASSRQGTGNTIYF", 
    "CAGTRVSNYQLIW_CASSPPVWSDGDTGELFF", "CALARGNNARLMF_CSARQGDGELFF", 
    "CALDSSRGSGNTGKLIF_CASHRGDEQFF", "CALGGYSSASKIIF_CASSLDPGQGAVGYTQYF", 
    "CALGLYSGGGADGLTF_CASSLEGITEAFF", "CALHGSGNTGKLIF_CASSYQATSGANVLTF", 
    "CALHLGFGNVLHC_CSAPPSAVMGIQYF", "CALPTIGFGNVLHC_CASSLSQSGANVLTF", 
    "CALQTGGSQGNLIF_CASSLTGGSGNEQFF", "CALREAGNTPLVF_CASSLLAGSAGGELFF", 
    "CALRPSTTSGTYKYIF_CSAVPGGPSYNEQFF", "CALSDTSGSRLTF_CASSLVGLAGGDTDTQYF", 
    "CALSEAQVASGTYKYIF;CAVKMDSNYQLIW_CASSLRGRGNEQFF", "CALSEGNNARLMF_CASSQEASSNEQFF", 
    "CALSERETSGSRLTF_CASSLLARNTEAFF", "CALSGSGGSNYKLTF_CASSKQGASGNTIYF", 
    "CALSPRGSGTYKYIF_CASSEDGQRNTEAFF", "CALSVAGGTSYGKLTF_CASSLAGTKNIQYF", 
    "CALTSGGGADGLTF_CASSRTGGSTDTQYF", "CAMREASLHGSSNTGKLIF_CASARRAQAMENYGYTF", 
    "CAMSAADNFNKFYF_CASRQGLGNSPLHF", "CAMSARAGNNRKLIW_CASSLALPDTQYF", 
    "CAMSGIAPIIQGAQKLVF_CASSHRDEQFF", "CAPMDSNYQLIW_CASRISDSNYGYTF", 
    "CAPRGGWDMRF_CASSLGLAGPSTDTQYF", "CASPRNKLIF_CASTKKGTGFTNTEAFF", 
    "CAVESRAQKLVF_CASRHGANYGYTF", "CAVETGANNLFF_CSARPGQVNEKLFF", 
    "CAVETNTGFQKLVF_CSARAEPGLAGSYNEQFF", "CAVGSGGYQKVTF_CASSEQGAKQETQYF", 
    "CAVGSGYSTLTF_CASSFTSGSDTQYF", "CAVGTGGGNKLTF_CASRVGTSRQETQYF", 
    "CAVKGIGGGGADGLTF_CASSLEGGPLYGYTF", "CAVKNSGNTPLVF_CASSISSQNTGELFF", 
    "CAVLDSNYQLIW_CASSRGPDTGELFF", "CAVLDSNYQLIW_CASSYSSGRTTGELFF", 
    "CAVNADNQGGKLIF_CATSRDGRPIMEGQPQHF", "CAVNDYKLSF_CASSPPTANQETQYF", 
    "CAVPSTDSWGKLQF;CAVEDYNTDKLIF_CASSDRGGTDTQYF", "CAVPTSGTYKYIF_CASSFNPLAGGPERFF", 
    "CAVQALNFGNEKLTF_CASSQDRGFAEAFF", "CAVQAPRNTDKLIF_CASSGPGQGVGGYTF", 
    "CAVRDMDSNYQLIW_CAWSKGTLGELFF", "CAVRESSASKIIF;CAPPTGGGNKLTF_CATSDLRVDTGELFF", 
    "CAVRNNNARLMF_CASSRPRNRNNEKLFF", "CAVRWRGGATNKLIF_CASSSQTGGWETQYF", 
    "CAVSDRGGYQKVTF_CASSPSGGGNYNEQFF", "CAVSDYQAGTALIF_CASSQGTGNSPLHF", 
    "CAVSEGGATNKLIF_CASSSNPSGTVTWEQYF", "CAVSEPPGQKLLF_CASSFAGQPTDTQYF", 
    "CAVSESGGSYIPTF_CSARAAGQGGNTEAFF", "CAVSRGSNFGNEKLTF_CASSLGHNPLNTEAFF", 
    "CAVSSSGNQFYF_CAWRRTSGYTGELFF", "CAVSSSGSARQLTF_CASSLAGRDSGNTIYF", 
    "CAVSVPRGRDDKIIF_CASSLTSGNPFSYNEQFF", "CAVSVVVQTGANNLFF_CASSLSSPGVNTEAFF", 
    "CAVTLIQGAQKLVF_CAISAGGRETQYF", "CAVVFLSSGTYKYIF_CASSPNRGLSRHEQYF", 
    "CAVWPLGW_CSATFQGLGEQYF", "CAVYSSASKIIF_CSAIRRGSRTEAFF", 
    "CAYKWSNFGNEKLTF_CASSYPRDRGRETQYF", "CAYRGHTGTASKLTF_CASIPPGSNQPQHF", 
    "CAYRGPDKLIF_CSAGQDRWYEQYF", "CAYRKGGSEKLVF_CASRLDSTYGYTF", 
    "CAYRRGGLSGSARQLTF_CASRWTSGHTDTQYF", "CAYRRNTGTASKLTF_CASSPPGGSNEKLFF", 
    "CAYRTILSAGGTSYGKLTF_CASSSMGLAGGPGHEQYF", "CGADRNYGQNFVF_CASSQDRGRSYNSPLHF", 
    "CILKRQGGSEKLVF_CASSQGYTEAFF", "CILRTNFGNEKLTF_CASSRRGTERGHRTGELFF", 
    "CILSTQGGSEKLVF_CASKKVLIEGYTF", "CIPKEYGNKLVF_CASSFKGSTMYNEQFF", 
    "CIVRGPGGSSNTGKLIF_CASSTSGASGELFF", "CIVRVATETDKLIF_CASSLVGTTHIETQYF", 
    "CIVRVDGAQKLVF_CASSTGTSPGTQYF", "CIVRVGGGNAGNMLTF_CSAPGLLNEQFF", 
    "CLLGETSGSRLTF_CSARGMVRDGNNEQFF", "CLLVIKAAGNKLTF;CAIGGTSYGKLTF_CSARPQGVQVGTEAFF", 
    "CVVKGRDDKIIF_CASSVELAYTGELFF", "CVVREGAGNMLTF_CSVDLPGGGLGYTF", 
    "CVVSAKGGSQGNLIF_CASSQDWGGHNEQFF", "CVVSAQAAGNKLTF_CASSTNSGSEAFF", 
    "CVVSATGNTPLVF_CASSSPAGEAFF", "CVVSEGNNARLMF_CASSQGRAWADTQYF", 
    "CVVTTQTGANNLFF_CASRGTPTGELFF", "NA_CASGGTGGAAGELFF", "NA_CASSFPGQGSTEAFF", 
    "NA_CASSLDPGQGAVGYTQYF", "NA_CASSLGGPLHF", "NA_CASSLGGTGGETQYF", 
    "NA_CASSLPPYYEQYF", "NA_CASSLQGGTEAFF", "NA_CASSLTSGNPFSYNEQFF", 
    "NA_CASSPPGYTDTQYF", "NA_CASSPRGGNTEAFF", "NA_CASSPTGNTGELFF", 
    "NA_CASSPYQAYEQYF", "NA_CASSQGPGEGGYTF", "NA_CASSQGYTEAFF", 
    "NA_CASSRENTGELFF", "NA_CASSRQGTGNTIYF", "NA_CSARVGVETQYF", 
    "NA_CSVARQGNNEQFF", "NA_CSVEGTSANTGELFF", "CIVRPVTGANNLFF_CASSPAGTVPYEQYF"
    ), count = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L)), row.names = c(NA, -283L), class = c("tbl_df", "tbl", 
"data.frame"))

I would like to plot an alluvial/sankey with on the x-axis functional.clusters according to timepoints linked by ribbons corresponding to CTaa to evaluate the migration of CTaa across functional.cluster and timepoint.

So far I have tried with:

   cd4.surv.meta <- cd4.surv.meta %>%
  pivot_wider(names_from = timepoint, values_from = functional.cluster)

cd4.surv.meta <- cd4.surv.meta %>% 
  group_by(CTaa, Diagnosis, Timepoint1, lks) %>% 
  summarise(freq=n())


ggplot(cd4.surv.meta,
       aes(axis1 = Diagnosis, axis2 = Timepoint1, y=freq)) + geom_alluvium(aes(fill=CTaa))+
  geom_stratum()+ geom_text(stat = "stratum",
            aes(label = after_stat(stratum)))+facet_wrap(~lks)+
  theme(legend.position = "none")

which really has not treated me that well. The issue is that NA generated from celltype present at one timepoint are labelled as NA in the following and are plotted as a stratum (? don't know if this is the correct word) also in axis2. Any help? Thank you in advance

Share Improve this question edited yesterday Alfredo Marchetti asked 2 days ago Alfredo MarchettiAlfredo Marchetti 336 bronze badges 1
  • 1 The code for cd4.surv.meta return an error. Please edit your question to provide a minimal reproducible example of your code and data along with relevant errors so that readers can run your code to answer your question. – M-- Commented 2 days ago
Add a comment  | 

1 Answer 1

Reset to default 1

Ah, you probably mean this:

library(dplyr)
library(tidyr)
library(ggplot2)
library(ggalluvial)
df <- *your data frame*
# Separate rows for Diagnosis and TimePoint1
diagnosis <- df %>% filter(timepoint == "Diagnosis")
timepoint1 <- df %>% filter(timepoint == "Timepoint1")

# Combine Diagnosis and TimePoint1 for Sankey plot
# Assume clusters are linked by row for simplicity; adapt as necessary
sankey_data <- data.frame(
  axis1 = diagnosis$functional.cluster,
  axis2 = rep(timepoint1$functional.cluster, length.out = nrow(diagnosis)),
  count = diagnosis$count
)


# Plot Sankey diagram
ggplot(sankey_data, aes(axis1 = axis1, axis2 = axis2, y = count)) +
  geom_alluvium(aes(fill = axis1), width = 0.3) +
  geom_stratum(width = 0.3, fill = "gray", color = "black") +
  geom_text(stat = "stratum", aes(label = after_stat(stratum)), size =1) +
  theme_minimal() +

  theme(legend.position = "none")  +
  ggtitle("Sankey Diagram of Functional Clusters") +
  xlab("Timepoints") +
  ylab("Freq") +
  scale_x_discrete(limits = c("Diagnosis", "TimePoint1"))

本文标签: ggplot2alluvialsankey diagram with values from different timepoints in RStack Overflow