R - Dput

Card Puncher Data Processing

About

Write an Object to a file or Recreate it

Snippet

df=data.frame(a=1:2,b=4:5)
df
a b
1 1 4
2 2 5

dput(df)
structure(list(a = 1:2, b = 4:5), .Names = c("a", "b"), row.names = c(NA, 
-2L), class = "data.frame")

dput(df, file="df.R")

You wil get this OS file:

structure(list(a = 1:2, b = 4:5), .Names = c("a", "b"), row.names = c(NA,
-2L), class = "data.frame")

To make an new data frame from the created file use dget

dfFromFile = dget("df.R")
dfFromFile
a b
1 1 4
2 2 5





Discover More
Card Puncher Data Processing
R - (Object|Variable|Symbol)

R provides a number of specialized objects. They are created (instantiated), used and referenced through variable (known as symbol). When you read the term object in the documentation, you can interchange...



Share this page:
Follow us:
Task Runner