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

turning a character vector into a single row dataframe in R

$
0
0

I have a vector that I want to turn into a single row dataframe, this code works:

vec <- c("a","b","c","d","e") 
df<- as.data.frame(t(as.data.frame(vec)))

but is so clunky, does anyone have a more elegant (and preferably less computationally expensive) solution


Viewing all articles
Browse latest Browse all 201839

Trending Articles



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