Often a SO question includes a table like so:
"v1" "v2" "v3"
"A" "a" 1
"B" "b" 2
"C" "c" 3
# or like so
v1 v2 v3
A a 1
B b 2
C c 3
Rather than a dataframe like so:
df <- data.frame(v1 = c("A", "B", "C"),
v2 = c("a", "b", "c"),
v3 = 1:3)
Is there a way to copy and paste the table version of the data from the question and use to work on in one's own console without manually converting the table into a dataframe?
We can use soread
from overflow
after copying the lines
library(overflow)
soread()
#data.frame “mydf” created in your workspace
# v1 v2 v3
#1 A a 1
#2 B b 2
#3 C c 3
str(mydf)
#'data.frame': 3 obs. of 3 variables:
# $ v1: chr "A" "B" "C"
# $ v2: chr "a" "b" "c"
# $ v3: int 1 2 3
The package can be installed from github
source("http://jtilly.io/install_github/install_github.R")
install_github("mrdwab/overflow-mrdwab")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With