Check out the welcome message for help on how to ask questions.
Using dplyr::mutate
is one way to create new columns or variables in your data. Something like this might work.
# package libraries
library(tidyverse)
# generate 'sample' data to answer question
sample_data <- iris %>%
as_tibble()
# use `mutate` to create new column, but do not save to data
sample_data %>%
mutate(
new_column = "448602"
)
#> # A tibble: 150 × 6
#> Sepal.Length Sepal.Width Petal.Length Petal.Width Species new_column
#> <dbl> <dbl> <dbl> <dbl> <fct> <chr>
#> 1 5.1 3.5 1.4 0.2 setosa 448602
#> 2 4.9 3 1.4 0.2 setosa 448602
#> 3 4.7 3.2 1.3 0.2 setosa 448602
#> 4 4.6 3.1 1.5 0.2 setosa 448602
#> 5 5 3.6 1.4 0.2 setosa 448602
#> 6 5.4 3.9 1.7 0.4 setosa 448602
#> 7 4.6 3.4 1.4 0.3 setosa 448602
#> 8 5 3.4 1.5 0.2 setosa 448602
#> 9 4.4 2.9 1.4 0.2 setosa 448602
#> 10 4.9 3.1 1.5 0.1 setosa 448602
#> # ℹ 140 more rows
Created on 2024-02-02 with reprex v2.0.2