Crunch Variables reside on the server, allowing you to work with
datasets that are too big to bring into memory on your machine. Many
functions, such as
crtabs(), translate your commands
into API queries and return only the result. But, not every operation you'll
want to perform has been implemented on the Crunch servers. If you need to do
something beyond what is currently supported, you can bring a variable's
data into R with
as.vector(ds$var) and work with it like any
other R vector.
1 2 3 4 5
for Categorical variables, one of either "factor" (default,
which returns the values as factor); "numeric" (which returns the numeric
values); or "id" (which returns the category ids). If "id", values
corresponding to missing categories will return as the underlying integer
codes; i.e., the R representation will not have any
as.vector transfers data from Crunch to a local R session. Note:
as.vector returns the vector in the row order of the dataset. If filters
are set that specify an order that is different from the row order of the
dataset, the results will ignore that order. If you need the vector ordered
in that way, use syntax like
as.vector(ds$var)[c(10, 5, 2)] instead.
an R vector of the type corresponding to the Variable. E.g. CategoricalVariable yields type factor by default, NumericVariable yields numeric, etc.
as.data.frame for another interface
for (lazily) fetching data from the server as needed;
pulling all of the data from a dataset.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.