Skip to contents

The head command returns the first n lines of the object as a string. This can be useful when inspecting the content of a large file (without first having to download and store it on disk locally).

Usage

mc_head(target, n = 10, flags = "")

Arguments

target

character string specifying the target directory path.

n

integer number of lines to read from the beginning, by default 10

flags

additional flags to be passed to the cat command. Default is an empty string.

Value

a character string with the contents of the file

Examples

if (FALSE) { # interactive()
# upload a CSV file
install_mc()
tf <- tempfile()
write.csv(iris, tf, row.names = FALSE)
mc_mb("play/iris")
mc_cp(tf, "play/iris/iris.csv")

# read first 13 lines from the CSV (header + 12 rows of data)
read.csv(text = mc_head("play/iris/iris.csv", n = 13))
}