Question: I have a dataframe in R of the following form: 

```
                     lemma       mi                                 doc
1        butroe_polihalino 5.385031 ANEJO_05_Q ECOL_Cantabrico Oriental
2        tramo_oligohalino 5.385031 ANEJO_05_Q ECOL_Cantabrico Oriental
3 programas_de_seguimiento 5.385031 ANEJO_05_Q ECOL_Cantabrico Oriental
4                     ifim 5.385031 ANEJO_05_Q ECOL_Cantabrico Oriental
5                      rdl 5.385031 ANEJO_05_Q ECOL_Cantabrico Oriental
6                 prointec 5.385031 ANEJO_05_Q ECOL_Cantabrico Oriental

```

And I want to create a sparse matrix (in which I'll run PCA) of the form:

```
                butroe_polihalino tramo_oligohalino ...
ANEJO_05_...    5.385031          5.385031
docs2           (no value)        4.321345
...

```

Which basically contains docs as rows, lemmas as columns and the mi is the value. Also it is possible to have not defined values.

Is there any way of defining a sparse matrix like that in R from the data?

Answer: 
Only using Angular Template

```
<input type="text" #searchText>

<span (click)="searchText.focus()">clear</span>

```
When using an overlay/dialog, you need to use `cdkFocusInitial` within `cdkTrapFocus` and `cdkTrapFocusAutoCapture`.

[CDK Regions](https://material.angular.io/cdk/a11y/overview#regions):

> 
> If you're using cdkFocusInitial together with the CdkTrapFocus directive, nothing will happen unless you've enabled the cdkTrapFocusAutoCapture option as well. This is due to CdkTrapFocus not capturing focus on initialization by default.
> 
> 
> 

In the overlay/dialog component:

```html
<div cdkTrapFocus cdkTrapFocusAutoCapture>
  <input cdkFocusInitial>
</div>

```