def_sym | R Documentation |

Define (invisibly) caracas symbols in global environment

Define symbol for components in vector

```
def_sym(..., charvec = NULL, warn = FALSE, env = parent.frame())
def_sym_vec(x, env = parent.frame())
```

`...` |
Names for new symbols, also supports non-standard evaluation |

`charvec` |
Take each element in this character vector and define as caracas symbols |

`warn` |
Warn if existing variable names are overwritten |

`env` |
The environment in which the assignment is made. |

`x` |
Character vector. |

Names of declared variables (invisibly)

`symbol()`

, `as_sym()`

```
if (has_sympy()) {
ls()
def_sym(n1, n2, n3)
ls()
def_sym("x1", "x2", "x3")
ls()
# def_sym("x1", "x2", "x3", warn = TRUE) # Do not run as will cause a warning
ls()
def_sym(i, j, charvec = c("x", "y"))
ls()
}
if (has_sympy()) {
def_sym(z1, z2, z3)
u <- paste0("u", seq_len(3))
## Creates symbols u1, u2, u3 and binds to names u1, u2, u3 in R.
def_sym_vec(u)
## Same as (but easier than)
def_sym(u1, u2, u3)
## Notice: this creates matrix [u1, u2, u3]
as_sym(u)
}
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.