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: 
There is also a DOM attribute called `cdkFocusInitial` which works for me on inputs.
You can read more about it here: <https://material.angular.io/cdk/a11y/overview>
Easier way is also to do this.

```
let elementReference = document.querySelector('<your css, #id selector>');
    if (elementReference instanceof HTMLElement) {
        elementReference.focus();
    }

```