datastream_file | R Documentation |
Reference object of class datastream_file
.
This is a class which inherits from class datastream
and which can be used to read in a stream
from a file. A number of file readers have been implemented, namely
datastream_table
, datastream_csv
, datastream_csv2
,
datastream_delim
, datastream_delim2
.
See the examples.
description |
The name how the stream is labelled |
FUN |
The function to use to read in the file.
Defaults to |
columnnames |
optional character vector of column to overwrite the column names of the data read in with in |
file |
The file to read in. See e.g. |
... |
parameters passed on to |
A class of type datastream_file
which contains
The function to use to read in the file
A connection to the file
A character vector of column names to overwrite the column names with in get_points
See datastream
get_points(n)
Get data from a datastream object.
integer, indicating the number of instances to retrieve from the datastream
read.table
, read.csv
, read.csv2
, read.delim
, read.delim2
mydata <- iris mydata$Species[2:3] <- NA ## Example of a CSV file stream myfile <- tempfile() write.csv(iris, file = myfile, row.names=FALSE, na = "") x <- datastream_csv(file = myfile, na.strings = "") x x$get_points(n=10) x x$get_points(n=10) x x$stop() ## Create your own specific file stream write.table(iris, file = myfile, row.names=FALSE, na = "") x <- datastream_file(description="My file defintion stream", FUN=read.table, file = myfile, header=TRUE, na.strings="") x$get_points(n=10) x x$stop() ## Clean up for CRAN file.remove(myfile)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.