Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[write] cleanup #902

Merged
merged 3 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

## Breaking changes

* Updating to themse. This includes updates to the default style `'Office Theme'`:
* Updating to themes. This includes updates to the default style `'Office Theme'`:
* This includes switching to the new default font `'Aptos Narrow'`
* A new style `'Office 2013 - 2022 Theme'` was added

Expand Down
1 change: 1 addition & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ARGB
Aptos
Arial
ArrowsGray
CHARSET
Expand Down
4 changes: 2 additions & 2 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ BEGIN_RCPP
END_RCPP
}
// dims_to_df
SEXP dims_to_df(Rcpp::IntegerVector rows, std::vector<std::string> cols, bool fill);
SEXP dims_to_df(Rcpp::IntegerVector rows, Rcpp::CharacterVector cols, bool fill);
RcppExport SEXP _openxlsx2_dims_to_df(SEXP rowsSEXP, SEXP colsSEXP, SEXP fillSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< Rcpp::IntegerVector >::type rows(rowsSEXP);
Rcpp::traits::input_parameter< std::vector<std::string> >::type cols(colsSEXP);
Rcpp::traits::input_parameter< Rcpp::CharacterVector >::type cols(colsSEXP);
Rcpp::traits::input_parameter< bool >::type fill(fillSEXP);
rcpp_result_gen = Rcpp::wrap(dims_to_df(rows, cols, fill));
return rcpp_result_gen;
Expand Down
17 changes: 11 additions & 6 deletions src/helper_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ uint32_t uint_col_to_int(std::string& a) {
}

// [[Rcpp::export]]
Rcpp::IntegerVector col_to_int(Rcpp::CharacterVector x ) {
Rcpp::IntegerVector col_to_int(Rcpp::CharacterVector x) {

// This function converts the Excel column letter to an integer

Expand Down Expand Up @@ -239,7 +239,7 @@ SEXP copy(SEXP x) {

// provide a basic rbindlist for lists of named characters
// [[Rcpp::export]]
SEXP dims_to_df(Rcpp::IntegerVector rows, std::vector<std::string> cols, bool fill) {
SEXP dims_to_df(Rcpp::IntegerVector rows, Rcpp::CharacterVector cols, bool fill) {

size_t kk = cols.size();
size_t nn = rows.size();
Expand All @@ -257,8 +257,9 @@ SEXP dims_to_df(Rcpp::IntegerVector rows, std::vector<std::string> cols, bool fi
if (fill) {
for (size_t i = 0; i < kk; ++i) {
Rcpp::CharacterVector cvec = Rcpp::as<Rcpp::CharacterVector>(df[i]);
std::string coli = Rcpp::as<std::string>(cols[i]);
for (size_t j = 0; j < nn; ++j) {
cvec[j] = cols[i] + std::to_string(rows[j]);
cvec[j] = coli + std::to_string(rows[j]);
}
}
}
Expand Down Expand Up @@ -361,6 +362,11 @@ void wide_to_long(
Rcpp::CharacterVector zz_typ = Rcpp::as<Rcpp::CharacterVector>(zz["typ"]);
Rcpp::CharacterVector zz_r = Rcpp::as<Rcpp::CharacterVector>(zz["r"]);

if (inline_strings)
na_strings = txt_to_is(na_strings, 0, 1, 1);
else
na_strings = txt_to_si(na_strings, 0, 1, 1);

for (auto i = 0; i < m; ++i) {
Rcpp::checkUserInterrupt();

Expand Down Expand Up @@ -465,17 +471,16 @@ void wide_to_long(
// inlineStr or s
if (inline_strings) {
cell.c_t = "inlineStr";
cell.is = txt_to_is(na_strings, 0, 1, 1);
cell.is = na_strings;
} else {
cell.c_t = "s";
cell.v = txt_to_si(na_strings, 0, 1, 1);
cell.v = na_strings;
}

}
}
}


if (cell.v.compare("NaN") == 0) {
cell.v = "#VALUE!";
cell.c_t = "e";
Expand Down