Home>

R, a question about data mining. I'm an R super beginner and asked a similar question a few days ago.
I want to plot the statistics of the imported data from the csv file below on a line graph with ggplot.
If i import a csv file and write it in R, it will be displayed as shown at the bottom. Using this data directly, I would like to plot the "Signal" average on the Y axis and the "Time" as a categorial variable on the X axis.
If i draw the graph with the code below using the data for practice on other websites, the graph will appear properly, so I think there is a problem with the data formatting, but there is something wrong Is it? I would be pleased if someone could teach me.

I wrote the code as follows.
"DT"is the data originally in csv placed at the bottom.

a<-ggplot (DT, aes (x = as.numeric (Time), y = Signal)) +
  stat_summary (fun.y = mean, geom = "point", size = 4) +
  stat_summary (fun.y = mean, geom = "line", size = 1)
a +
  xlab ("Time") +
  theme (axis.title.x = element_text (color = "Black", size = 25),
        axis.title.y = element_text (color = "Black", size = 25),
        axis.text.x = element_text (size = 15),
        axis.text.y = element_text (size = 15),
        legend.title = element_text (size = 15),
        legend.text = element_text (size = 15),
        legend.position = c (1,1),
        legend.justification = c (1,1))
A tibble: 16 x 3

ID Time Signal
<chr><chr><int>
1 MDC16b-1 0min 342
2 MDC16b-2-1 0min 360
3 MDC16b-2-2 0min 248
4 MDC16b-3-1 0min 144
5 MDC16b-1 1min 336
6 MDC16b-2-1 1min 348
7 MDC16b-2-2 1min 241
8 MDC16b-3-1 1min 145
9 MDC16b-1 5min 330
10 MDC16b-2-1 5min 347
11 MDC16b-2-2 5min 237
12 MDC16b-3-1 5min 145
13 MDC16b-1 10min 335
14 MDC16b-2-1 10min 345
15 MDC16b-2-2 10min 233
16 MDC16b-3-1 10min 145

Warning messages:
1: In fun (x, ...): NAs introduced by coercion
2: In FUN (X [[i]], ...): NAs introduced by coercion
3: In FUN (X [[i]], ...): NAs introduced by coercion
4: Removed 16 rows containing non-finite values ​​(stat_summary).
5: Removed 16 rows containing non-finite values ​​(stat_summary).
Warning will come out.