Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

Can we replicate only the column names of different datasets with only 1 line of sentence as contents

$
0
0

I have a dataframe df

df
ColA   COlB
A        F
B        D
C        E

I convert above data to DT. So it looks like (with filters, customised etc). But is it possible to have something like this

df1
ColA   COLB
 "Message"
df <- structure(list(A = structure(1:2, .Label = c("A", "B"), class = "factor"), 
               B = structure(1:2, .Label = c("D", "E"), class = "factor")), class = "data.frame", row.names = c(NA, 
                                                                                                                -2L))

Initial df

enter image description here

Expected

The first 2 rows(This is a sample but the rows keep changing) should deleted replaced with the "message"


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>