write.so writes a call to produce—and when possible, assign—the specified data frame to the console or a specified connection. The function used to recreate the data frame in the output is determined by the class of the input. Names for assignment are taken from names found in the argument to x. If no name is found, the call is returned without assignment.

write.so(
  x,
  file = stdout(),
  write_clip = getOption("read.so.write_clip", TRUE),
  indent = getOption("read.so.indent", 4),
  tbl_fun = c("tibble")
)

write_so(
  x,
  file = stdout(),
  write_clip = getOption("read.so.write_clip", TRUE),
  indent = getOption("read.so.indent", 4),
  tbl_fun = c("tibble")
)

Arguments

x

A data frame to write.

file

A connection or filename to which to print; passed to cat.

write_clip

Logical. Write result to clipboard?

indent

The number of spaces by which to indent column definitions.

tbl_fun

The character function name to use to create tibbles, i.e. "tibble". Ignored for other cases.

Value

Prints the call to produce the input to the specified connection; returns the call invisibly.

Details

write_so is an alias; data frame class is determined by input class.

Examples

write.so(head(iris), write_clip = FALSE)
#> iris <- data.frame( #> Sepal.Length = c(5.1, 4.9, 4.7, 4.6, 5, 5.4), #> Sepal.Width = c(3.5, 3, 3.2, 3.1, 3.6, 3.9), #> Petal.Length = c(1.4, 1.4, 1.3, 1.5, 1.4, 1.7), #> Petal.Width = c(0.2, 0.2, 0.2, 0.2, 0.2, 0.4), #> Species = structure(c(1L, 1L, 1L, 1L, 1L, 1L), .Label = c("setosa", "versicolor", "virginica"), class = "factor") #> )