Opened 5 years ago
Last modified 5 months ago
#23980 needs_work enhancement
Add use tips to r interface documentation
Reported by: | charpent | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | sage-9.7 |
Component: | packages: standard | Keywords: | r-project |
Cc: | vdelecroix | Merged in: | |
Authors: | Emmanuel Charpentier | Reviewers: | |
Report Upstream: | N/A | Work issues: | |
Branch: | u/charpent/add_use_tips_to_r_interface_documentation (Commits, GitHub, GitLab) | Commit: | 7f4602ef6dcb2a0b10593edd18c9e74b0d6b11f9 |
Dependencies: | Stopgaps: |
Description (last modified by )
Inspired by this ask.sagemath question.
Add a couple of usage tips to the "r?" help text, with a couple examples.
Change History (15)
comment:1 Changed 5 years ago by
- Branch set to u/charpent/add_use_tips_to_r_interface_documentation
comment:2 Changed 5 years ago by
- Commit set to 1034a2639ab1526fca2f20497f86512d88bb7b00
- Description modified (diff)
- Status changed from new to needs_review
comment:3 Changed 5 years ago by
- Status changed from needs_review to needs_work
You wrongly used Python commnents (starting with #
) inside doctests. The following is allowed
sage: # my comment sage: print(1) 1
the following is better
My comment:: sage: print(1) 1
But the following is wrong
# my comment sage: print(1) 1
comment:4 follow-up: ↓ 5 Changed 5 years ago by
- Commit changed from 1034a2639ab1526fca2f20497f86512d88bb7b00 to e22ab4662c146436813d2b5edb7daf77fe49a026
Branch pushed to git repo; I updated commit sha1. New commits:
e22ab46 | 23980 : better presentation of the tips' examples.
|
comment:5 in reply to: ↑ 4 Changed 5 years ago by
- Status changed from needs_work to needs_review
Replying to git:
Branch pushed to git repo; I updated commit sha1. New commits:
e22ab46 23980 : better presentation of the tips' examples.
Thanks for your remarks, Vincent ! Sphinx is a bitch for me..
The pushed version looks good on a terminal and in html, passes ptestlong
with one failure :
---------------------------------------------------------------------- sage -t --long src/sage/coding/linear_code.py # Timed out ----------------------------------------------------------------------
which turns out to be transient (the doctest passes with no error when ran standalone).
==>needs_review
.
comment:6 follow-up: ↓ 7 Changed 5 years ago by
- Commit changed from e22ab4662c146436813d2b5edb7daf77fe49a026 to 7f4602ef6dcb2a0b10593edd18c9e74b0d6b11f9
Branch pushed to git repo; I updated commit sha1. New commits:
7f4602e | 23980 : minor typo
|
comment:7 in reply to: ↑ 6 Changed 5 years ago by
comment:8 Changed 2 years ago by
Your second line in the example fails for me
sage: tt = r.t_test(r.as_formula("y~x"), data=d) /opt/sage/local/lib/python3.7/site-packages/rpy2/rinterface/__init__.py:185: RRuntimeWarning: Error in strsplit(x, "\n[ \t\n]*\n", perl = TRUE) : motif de découpage ' [ ]* ' incorrect warnings.warn(x, RRuntimeWarning) /opt/sage/local/lib/python3.7/site-packages/rpy2/rinterface/__init__.py:185: RRuntimeWarning: De plus : warnings.warn(x, RRuntimeWarning) /opt/sage/local/lib/python3.7/site-packages/rpy2/rinterface/__init__.py:185: RRuntimeWarning: Warning message: warnings.warn(x, RRuntimeWarning) /opt/sage/local/lib/python3.7/site-packages/rpy2/rinterface/__init__.py:185: RRuntimeWarning: In strsplit(x, "\n[ \t\n]*\n", perl = TRUE) : warnings.warn(x, RRuntimeWarning) /opt/sage/local/lib/python3.7/site-packages/rpy2/rinterface/__init__.py:185: RRuntimeWarning: warnings.warn(x, RRuntimeWarning) /opt/sage/local/lib/python3.7/site-packages/rpy2/rinterface/__init__.py:185: RRuntimeWarning: Erreur de compilation du motif PCRE 'this version of PCRE is compiled without UTF support' at ' [ ]* ' warnings.warn(x, RRuntimeWarning) --------------------------------------------------------------------------- RRuntimeError Traceback (most recent call last) <ipython-input-21-2d3c0885b12f> in <module>() ----> 1 tt = r.t_test(r.as_formula("y~x"), data=d) /opt/sage/local/lib/python3.7/site-packages/sage/interfaces/r.py in __call__(self, *args, **kwds) 2003 [1] 3 2004 """ -> 2005 return self._parent.function_call(self._name, args=list(args), kwds=kwds) 2006 2007 def is_RElement(x): /opt/sage/local/lib/python3.7/site-packages/sage/interfaces/r.py in function_call(self, function, args, kwds) 1080 self._check_valid_function_name(function) 1081 return self.new("%s(%s)"%(function, ",".join([s.name() for s in args] + -> 1082 [self._sage_to_r_name(key)+'='+kwds[key].name() for key in kwds ] ))) 1083 1084 def call(self, function_name, *args, **kwds): /opt/sage/local/lib/python3.7/site-packages/sage/interfaces/interface.py in new(self, code) 368 369 def new(self, code): --> 370 return self(code) 371 372 ################################################################### /opt/sage/local/lib/python3.7/site-packages/sage/interfaces/interface.py in __call__(self, x, name) 294 295 if isinstance(x, string_types): --> 296 return cls(self, x, name=name) 297 try: 298 # Special methods do not and should not have an option to /opt/sage/local/lib/python3.7/site-packages/sage/interfaces/interface.py in __init__(self, parent, value, is_name, name) 716 else: 717 try: --> 718 self._name = parent._create(value, name=name) 719 except (TypeError, RuntimeError, ValueError) as x: 720 raise TypeError(x) /opt/sage/local/lib/python3.7/site-packages/sage/interfaces/interface.py in _create(self, value, name) 499 def _create(self, value, name=None): 500 name = self._next_var_name() if name is None else name --> 501 self.set(name, value) 502 return name 503 /opt/sage/local/lib/python3.7/site-packages/sage/interfaces/r.py in set(self, var, value) 1126 """ 1127 cmd = '%s <- %s'%(var,value) -> 1128 out = self.eval(cmd) 1129 1130 def get(self, var): /opt/sage/local/lib/python3.7/site-packages/sage/interfaces/r.py in eval(self, code, *args, **kwds) 1339 """ 1340 self._lazy_init() -> 1341 return str(robjects.r(code)).rstrip() 1342 1343 /opt/sage/local/lib/python3.7/site-packages/rpy2/robjects/robject.py in __str__(self) 106 s.append(x) 107 rpy2.rinterface.set_writeconsole_regular(f) --> 108 self.__show(self) 109 if sys.platform == 'win32': 110 self.__sink() RRuntimeError: Error in strsplit(x, "\n[ \t\n]*\n", perl = TRUE) : motif de découpage '
comment:9 Changed 2 years ago by
- Status changed from needs_review to needs_work
comment:10 Changed 2 years ago by
- Milestone changed from sage-8.1 to sage-9.2
comment:11 Changed 2 years ago by
- Milestone changed from sage-9.2 to sage-9.3
comment:12 Changed 18 months ago by
- Milestone changed from sage-9.3 to sage-9.4
Setting new milestone based on a cursory review of ticket status, priority, and last modification date.
comment:13 Changed 13 months ago by
- Milestone changed from sage-9.4 to sage-9.5
Setting a new milestone for this ticket based on a cursory review.
comment:14 Changed 8 months ago by
- Milestone changed from sage-9.5 to sage-9.6
comment:15 Changed 5 months ago by
- Milestone changed from sage-9.6 to sage-9.7
Added a few usage tips and a few (commented) examples to the help text displayed by r.<tab>
Passes
ptestlong
with no error (transient or not).==>
needs_review
New commits:
Add a few usage tips and examples to r.<tab> help text.