本文整理汇总了C++中SymbolString::get_utf8_cstring方法的典型用法代码示例。如果您正苦于以下问题:C++ SymbolString::get_utf8_cstring方法的具体用法?C++ SymbolString::get_utf8_cstring怎么用?C++ SymbolString::get_utf8_cstring使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SymbolString
的用法示例。
在下文中一共展示了SymbolString::get_utf8_cstring方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mutate_grouped
SEXP mutate_grouped(const DataFrame& df, const QuosureList& dots) {
LOG_VERBOSE << "checking zero rows";
// special 0 rows case
if (df.nrows() == 0) {
DataFrame res = mutate_not_grouped(df, dots);
copy_vars(res, df);
set_class(res, get_class(df));
return Data(res).data();
}
LOG_VERBOSE << "initializing proxy";
typedef GroupedCallProxy<Data, Subsets> Proxy;
Data gdf(df);
int nexpr = dots.size();
check_not_groups(dots, gdf);
Proxy proxy(gdf);
LOG_VERBOSE << "copying data to accumulator";
NamedListAccumulator<Data> accumulator;
int ncolumns = df.size();
CharacterVector column_names = df.names();
for (int i = 0; i < ncolumns; i++) {
accumulator.set(column_names[i], df[i]);
}
LOG_VERBOSE << "processing " << nexpr << " variables";
List variables(nexpr);
for (int i = 0; i < nexpr; i++) {
Rcpp::checkUserInterrupt();
const NamedQuosure& quosure = dots[i];
Environment env = quosure.env();
Shield<SEXP> call_(quosure.expr());
SEXP call = call_;
SymbolString name = quosure.name();
proxy.set_env(env);
LOG_VERBOSE << "processing " << name.get_utf8_cstring();
if (TYPEOF(call) == LANGSXP || TYPEOF(call) == SYMSXP) {
proxy.set_call(call);
boost::scoped_ptr<Gatherer> gather(gatherer<Data, Subsets>(proxy, gdf, name));
SEXP variable = variables[i] = gather->collect();
proxy.input(name, variable);
accumulator.set(name, variable);
} else if (Rf_length(call) == 1) {
boost::scoped_ptr<Gatherer> gather(constant_gatherer(call, gdf.nrows()));
SEXP variable = variables[i] = gather->collect();
proxy.input(name, variable);
accumulator.set(name, variable);
} else if (Rf_isNull(call)) {
accumulator.rm(name);
continue;
} else {
stop("cannot handle");
}
}
return structure_mutate(accumulator, df, get_class(df));
}