Skip to content
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
15 changes: 15 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
2022-10-06 Dirk Eddelbuettel <edd@debian.org>

* DESCRIPTION (Version, Date): Roll minor version
* inst/include/Rcpp/config.h (RCPP_DEV_VERSION): Idem

* inst/tinytest/test_dataframe.R (test.DataFrame.PushZeroLength): Add
new test
* inst/tinytest/cpp/DataFrame.cpp (DataFrame_PushOnEmpty): C++
support for new test

2022-10-04 Dirk Eddelbuettel <edd@debian.org>

* inst/include/Rcpp/DataFrame.h (set_type_after_push): Allow zero-row
data.frame objects to be grown by push_{back,front}()

2022-09-25 Dirk Eddelbuettel <edd@debian.org>

* DESCRIPTION (Version, Date): Roll minor version
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: Rcpp
Title: Seamless R and C++ Integration
Version: 1.0.9.3
Date: 2022-09-25
Version: 1.0.9.4
Date: 2022-10-06
Author: Dirk Eddelbuettel, Romain Francois, JJ Allaire, Kevin Ushey, Qiang Kou,
Nathan Russell, Inaki Ucar, Douglas Bates and John Chambers
Maintainer: Dirk Eddelbuettel <edd@debian.org>
Expand Down
10 changes: 6 additions & 4 deletions inst/include/Rcpp/DataFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,12 @@ namespace Rcpp{
max_rows = Rf_xlength(*it);
}
}
for (it = Parent::begin(); it != Parent::end(); ++it) {
if (Rf_xlength(*it) == 0 || ( Rf_xlength(*it) > 1 && max_rows % Rf_xlength(*it) != 0 )) {
// We have a column that is not an integer fraction of the largest
invalid_column_size = true;
if (max_rows > 0) {
for (it = Parent::begin(); it != Parent::end(); ++it) {
if (Rf_xlength(*it) == 0 || ( Rf_xlength(*it) > 1 && max_rows % Rf_xlength(*it) != 0 )) {
// We have a column that is not an integer fraction of the largest
invalid_column_size = true;
}
}
}
if (invalid_column_size) {
Expand Down
4 changes: 2 additions & 2 deletions inst/include/Rcpp/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define RCPP_VERSION_STRING "1.0.9"

// the current source snapshot (using four components, if a fifth is used in DESCRIPTION we ignore it)
#define RCPP_DEV_VERSION RcppDevVersion(1,0,9,3)
#define RCPP_DEV_VERSION_STRING "1.0.9.3"
#define RCPP_DEV_VERSION RcppDevVersion(1,0,9,4)
#define RCPP_DEV_VERSION_STRING "1.0.9.4"

#endif
14 changes: 14 additions & 0 deletions inst/tinytest/cpp/DataFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,17 @@ DataFrame DataFrame_PushZeroLength(){
df1.push_back(v);
return df1;
}

// issue #1232
// [[Rcpp::export]]
Rcpp::DataFrame DataFrame_PushOnEmpty() {
int n = 0;
Rcpp::IntegerVector foo(n);
Rcpp::CharacterVector bar(n);
Rcpp::CharacterVector baz(n);

Rcpp::List ll = Rcpp::List::create(Rcpp::Named("foo") = foo,
Rcpp::Named("bar") = bar);
ll.push_back(baz, "baz");
return Rcpp::DataFrame(ll);
}
4 changes: 4 additions & 0 deletions inst/tinytest/test_dataframe.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,7 @@ expect_equal( DataFrame_PushReplicateLength(), df )

# test.DataFrame.PushZeroLength <- function(){
expect_warning( DataFrame_PushZeroLength())

## issue #1232: push on empty data.frame
df <- DataFrame_PushOnEmpty()
expect_equal(ncol(df), 3L)