Browse code

fixed warning message in plotRPC

Joshua D. Campbell authored on 10/07/2021 18:13:39
Showing 1 changed files

... ...
@@ -882,7 +882,8 @@ setMethod("plotRPC",
882 882
         diffMeansByK$L <- as.factor(diffMeansByK$L)
883 883
         diffMeansByK$rollmean <- data.table::frollmean(
884 884
             diffMeansByK$meanperpdiffK, n = n, align = "center")
885
-
885
+        diffMeansByK <- diffMeansByK[complete.cases(diffMeansByK),]
886
+        
886 887
         if (nlevels(dt$L) > 1) {
887 888
             plot <- ggplot2::ggplot(dt[!is.na(perpdiffK), ],
888 889
                 ggplot2::aes_string(x = "K",
... ...
@@ -890,7 +891,7 @@ setMethod("plotRPC",
890 891
                 ggplot2::geom_jitter(height = 0, width = 0.1, alpha = alpha,
891 892
                     ggplot2::aes_string(color = "L")) +
892 893
                 ggplot2::scale_color_discrete(name = "L") +
893
-                ggplot2::geom_path(data = diffMeansByK[!is.na(meanperpdiffK), ],
894
+                ggplot2::geom_path(data = diffMeansByK,
894 895
                     ggplot2::aes_string(x = "K", y = "rollmean", group = "L",
895 896
                         color = "L"), size = 1) +
896 897
                 ggplot2::ylab("Rate of perplexity change") +
... ...
@@ -908,7 +909,7 @@ setMethod("plotRPC",
908 909
                 ggplot2::geom_jitter(height = 0, width = 0.1,
909 910
                     color = "grey", alpha = alpha) +
910 911
                 ggplot2::scale_color_manual(name = "L", values = "black") +
911
-                ggplot2::geom_path(data = diffMeansByK[!is.na(meanperpdiffK), ],
912
+                ggplot2::geom_path(data = diffMeansByK,
912 913
                     ggplot2::aes_string(x = "K", y = "rollmean", group = "L",
913 914
                         color = "L"), size = 1) +
914 915
                 ggplot2::ylab("Rate of perplexity change") +
... ...
@@ -938,14 +939,15 @@ setMethod("plotRPC",
938 939
         diffMeansByL$L <- as.factor(diffMeansByL$L)
939 940
         diffMeansByL$rollmean <- data.table::frollmean(
940 941
             diffMeansByL$meanperpdiffL, n = n, align = "center")
941
-
942
+        diffMeansByL <- diffMeansByL[complete.cases(diffMeansByL),]
943
+        
942 944
         plot <- ggplot2::ggplot(dt[!is.na(perpdiffL), ],
943 945
             ggplot2::aes_string(x = "L", y = "perpdiffL")) +
944 946
             ggplot2::geom_jitter(height = 0, width = 0.1,
945 947
                 color = "grey", alpha = alpha) +
946 948
             ggplot2::scale_color_manual(name = "K", values = "black") +
947 949
             ggplot2::geom_path(
948
-                data = diffMeansByL[!is.na(meanperpdiffL), ],
950
+                data = diffMeansByL,
949 951
                 ggplot2::aes_string(
950 952
                     x = "L", y = "rollmean", group = "K", color = "K"),
951 953
                 size = 1) +
... ...
@@ -1000,13 +1002,14 @@ setMethod("plotRPC",
1000 1002
         diffMeansByK$K <- as.factor(diffMeansByK$K)
1001 1003
         diffMeansByK$rollmean <- data.table::frollmean(
1002 1004
             diffMeansByK$meanperpdiffK, n = n, align = "center")
1003
-
1005
+        diffMeansByK <- diffMeansByK[complete.cases(diffMeansByK),]
1006
+        
1004 1007
         plot <- ggplot2::ggplot(dt[!is.na(perpdiffK), ],
1005 1008
             ggplot2::aes_string(x = "K",
1006 1009
                 y = "perpdiffK")) +
1007 1010
             ggplot2::geom_jitter(height = 0, width = 0.1,
1008 1011
                 color = "grey", alpha = alpha) +
1009
-            ggplot2::geom_path(data = diffMeansByK[!is.na(meanperpdiffK), ],
1012
+            ggplot2::geom_path(data = diffMeansByK,
1010 1013
                 ggplot2::aes_string(x = "K", y = "rollmean", group = 1),
1011 1014
                 size = 1) +
1012 1015
             ggplot2::ylab("Perplexity difference compared to previous K") +
... ...
@@ -1059,13 +1062,14 @@ setMethod("plotRPC",
1059 1062
         diffMeansByL$L <- as.factor(diffMeansByL$L)
1060 1063
         diffMeansByL$rollmean <- data.table::frollmean(
1061 1064
             diffMeansByL$meanperpdiffL, n = n, align = "center")
1062
-
1065
+        diffMeansByL <- diffMeansByL[complete.cases(diffMeansByL),]
1066
+        
1063 1067
         plot <- ggplot2::ggplot(dt[!is.na(perpdiffL), ],
1064 1068
             ggplot2::aes_string(x = "L",
1065 1069
                 y = "perpdiffL")) +
1066 1070
             ggplot2::geom_jitter(height = 0, width = 0.1,
1067 1071
                 color = "grey", alpha = alpha) +
1068
-            ggplot2::geom_path(data = diffMeansByL[!is.na(meanperpdiffL), ],
1072
+            ggplot2::geom_path(data = diffMeansByL,
1069 1073
                 ggplot2::aes_string(x = "L", y = "rollmean", group = 1),
1070 1074
                 size = 1) +
1071 1075
             ggplot2::ylab("Perplexity difference compared to previous L") +