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

15 clean r #59

Merged
merged 18 commits into from
Feb 5, 2022
Merged

15 clean r #59

merged 18 commits into from
Feb 5, 2022

Conversation

jmbarbone
Copy link
Collaborator

Resolves #15 (see issue for general changes)

Copy link
Owner

@JanMarvin JanMarvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess the RcppExports somehow barked. Somehow you're removing all the functions. Otherwise fine, thank you!

on.exit(expr = options("OutDec" = od), add = TRUE)

op <- openxlsx_options()
on.exit(options(op), add = TRUE)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: once we have options in a working state (which hopefully will be soon), we should go through a few functions where options are included, but do not seem to provide anything usefull.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a lot of them are probably not needed. The only time it seems to matter is when converting a double to a string. It's probably within the write data so we can just be careful about using using format(), (e.g., format(7 / pi, scientific = FALSE, digits = 16). I'm not entirely convinced that setting the options() is necessary.

}

return(origin)
"1900-01-01"
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, I'm not really happy with this change. makes it harder to spot what is going on and a bit weird that such a long function provides a const character. I mean it looks like it is working, but I preferred the old way

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I'm not even sure if this is used anywhere. Remember that I wrangled with it in writeDataTable iirc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, this does the same thing. It just doesn't bother assigning/making an origin object only to immediately return it.

Could also just simplify the last statement to:

  if (grepl('date1904="1"|date1904="true"', workbook, ignore.case = TRUE)) {
    "1904-01-01"
  } else {
    "1900-01-01"
  }

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I got what it does, it's just that I don't like the style. It's nothing I'd veto against, but I don't think that it is easily understandable that's all. If change is required, I think we should stick with the simplified if else one.

xmlDir <- file.path(tempdir(), "named_regions_tmp")
xmlDir <- tempfile("named_regions_tmp")
# don't unlink on exit
on.exit(unlink(xmlDir, recursive = TRUE), add = TRUE)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jmbarbone
Copy link
Collaborator Author

Guess the RcppExports somehow barked. Somehow you're removing all the functions. Otherwise fine, thank you!

So, apparently there's this R/.gitignore file that only has RccpExports.R, and it's been in there for years... I'm thinking that was added after the file was committed and then become useless (git won't automatically ignore a file that you've already committed). I don't think this is needed and I guess something weird happened at some merge or redoc. Probably okay to remove it.

@JanMarvin
Copy link
Owner

JanMarvin commented Feb 5, 2022

Codecov Report

Merging #59 (7d49726) into main (9260246) will increase coverage by 0.05%.
The diff coverage is 37.99%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #59      +/-   ##
==========================================
+ Coverage   42.65%   42.71%   +0.05%     
==========================================
  Files          40       40              
  Lines        8343     8320      -23     
==========================================
- Hits         3559     3554       -5     
+ Misses       4784     4766      -18     
Impacted Files Coverage Δ
R/conditional_formatting.R 0.00% <0.00%> (ø)
R/names.R 5.88% <0.00%> (+0.32%) ⬆️
R/openXL.R 0.00% <0.00%> (ø)
R/pugixml.R 89.70% <0.00%> (+0.64%) ⬆️
R/readWorkbook.R 66.66% <0.00%> (ø)
R/workbook_column_widths.R 0.00% <0.00%> (ø)
src/load_workbook.cpp 78.88% <ø> (-0.12%) ⬇️
src/openxlsx2_types.h 100.00% <ø> (ø)
R/helperFunctions.R 18.35% <9.52%> (-0.64%) ⬇️
R/class-workbook-wrappers.R 30.73% <24.13%> (-0.11%) ⬇️
... and 15 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9260246...7d49726. Read the comment docs.

@JanMarvin
Copy link
Owner

Most likely it was there, because of the manual way Rcpp functions were integrated in openxlsx (I've fixed that a while ago, but strangely never had issues with RcppExports)

Copy link
Owner

@JanMarvin JanMarvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@JanMarvin JanMarvin merged commit 7db7322 into main Feb 5, 2022
@jmbarbone jmbarbone deleted the 15-clean-r branch May 5, 2022 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

R code clean-up tasks
2 participants