Home > Mobile >  Put Column Values into combine function "c()" - R
Put Column Values into combine function "c()" - R

Time:12-28

How to put all values from a column into a c() function. For example:

Column A Column B
A 100
B 200
C 300

How do I get all values of Column A into c('A', 'B', 'C'), without "hard-coding" the values?

I tried using c(df$Column.A), but I'm not sure if this works/the best way to do this.

CodePudding user response:

We could use dput():

dput(df$ColumnA)

c("A", "B", "C")
  •  Tags:  
  • r
  • Related