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

Unicode multiplication sign ==> x #192

Closed
wants to merge 4 commits into from
Closed

Unicode multiplication sign ==> x #192

wants to merge 4 commits into from

Conversation

@ncarchedi
Copy link
Contributor

@ncarchedi ncarchedi commented Nov 16, 2016

Is it possible to replace U+00D7 with x (lowercase letter x) in the standard tibble output? We use tbls in many of our courses on DataCamp, but unfortunately the unicode doesn't render properly so the output looks like this :(

screenshot 2016-11-15 19 16 08

@krlmlr
Copy link
Member

@krlmlr krlmlr commented Nov 16, 2016

Can we substitute only if enc2native("\u00d7") != "\u00d7", so that the Unicode multiplication sign is still used when it is (likely to be) rendered correctly?

@ncarchedi
Copy link
Contributor Author

@ncarchedi ncarchedi commented Nov 16, 2016

@krlmlr Great, just updated the PR per your request. Thanks for the quick response.

@codecov-io
Copy link

@codecov-io codecov-io commented Nov 16, 2016

Current coverage is 99.46% (diff: 88.88%)

Merging #192 into master will decrease coverage by 0.12%

@@             master       #192   diff @@
==========================================
  Files            16         16          
  Lines           738        748    +10   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits            735        744     +9   
- Misses            3          4     +1   
  Partials          0          0          

Powered by Codecov. Last update 82fb736...113f92f

paste0(format_dim, collapse = " \u00d7 ")
mult <- " \u00d7 " # unicode multiplication sign
if(enc2native(mult) != mult) mult <- " x " # lowercase x
paste0(format_dim, collapse = mult)
Copy link
Member

@krlmlr krlmlr Nov 17, 2016

Can you please refactor mult in a function?

@ncarchedi
Copy link
Contributor Author

@ncarchedi ncarchedi commented Nov 18, 2016

@krlmlr Right, makes sense. Just added mult_sign() to R/utils-format.r. Let me know if you'd prefer having it elsewhere. Tested locally and on DataCamp and seems to do the trick.

# unicode multiplication sign
mult <- "\u00d7"
# if unicode doesn't render, use lowercase x
if(enc2native(mult) != mult) mult <- "x"
Copy link
Member

@krlmlr krlmlr Nov 18, 2016

Thanks. Could you please match the code style to the surrounding code (space after if, braces)?

@ncarchedi
Copy link
Contributor Author

@ncarchedi ncarchedi commented Nov 22, 2016

@krlmlr No problem, should be better now!

@krlmlr
Copy link
Member

@krlmlr krlmlr commented Nov 22, 2016

It seems likely that this might break tests on Windows, but AppVeyor is currently disabled for this repository. I'll take it from here, thanks!

krlmlr
krlmlr approved these changes Nov 22, 2016
@hadley
Copy link
Member

@hadley hadley commented Jan 3, 2017

Can we get this merged and a minor release out?

@krlmlr
Copy link
Member

@krlmlr krlmlr commented Jan 3, 2017

I can do it by the end of this week, if no substantial revdep check failures occur.

@krlmlr krlmlr added this to the 1.3.0 milestone Jan 4, 2017
@krlmlr krlmlr added this to the 1.3.0 milestone Jan 4, 2017
@krlmlr krlmlr closed this in 919f649 Jan 4, 2017
@krlmlr
Copy link
Member

@krlmlr krlmlr commented Jan 4, 2017

Thanks!

krlmlr added a commit that referenced this issue Jan 4, 2017
- `glimpse()` now uses `type_sum()` also for S3 objects (#185, #186, @holstius).
- Reword documentation for `tribble()` (#191, @kwstat).
- Unicode multiplication sign is rendered as `x` if it cannot be represented in the current locale (#192, @ncarchedi).
krlmlr added a commit that referenced this issue Apr 1, 2017
Bug fixes
=========

- Time series matrices (objects of class `mts` and `ts`) are now supported in `as_tibble()` (#184).
- The `all_equal()` function (called by `all.equal.tbl_df()`) now forwards to `dplyr` and fails with a helpful message if not installed. Data frames with list columns cannot be compared anymore, and differences in the declared class (`data.frame` vs. `tbl_df`) are ignored. The `all.equal.tbl_df()` method gives a warning and forwards to `NextMethod()` if `dplyr` is not installed; call `all.equal(as.data.frame(...), ...)` to avoid the warning. This ensures consistent behavior of this function, regardless if `dplyr` is loaded or not (#198).

Interface changes
=================

- Now requiring R 3.1.0 instead of R 3.1.3 (#189).
- Add `as.tibble()` as an alias to `as_tibble()` (#160, @LaDilettante).
- New `frame_matrix()`, similar to `frame_data()` but for matrices (#140, #168, @LaDilettante).
- New `deframe()` as reverse operation to `enframe()` (#146, #214).
- Removed unused dependency on `assertthat`.

Features
========

General
-------

- Keep column classes when adding row to empty tibble (#171, #177, @LaDilettante).
- Singular and plural variants for error messages that mention a list of objects (#116, #138, @LaDilettante).
- `add_column()` can add columns of length 1 (#162, #164, @LaDilettante).

Input validation
----------------

- An attempt to read or update a missing column now throws a clearer warning (#199).
- An attempt to call `add_row()` for a grouped data frame results in a helpful error message (#179).

Printing
--------

- Render Unicode multiplication sign as `x` if it cannot be represented in the current locale (#192, @ncarchedi).
- Backtick `NA` names in printing (#206, #207, @jennybc).
- `glimpse()` now uses `type_sum()` also for S3 objects (#185, #186, @holstius).
- The `max.print` option is ignored when printing a tibble (#194, #195, @t-kalinowski).

Documentation
=============

- Fix typo in `obj_sum` documentation (#193, @etiennebr).
- Reword documentation for `tribble()` (#191, @kwstat).
- Now explicitly stating minimum Rcpp version 0.12.3.

Internal
========

- Using registration of native routines.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants