-
Notifications
You must be signed in to change notification settings - Fork 78
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
check.names is not working #102
Comments
Yeah. This has been the behaviour of read.xlsx for a few versions now and changing this could upset a lot of people. For now this will stay the way it is. |
Could you at least add a flag to openxlsx that disables the transformation Yeah. This has been the behaviour of read.xlsx for a few versions now and
|
My vote: allow the I was surprised when reading this issue to learn that
2a. In 2b. On a subsequent transitional version, if If you change the default behavior from |
I just fell over this too. It isn't intuitive that column names are converted when |
+1 to have check.names=TRUE be the default, and to not convert spaces in names to dots when check.names==FALSE. |
+1 for this. At least document that the option doesn't do what it says, and provide some way to get at the un-modified names. |
I also ran into this and would appreciate it ifspaces could be preserved in column names. |
I would also like spaces to be preserved. Thanks for the package! |
I would also appreciate it if spaces could be preserved in column names. Currently, I use |
+1 |
@cchng, might I suggest you use the thumbs-up reaction or such on the initial post or most influential comment? Github issues can stretch rather long with individual "+1" comments. In large projects, the maintainers gauge which issues to prioritize based on (among other things) popular support, and it's much easier to look at the "reaction counter" on a single post than manually count all of the "individual positive commenters". Not a rant, just a suggestion. Thanks for piping in! |
The problem is worse than has been described thus far: clean_names() as defined removes leading and trailing runs of spaces as well as converting internal runs of spaces to a single period. So, when reading a file with a column header of clean_names(" a bc ") -> "a.bc" In other words, this behavior changes the user's data, irreversibly (or, at least, without clumsy user-bolted-on solutions). And you do so despite the explicit presence of options such as check.names being FALSE. Opening a workbook and saving it out again should be (IMHO) an identity operation: same data out as in, barring other user caused changes. |
@pooranis, I disagree with your suggestion for @awalker89, it's been (almost) three years since this issue was initially opened, and there has been some discussion about the behavior. Any more thoughts? |
Barring a resolution,
preserves column datatypes. The messiness of that alone should inspire writing improved code. :) Anyone have a betterish solution? My only other solution, thus far, converts all columns to character (due to using colnames = FALSE to be able to grab the proper, unaltered names from the first row). |
@WilDoane taking the solutions from you and @andre Elrico from stacks overflow, now I have a solution to read a multi-sheets xlsx into a list without name checking... Many thanks to you!
|
I believe it is time to fix this... always thx for your open source contributions. |
I completely agree with @sorhawell and @r2evans. |
Just adding this comment as another reminder - the current documentation for the |
To be frank, @aleonti, while relevant to users of the package, there has been no development on this project at all since commit ead0038 (Aug 2018), so it's not just this bug that is stagnant. There have been other discussion (#484) on the orphaned status of this package. If you have sufficient C++ skills, perhaps you would consider forking and taking over maintenance of the package; unfortunately, it's a tall order to do that, and most R users are unlikely to have the C++ skills to do it solidly. *shrug* |
Maintenance of this package has moved; this issue is now at ycphs/openxlsx#33 |
When loading a table from an Excel worksheet using read.xlsx, spaces in column names are still converted to dots (.), even when check.names = FALSE is specified. The reason is most likely due to the fact that column names are modified using the function clean_names at loading. For example, I saw the following line in readWorkbook.R:
m <- .Call("openxlsx_readWorkbook", v, r, string_refs, isDate, nRows, colNames, skipEmptyRows, origin, clean_names, PACKAGE = "openxlsx")
The text was updated successfully, but these errors were encountered: