Question: `$table->text('company_logo')->nullable();`

I'm trying to create a migration to store Base 64 Encoded image in my My SQL database. I'm not if what I have is good enough. 

Is what I have good enough ? How do I know it ?

Answer: 
You can also use the `dplyr` package to aggregate the data:

```
library(dplyr)
mean_data <- group_by(data, gender, week) %>%
             summarise(motivation = mean(motivation, na.rm = TRUE))

```

You can use `na.omit()` to get rid of the `NA` values as follows:

```
library(ggplot2)
ggplot(na.omit(mean_data), aes(x = week, y = motivation, colour = gender)) +
  geom_point() + geom_line()

```

[![enter image description here](https://i.stack.imgur.com/F7IHh.png)](https://i.stack.imgur.com/F7IHh.png)

There is no need here to explicitly use the `group` aesthetic because `ggplot` will automatically group the lines by the categorical variables in your plot. And the only categorical variable you have is `gender`. (See [this answer](https://stackoverflow.com/a/10358388/4303162) for more information).
You almost certainly have to make sure those grouping variables are factors.

I'm not quite sure what you want, but here's a shot...

```
library("ggplot2")
df <- read.table(textConnection("ID  gender  week  class  motivation
1   male    0     1       100
1   male    6     1       120
1   male    10    1       130
2   female  0     1       90
2   female  6     1       NA
2   female  10    1       117
3   male    0     2       89
3   male    6     2       112
3   male    10    2       NA"), header=TRUE, stringsAsFactors=FALSE)

df2 <- aggregate(df$motivation, by=list(df$gender, df$week), 
             function(x)mean(x, na.rm=TRUE))
names(df2) <- c("gender", "week", "avg")
df2$gender <- factor(df2$gender)
ggplot(data = df2[!is.na(df2$avg), ], 
       aes(x = week, y = avg, group=gender, color=gender)) + 
  geom_point()+geom_line()

```

[![enter image description here](https://i.stack.imgur.com/YF0B2.png)](https://i.stack.imgur.com/YF0B2.png)