Question: I have a `data.frame` with two variables: `ID` and `Text`
I am using the following text analysis command that gives a `data.frame` output of 48 columns.

```
analysis <- textstat_readability(mydata$text,  measure = c("all"), remove_hyphens = TRUE)

```

How can I add those 48 columns of results as separate columns in `mydata`?

Currently I am using the following:

```
analysis <- cbind(mydata$ID[1:100000], textstat_readability(mydata$text[1:100000],  measure = c("all"), remove_hyphens = TRUE))

```

But it takes forever to finish.

Answer: 
If you're wanting to pass the same data to multiple views within your application you could use [View Composers](https://laravel.com/docs/5.2/views#view-composers)

E.g. in the `boot()` method of your AppServiceProvider you would have something like:

```
public function boot()
{
    view()->composer(['home', 'profile'], function ($view) {

        $notifications = \App\Notification::all(); //Change this to the code you would use to get the notifications

        $view->with('notifications', $notifications);
    });
}

```

Then you would just add the different blade file names (like you would with a route) to the array.

---

Alternatively, you could [share](https://laravel.com/docs/5.2/views#sharing-data-with-all-views) the notifications with all views:

```
public function boot()
{
    $notifications = \App\Notification::all(); //Change this to the code you would use to get the notifications

    view()->share('notifications', $notifications);
}

```
Create a `BaseController`, and share data from there like so:

```
<?php 
namespace App\Http\Controllers;

use View;

//You can create a BaseController:

class BaseController extends Controller {

    public $dataVariable = "some data";

    public function __construct() {

       $anotherVariable = "more data";

       $notifications = Notification::where('is_seen',0)->get(); // assuming this gets unseen notifications
       $unseen_notification_counter = count($notifications); 

       View::share ( 'notifications', $notifications );
       View::share ( 'unseen_notification_counter', $unseen_notification_counter );
       View::share ( 'data_variable', $this->dataVariable );
       View::share ( 'another_variable', $this->anotherVariable );
    }  

}

```

All controllers that extend `BaseController` will have access to the data. Do something like this:

```
class DashboardController extends BaseController {

    public function Index(){
      return view('index'); // all the shared data is available in the view ($notifications and $unseen_notification_counter)
    }
}

```

Hope it works.