Import Debian changes 2.2.3-1
gtools (2.2.3-1) unstable; urgency=low
* New upstream release
* debian/rules: No longer call R to update html index
Dirk Eddelbuettel
5 years ago
0 | 2005-12-21 01:08 warnes | |
1 | ||
2 | * src/: Makevars.win, setTCPNoDelay.c: Should now work on Windows | |
3 | ||
4 | 2005-12-20 15:25 warnes | |
5 | ||
6 | * src/setTCPNoDelay.c: Temporary fix to allow setTCPNoDelay.c to | |
7 | compile on Windows. If compiled on windows calling setTCPNoDelay | |
8 | will just raise an error. | |
9 | ||
10 | 2005-12-14 10:48 warnes | |
11 | ||
12 | * src/setTCPNoDelay.c: Change C++ comment to standard comment | |
13 | ||
14 | 2005-12-13 11:19 nj7w | |
15 | ||
16 | * ChangeLog: [no log message] | |
17 | ||
18 | 2005-12-13 11:18 nj7w | |
19 | ||
20 | * NEWS: Updated NEWS and removed ChangeLog | |
21 | ||
22 | 2005-12-12 17:10 tag RELEASE_2_2_2 | |
23 | ||
24 | 2005-12-12 17:10 nj7w | |
25 | ||
26 | * DESCRIPTION: Updated version for CRAN release | |
27 | ||
28 | 2005-12-08 15:21 tag RELEASE_2_2_1 | |
29 | ||
30 | 2005-12-08 15:21 warnes | |
31 | ||
32 | * src/setTCPNoDelay.c: Add C source code for setTCPNoDelay. | |
33 | ||
34 | 2005-12-01 11:50 nj7w | |
35 | ||
36 | * man/: combinations.Rd, foldchange.Rd, invalid.Rd, logit.Rd, | |
37 | mixedsort.Rd, oddeven.Rd, quantcut.Rd, running.Rd: Updated Greg's | |
38 | email address | |
39 | ||
40 | 2005-11-29 17:30 warnes | |
41 | ||
42 | * NAMESPACE: Add UseDynLib to NAMESPACE so the shared library gets | |
43 | properly loaded. | |
44 | ||
45 | 2005-11-29 17:25 warnes | |
46 | ||
47 | * R/setTCPNoDelay.R: - Remove debugging comments - Change return | |
48 | value on success to "Success". | |
49 | ||
50 | 2005-11-22 17:54 warnes | |
51 | ||
52 | * NAMESPACE: NAMESPACE | |
53 | ||
54 | 2005-11-22 17:54 warnes | |
55 | ||
56 | * NEWS: Update news for 2.2.1 release. | |
57 | ||
58 | 2005-11-22 17:51 warnes | |
59 | ||
60 | * man/: addLast.Rd, setTCPNoDelay.Rd: Fixes for R CMD check | |
61 | ||
62 | 2005-11-22 17:31 warnes | |
63 | ||
64 | * DESCRIPTION, NAMESPACE, R/setTCPNoDelay.R, man/setTCPNoDelay.Rd: | |
65 | Add setTCPNoDelay() function and documentation | |
66 | ||
67 | 2005-11-22 10:46 warnes | |
68 | ||
69 | * R/addLast.R, man/addLast.Rd: New function 'addLast' that adds | |
70 | functions to R's .Last() so that they will be executed when R is | |
71 | terminating. | |
72 | ||
73 | 2005-09-22 14:12 warnes | |
74 | ||
75 | * DESCRIPTION, NAMESPACE, man/defmacro.Rd: More changes for | |
76 | strmacro(), also changes for 2.1.1 release | |
77 | ||
78 | 2005-09-22 13:26 warnes | |
79 | ||
80 | * R/defmacro.R, R/strmacro.R, man/defmacro.Rd: Add strmaco() which | |
81 | defines functions that use strings for macro definition | |
82 | ||
83 | 2005-09-21 14:51 warnes | |
84 | ||
85 | * DESCRIPTION, R/defmacro.R, man/defmacro.Rd: Add support for | |
86 | DOTS/... arguments to defmacro | |
87 | ||
88 | 2005-09-12 11:44 nj7w | |
89 | ||
90 | * man/: assert.Rd, dirichlet.Rd, permute.Rd, scat.Rd: Updated | |
91 | Greg's email | |
92 | ||
93 | 2005-09-02 18:53 tag RELEASE_2_1_0 | |
94 | ||
95 | 2005-09-02 18:53 nj7w | |
96 | ||
97 | * NAMESPACE: Exported assert | |
98 | ||
99 | 2005-09-02 18:53 nj7w | |
100 | ||
101 | * DESCRIPTION: Updated the version number | |
102 | ||
103 | 2005-09-02 18:52 nj7w | |
104 | ||
105 | * NEWS: Added NEWS | |
106 | ||
107 | 2005-09-02 18:52 nj7w | |
108 | ||
109 | * ChangeLog: Added ChangeLog | |
110 | ||
111 | 2005-09-02 18:51 nj7w | |
112 | ||
113 | * man/assert.Rd: Fixed syntax errors | |
114 | ||
115 | 2005-09-02 12:43 warnes | |
116 | ||
117 | * R/assert.R, man/assert.Rd: Add assert() and documentation | |
118 | ||
119 | 2005-09-02 12:28 warnes | |
120 | ||
121 | * man/defmacro.Rd: Fix problem in defmacro.Rd file: don't use | |
122 | \code{} in the example section. | |
123 | ||
124 | 2005-08-31 16:00 tag RELEASE_2_0_9 | |
125 | ||
126 | 2005-08-31 16:00 warnes | |
127 | ||
128 | * DESCRIPTION, NAMESPACE, R/defmacro.R, man/defmacro.Rd: Adding the | |
129 | defmacro() function, extracted from | |
130 | ||
131 | Lumley T. "Programmer's Niche: Macros in {R}", R News, 2001, | |
132 | Vol 1, | |
133 | No. 3, pp 11--13, \url{http://CRAN.R-project.org/doc/Rnews/} | |
134 | ||
135 | 2005-08-31 12:18 warnes | |
136 | ||
137 | * DESCRIPTION, DESCRIPTION.in: Add stand-alone DESCRIPTION file and | |
138 | remove old DESCRIPTION.in file. | |
139 | ||
140 | 2005-06-13 13:08 nj7w | |
141 | ||
142 | * R/mixedsort.R: Fixed a bug in mixedsort - check if "which.na" and | |
143 | "which.blank" is numeric(0) before subsetting the datasets. | |
144 | ||
145 | 2005-06-09 10:20 nj7w | |
146 | ||
147 | * R/RSCompat.S, R/combinations.R, R/dirichlet.R, R/foldchange.R, | |
148 | R/invalid.R, R/logit.R, R/mixedsort.R, R/oddeven.R, R/permute.R, | |
149 | R/quantcut.R, R/running.R, R/scat.R, man/ELISA.Rd, | |
150 | man/combinations.Rd, man/dirichlet.Rd, man/foldchange.Rd, | |
151 | man/invalid.Rd, man/logit.Rd, man/mixedsort.Rd, man/oddeven.Rd, | |
152 | man/permute.Rd, man/quantcut.Rd, man/running.Rd, man/scat.Rd: | |
153 | Updating the version number, and various help files to | |
154 | synchronize splitting of gregmisc bundle in 4 individual | |
155 | components. | |
156 | ||
157 | 2005-05-10 18:05 warnes | |
158 | ||
159 | * R/mixedsort.R: Fix handling of NA's in mixedorder. We were using | |
160 | a high UTF character to try to put NA's at the end of the sort | |
161 | order, but R 2.1.0 checks if characters are in the correct range. | |
162 | Instead, we explicitly force NA's to the end. | |
163 | ||
164 | 2005-04-06 20:28 warnes | |
165 | ||
166 | * NAMESPACE, R/scat.R, man/scat.Rd: - Add scat() function which | |
167 | writes its arguments to stderr and flushes so that output is | |
168 | immediately displayed, but only if 'getOption("DEBUG")' is | |
169 | true. | |
170 | ||
171 | 2005-04-01 23:19 tag release_2_0_5 | |
172 | ||
173 | 2005-04-01 23:19 tag release_2_0_6 | |
174 | ||
175 | 2005-04-01 23:19 warnes | |
176 | ||
177 | * NAMESPACE, R/drop.levels.R, man/drop.levels.Rd: Move | |
178 | drop.levels() from gtools to gdata. | |
179 | ||
180 | 2005-04-01 23:17 warnes | |
181 | ||
182 | * R/mixedsort.R: Minor reordering of functions in file | |
183 | ||
184 | 2005-04-01 23:14 warnes | |
185 | ||
186 | * R/frameApply.R, NAMESPACE, man/frameApply.Rd: Move frameApply() | |
187 | to gdata package. | |
188 | ||
189 | 2005-04-01 22:28 warnes | |
190 | ||
191 | * R/mixedsort.R: Fix error if only one value passed to mixedorder. | |
192 | ||
193 | 2005-04-01 21:37 warnes | |
194 | ||
195 | * man/quantcut.Rd, R/quantcut.R: Add proper handling where more | |
196 | than one quantile obtains the same value | |
197 | ||
198 | 2005-04-01 18:00 warnes | |
199 | ||
200 | * man/: ELISA.Rd, combinations.Rd, dirichlet.Rd, drop.levels.Rd, | |
201 | foldchange.Rd, invalid.Rd, logit.Rd, mixedsort.Rd, oddeven.Rd, | |
202 | permute.Rd, quantcut.Rd, running.Rd: Add CVS ID tag to file | |
203 | headers. | |
204 | ||
205 | 2005-04-01 18:00 warnes | |
206 | ||
207 | * R/frameApply.R, man/frameApply.Rd: Fixes from Jim Rogers for R | |
208 | CMD check problems in frameApply | |
209 | ||
210 | 2005-03-31 14:02 warnes | |
211 | ||
212 | * R/drop.levels.R, R/frameApply.R, man/drop.levels.Rd, | |
213 | man/frameApply.Rd: Updates to drop.levels() and frameApply() from | |
214 | Jim Rogers | |
215 | ||
216 | 2005-03-31 14:01 warnes | |
217 | ||
218 | * man/ELISA.Rd, data/ELISA.rda: Add ELISA data set used by | |
219 | frameApply and drop.levels examples | |
220 | ||
221 | 2005-02-25 18:02 warnes | |
222 | ||
223 | * man/frameApply.Rd: Replace 'T' with TRUE. | |
224 | ||
225 | 2005-02-25 17:54 warnes | |
226 | ||
227 | * man/frameApply.Rd: Remove dependency on ELISA data set for the | |
228 | example. | |
229 | ||
230 | 2005-02-25 16:00 warnes | |
231 | ||
232 | * NAMESPACE: Add drop.levels, frameApply to namespace export. | |
233 | ||
234 | 2005-02-14 19:40 warnes | |
235 | ||
236 | * R/drop.levels.R, R/frameApply.R, man/drop.levels.Rd, | |
237 | man/frameApply.Rd: Add frameApply and drop.levels contributed by | |
238 | Jim Rogers. | |
239 | ||
240 | 2005-01-12 15:50 warnes | |
241 | ||
242 | * DESCRIPTION.in: Add dependency on R 1.9.0+ to prevent poeple from | |
243 | installing on old versions of R which don't support namespaces. | |
244 | ||
245 | 2004-09-27 17:01 tag rel_2_0_0 | |
246 | ||
247 | 2004-09-27 17:01 warneg | |
248 | ||
249 | * DESCRIPTION, DESCRIPTION.in, man/running.Rd: Updated to pass R | |
250 | CMD check. | |
251 | ||
252 | 2004-09-03 13:27 warneg | |
253 | ||
254 | * DESCRIPTION, NAMESPACE, R/dirichlet.R, R/foldchange.R, | |
255 | R/invalid.R, R/mixedsort.R, R/oddeven.R, R/permute.R, | |
256 | R/quantcut.R, R/running.R, man/running.Rd: initial bundle checkin | |
257 | ||
258 | 2004-09-02 13:14 tag initial | |
259 | ||
260 | 2004-09-02 13:14 warneg | |
261 | ||
262 | * DESCRIPTION, DESCRIPTION.in, NAMESPACE: Initial revision | |
263 | ||
264 | 2004-09-02 13:14 warneg | |
265 | ||
266 | * DESCRIPTION, DESCRIPTION.in, NAMESPACE: [no log message] | |
267 | ||
268 | 2004-08-27 17:57 warnes | |
269 | ||
270 | * R/mixedsort.R, man/mixedsort.Rd: Fixed bug in mixedsort, and | |
271 | modified reorder.factor to use mixedsort. | |
272 | ||
273 | 2004-08-26 16:08 warnes | |
274 | ||
275 | * R/mixedsort.R: - Fix bug pointed out by Jim Rogers. - Use a more | |
276 | distictive internal separator: $@$ instead of just $ - | |
277 | Capitalization is now irrelevent for search order (unlike ASCII). | |
278 | ||
279 | 2004-06-08 11:49 warnes | |
280 | ||
281 | * R/running.R, man/running.Rd: Nitin Jain added by= parameter to | |
282 | allow specifying separation between groups. | |
283 | ||
284 | 2004-05-26 09:40 tag rel_1_11_0 | |
285 | ||
286 | 2004-05-26 09:40 tag rel_1_11_1 | |
287 | ||
288 | 2004-05-26 09:40 tag rel_1_11_2 | |
289 | ||
290 | 2004-05-26 09:40 warnes | |
291 | ||
292 | * man/combinations.Rd: Escape underscores in email addresses so | |
293 | Latex is happy. | |
294 | ||
295 | 2004-05-26 09:18 warnes | |
296 | ||
297 | * R/combinations.R: Replace 'T' with 'TRUE' to pass R CMD check. | |
298 | ||
299 | 2004-05-25 13:11 warnes | |
300 | ||
301 | * R/combinations.R: Remove extraneous comments. | |
302 | ||
303 | 2004-05-25 13:08 warnes | |
304 | ||
305 | * R/combinations.R: Fix an error in the code when using | |
306 | repeats.allow=T and r>2. Bug report and fix both due to | |
307 | Elizabeth Purdom <epurdom@stanford.edu>. | |
308 | ||
309 | 2004-05-24 13:36 warnes | |
310 | ||
311 | * R/invalid.R: Check if argument is a vector before doing is.na to | |
312 | avoid generating a warning. | |
313 | ||
314 | 2004-05-24 13:17 warnes | |
315 | ||
316 | * R/invalid.R, man/invalid.Rd: Add invalid() function for testing | |
317 | if a parameter value is non-missing, non-NA, non-NULL. | |
318 | ||
319 | 2004-04-27 10:33 warnes | |
320 | ||
321 | * R/running.R, man/running.Rd: Replaced argument `as.list' with | |
322 | `simplify'. Updated documentation, and updated examples | |
323 | appropriately. | |
324 | ||
325 | 2004-04-26 12:37 warnes | |
326 | ||
327 | * R/running.R, man/running.Rd: Added as.list argument to return one | |
328 | list element per evaluation. | |
329 | ||
330 | 2004-03-26 17:21 tag gregmisc_0_10_2 | |
331 | ||
332 | 2004-03-26 17:21 warnes | |
333 | ||
334 | * man/combinations.Rd: Uncomment and fix large 'n' example. | |
335 | ||
336 | 2004-03-26 17:19 warnes | |
337 | ||
338 | * man/running.Rd: - Update to match changes in running() - Add | |
339 | examples to illustrate new arguments. - Modify running | |
340 | correlation plot example to be more clear. | |
341 | ||
342 | 2004-03-26 17:12 warnes | |
343 | ||
344 | * R/running.R: More of the same. | |
345 | ||
346 | 2004-03-26 10:34 warnes | |
347 | ||
348 | * R/running.R: Fix bug discovered by Sean Davis | |
349 | <sdavis2@mail.nih.gov>. The running function took an improper | |
350 | shortcut. When allow.fewer=FALSE it was still passing shorter | |
351 | lists of elements to the called function, and then overwriting | |
352 | the results for the shorter lists with NAs. The code now skips | |
353 | evaluation of the function on lists shorter than the specified | |
354 | length when allow.fewer=FALSE. | |
355 | ||
356 | 2004-01-20 23:31 tag gregmisc_0_8_9 | |
357 | ||
358 | 2004-01-20 23:31 tag rel_0_8_8 | |
359 | ||
360 | 2004-01-20 23:31 warnes | |
361 | ||
362 | * R/capture.R: - Mark sprint() as depreciated. - Replace | |
363 | references to sprint with capture.output() - Use match.arg for | |
364 | halign and valign arguments to textplot.default. - Fix | |
365 | textplot.character so that a vector of characters is properly | |
366 | displayed. Previouslt, character vectors were plotted on top of | |
367 | each other. | |
368 | ||
369 | 2003-12-02 21:46 tag rel_0_8_5 | |
370 | ||
371 | 2003-12-02 21:46 tag rel_0_8_7 | |
372 | ||
373 | 2003-12-02 21:46 warnes | |
374 | ||
375 | * man/foldchange.Rd: - match function argument defaults with | |
376 | 'usage' | |
377 | ||
378 | 2003-11-21 18:00 warnes | |
379 | ||
380 | * man/foldchange.Rd: | |
381 | Removed 'deqn' call that was confusing things. | |
382 | ||
383 | 2003-11-21 15:54 warnes | |
384 | ||
385 | * man/logit.Rd: Add email address to author field | |
386 | ||
387 | 2003-11-21 15:35 warnes | |
388 | ||
389 | * R/foldchange.R, man/foldchange.Rd: | |
390 | - new files | |
391 | ||
392 | 2003-11-21 14:54 warnes | |
393 | ||
394 | * R/mixedsort.R, man/mixedsort.Rd: | |
395 | - Change 'T' to 'TRUE' in mixedsort.R - Add missing brace in | |
396 | mixedsort.Rd | |
397 | ||
398 | 2003-11-20 10:56 warnes | |
399 | ||
400 | * R/oddeven.R, man/oddeven.Rd: | |
401 | - Move 'odd' and 'even' functions to a separate file & provide | |
402 | documentation | |
403 | ||
404 | 2003-11-18 17:47 warnes | |
405 | ||
406 | * R/mixedsort.R, man/mixedsort.Rd: | |
407 | - Renamed smartsort to mixedsort and added documentation. | |
408 | ||
409 | 2003-11-10 17:11 warnes | |
410 | ||
411 | * R/capture.R, man/capture.Rd: | |
412 | - Add files contributed by Arni Magnusson | |
413 | <arnima@u.washington.edu>. As well as some of my own. | |
414 | ||
415 | 2003-05-23 14:14 warnes | |
416 | ||
417 | * R/logit.R, man/logit.Rd: | |
418 | - library() backported from 1.7-devel. This version of the | |
419 | function adds the "pos=" argument to specify where in the | |
420 | search path the library should be placed. | |
421 | ||
422 | - updated .First.lib to use library(...pos=3) for MASS to avoid | |
423 | the 'genotype' data set in MASS from masking the genotype | |
424 | funciton in genetics when it loads gregmisc | |
425 | ||
426 | - Added logit() inv.logit() matchcols() function and | |
427 | corresponding docs | |
428 | ||
429 | 2003-04-22 12:00 tag rel_0_8_4 | |
430 | ||
431 | 2003-04-22 12:00 warnes | |
432 | ||
433 | * man/combinations.Rd: - Fixed tpyo in example that allowed | |
434 | combinations(500,2) to run when it should have been ignred for | |
435 | testing.. | |
436 | ||
437 | 2003-04-10 12:22 warnes | |
438 | ||
439 | * man/combinations.Rd: | |
440 | - Added note about the need to increase options("expressions") to | |
441 | use large values for 'n'. Prompted by bug report from Huan | |
442 | Huang <huan.huang@bnpparibas.com | |
443 | ||
444 | 2003-04-04 08:58 tag rel_0_8_3 | |
445 | ||
446 | 2003-04-04 08:58 warnes | |
447 | ||
448 | * R/RSCompat.S: | |
449 | - Replace 'T' with 'TRUE' | |
450 | ||
451 | 2003-04-04 08:49 warnes | |
452 | ||
453 | * R/dirichlet.R: | |
454 | - Change occurences of 'T' to 'TRUE' | |
455 | ||
456 | 2003-04-04 08:46 warnes | |
457 | ||
458 | * man/capture.Rd: | |
459 | - Allow optional arguments to sprint to be passed to print - Fix | |
460 | R CMD check errors | |
461 | ||
462 | 2003-04-04 08:45 warnes | |
463 | ||
464 | * R/capture.R: | |
465 | - Allow optional arguments to sprint to be passed to print | |
466 | ||
467 | 2003-04-03 08:20 warnes | |
468 | ||
469 | * man/capture.Rd: | |
470 | - Had mistyped 'sprint' as 'sprintf'. | |
471 | ||
472 | 2003-04-03 08:18 warnes | |
473 | ||
474 | * man/capture.Rd: - Add help file for capture and sprintf. | |
475 | ||
476 | 2003-04-02 17:28 warnes | |
477 | ||
478 | * R/capture.R: | |
479 | - Added file 'capture.R' containing capture() and sprint(). | |
480 | ||
481 | 2003-03-07 10:48 tag rel_0_8_2 | |
482 | ||
483 | 2003-03-07 10:48 warnes | |
484 | ||
485 | * R/RSCompat.S: | |
486 | - Minor changes to code to allow the package to be provided as an | |
487 | S-Plus chapter. | |
488 | ||
489 | 2003-01-30 16:56 tag rel_0_8_0 | |
490 | ||
491 | 2003-01-30 16:56 warnes | |
492 | ||
493 | * man/running.Rd: - Fixed typo in email address. | |
494 | ||
495 | 2003-01-02 10:42 tag rel_0_7_5 | |
496 | ||
497 | 2003-01-02 10:42 warnes | |
498 | ||
499 | * R/RSCompat.S: - Add nlevels function. | |
500 | ||
501 | 2002-10-11 14:22 tag rel_0_7_2 | |
502 | ||
503 | 2002-10-11 14:22 tag rel_0_7_3 | |
504 | ||
505 | 2002-10-11 14:22 warnes | |
506 | ||
507 | * R/permute.R, man/permute.Rd: | |
508 | - Add permute() function (wraper for sample) and man page | |
509 | ||
510 | 2002-10-11 14:21 warnes | |
511 | ||
512 | * man/dirichlet.Rd: | |
513 | - Escaped underscores in my email address that was causing a | |
514 | parse error in the {r,p}dirichlet man page. | |
515 | ||
516 | 2002-09-30 16:43 warnes | |
517 | ||
518 | * R/dirichlet.R, man/dirichlet.Rd: | |
519 | - Added rdirichlet() and ddirichlet() with accompaning help page | |
520 | and tests. | |
521 | ||
522 | 2002-09-24 10:57 tag rel_0_7_0 | |
523 | ||
524 | 2002-09-24 10:57 warnes | |
525 | ||
526 | * R/running.R: | |
527 | - Fixed error where running was always calling running2 with | |
528 | 'fun=mean', ignoring the specified funtion. | |
529 | ||
530 | 2002-09-23 09:59 tag rel_0_6_0 | |
531 | ||
532 | 2002-09-23 09:59 warnes | |
533 | ||
534 | * man/: combinations.Rd, quantcut.Rd: - Modified all files to | |
535 | include CVS Id and Log tags. | |
536 | ||
537 | 2002-09-23 09:38 warnes | |
538 | ||
539 | * R/combinations.R: | |
540 | - Added CrossTable() and barplot2() code and docs contributed by | |
541 | Marc Schwartz. - Permit combinations() to be used when r>n | |
542 | provided repeat.allowed=TRUE - Bumped up version number | |
543 | ||
544 | 2002-08-01 15:37 tag rel_0_5_5 | |
545 | ||
546 | 2002-08-01 15:37 warnes | |
547 | ||
548 | * R/running.R: | |
549 | - Corrected documentation mismatch for ci, ci.default. | |
550 | ||
551 | - Replaced all occurences of '_' for assignment with '<-'. | |
552 | ||
553 | - Replaced all occurences of 'T' or 'F' for 'TRUE' and 'FALSE' | |
554 | with the spelled out version. | |
555 | ||
556 | - Updaded version number and date. | |
557 | ||
558 | 2002-04-08 20:51 tag rel_0_5_3 | |
559 | ||
560 | 2002-04-08 20:51 tag rel_0_5_4 | |
561 | ||
562 | 2002-04-08 20:51 warneg | |
563 | ||
564 | * R/combinations.R, man/combinations.Rd, man/running.Rd: | |
565 | Checkin for version 0.5.3 | |
566 | ||
567 | 2002-03-26 09:49 tag rel_0_5_1 | |
568 | ||
569 | 2002-03-26 09:49 warneg | |
570 | ||
571 | * man/quantcut.Rd: | |
572 | Initial Checkin | |
573 | ||
574 | 2002-03-26 09:29 warneg | |
575 | ||
576 | * R/quantcut.R: | |
577 | Initial checkin. | |
578 | ||
579 | 2002-03-19 22:44 warneg | |
580 | ||
581 | * R/RSCompat.S: - Added definition of is.R function. | |
582 | ||
583 | - Added boxplot.formula | |
584 | ||
585 | 2002-03-07 18:39 warneg | |
586 | ||
587 | * man/running.Rd: - Added documentation and example for running2 | |
588 | ||
589 | 2002-03-07 18:38 warneg | |
590 | ||
591 | * R/running.R: | |
592 | - Added "running2", which handles both univariate and bivariate | |
593 | cases - Modified "running" to call "running2" | |
594 | ||
595 | 2002-02-04 21:20 warneg | |
596 | ||
597 | * R/RSCompat.S: | |
598 | - Fix typo that caused code meant to run only under S-Plus to run | |
599 | under R, causing problems. | |
600 | ||
601 | 2001-12-19 17:45 warneg | |
602 | ||
603 | * R/RSCompat.S: - Added code for %in%. | |
604 | ||
605 | 2001-09-18 10:15 tag rel_0_5_0 | |
606 | ||
607 | 2001-09-18 10:15 warneg | |
608 | ||
609 | * R/RSCompat.S: | |
610 | Release 0.3.2 | |
611 | ||
612 | 2001-09-01 15:19 warneg | |
613 | ||
614 | * R/RSCompat.S: | |
615 | Initial checkin. | |
616 | ||
617 | 2001-08-31 20:01 warneg | |
618 | ||
619 | * R/running.R, man/running.Rd: Release 0.3.0 | |
620 | ||
621 | 2001-08-25 01:53 warneg | |
622 | ||
623 | * R/running.R: Initial CVS checkin. | |
624 | ||
625 | 2001-08-25 01:50 warneg | |
626 | ||
627 | * man/combinations.Rd: Fixed a typo and a syntax error. | |
628 | ||
629 | 2001-08-24 23:59 warneg | |
630 | ||
631 | * man/running.Rd: Initial Checkin | |
632 | ||
633 | 2001-06-29 09:23 warneg | |
634 | ||
635 | * R/combinations.R, man/combinations.Rd: | |
636 | Initial revision. | |
637 |
1 | 1 | Title: Various R programming tools |
2 | 2 | Description: Various R programming tools |
3 | 3 | Depends: R (>= 1.9.0) |
4 | Version: 2.2.2 | |
5 | Date: 2005-11-22 | |
4 | Version: 2.2.3 | |
5 | Date: 2005-12-21 | |
6 | 6 | Author: Gregory R. Warnes. Includes R source code and/or documentation |
7 | 7 | contributed by Ben Bolker and Thomas Lumley |
8 | 8 | Maintainer: Nitin Jain <nitin.jain@pfizer.com> |
9 | 9 | License: LGPL 2.1 |
10 | Packaged: Wed Dec 14 15:33:15 2005; hornik | |
10 | Packaged: Wed Dec 21 10:23:52 2005; warneg |
Binary diff not shown
Binary diff not shown
0 | CHANGES IN gtools 2.2.3 | |
1 | ----------------------- | |
2 | ||
3 | - setTCPNoDelay now compiles & works properly on Windows | |
4 | ||
5 | ||
0 | 6 | CHANGES IN gtools 2.2.2 |
1 | 7 | ----------------------- |
2 | 8 | |
3 | - src/setTCPNoDelay.c: Add C source code for setTCPNoDelay. | |
9 | - src/setTCPNoDelay.c: Add C source code for setTCPNoDelay. | |
4 | 10 | |
5 | - NAMESPACE: Add UseDynLib to NAMESPACE so the shared library gets | |
6 | properly loaded. | |
11 | - NAMESPACE: Add UseDynLib to NAMESPACE so the shared library gets | |
12 | properly loaded. | |
7 | 13 | |
8 | 14 | - Updated Greg's email address. |
9 | 15 |
0 | .packageName <- "gtools" | |
1 | # $Id: RSCompat.S,v 1.9 2005/06/09 14:20:28 nj7w Exp $ | |
2 | # | |
3 | # $Log: RSCompat.S,v $ | |
4 | # Revision 1.9 2005/06/09 14:20:28 nj7w | |
5 | # Updating the version number, and various help files to synchronize splitting of gregmisc bundle in 4 individual components. | |
6 | # | |
7 | # Revision 1.1.1.1 2005/05/25 22:17:28 nj7w | |
8 | # Initial submision as individual package | |
9 | # | |
10 | # Revision 1.8 2003/04/04 13:58:59 warnes | |
11 | # | |
12 | # - Replace 'T' with 'TRUE' | |
13 | # | |
14 | # Revision 1.7 2003/03/07 15:48:35 warnes | |
15 | # | |
16 | # - Minor changes to code to allow the package to be provided as an | |
17 | # S-Plus chapter. | |
18 | # | |
19 | # Revision 1.6 2003/01/02 15:42:00 warnes | |
20 | # - Add nlevels function. | |
21 | # | |
22 | # Revision 1.5 2002/03/20 03:44:32 warneg | |
23 | # - Added definition of is.R function. | |
24 | # | |
25 | # - Added boxplot.formula | |
26 | # | |
27 | # Revision 1.4 2002/02/05 02:20:07 warneg | |
28 | # | |
29 | # - Fix typo that caused code meant to run only under S-Plus to run | |
30 | # under R, causing problems. | |
31 | # | |
32 | # Revision 1.3 2001/12/19 22:45:44 warneg | |
33 | # - Added code for %in%. | |
34 | # | |
35 | # Revision 1.2 2001/09/18 14:15:44 warneg | |
36 | # | |
37 | # Release 0.3.2 | |
38 | # | |
39 | # Revision 1.1 2001/09/01 19:19:13 warneg | |
40 | # | |
41 | # Initial checkin. | |
42 | # | |
43 | # | |
44 | # Code necessary for contrast.lm, boxplot.n to work in S-Plus | |
45 | ||
46 | if(!exists("is.R") || !is.R() ) | |
47 | { | |
48 | is.R <- function() FALSE | |
49 | ||
50 | getOption <- function(...) options(...) | |
51 | ||
52 | if(!exists("parent.frame")) parent.frame <- sys.parent | |
53 | ||
54 | colnames <- function (x, do.NULL = TRUE, prefix = "col") | |
55 | { | |
56 | dn <- dimnames(x) | |
57 | if (!is.null(dn[[2]])) | |
58 | dn[[2]] | |
59 | else { | |
60 | if (do.NULL) | |
61 | NULL | |
62 | else paste(prefix, seq(length = NCOL(x)), sep = "") | |
63 | } | |
64 | } | |
65 | ||
66 | rownames <- function (x, do.NULL = TRUE, prefix = "row") | |
67 | { | |
68 | dn <- dimnames(x) | |
69 | if (!is.null(dn[[1]])) | |
70 | dn[[1]] | |
71 | else { | |
72 | if (do.NULL) | |
73 | NULL | |
74 | else paste(prefix, seq(length = NROW(x)), sep = "") | |
75 | } | |
76 | } | |
77 | ||
78 | "rownames<-" <- function (x, value) | |
79 | { | |
80 | dn <- dimnames(x) | |
81 | ndn <- names(dn) | |
82 | dn <- list(value, if (!is.null(dn)) dn[[2]]) | |
83 | names(dn) <- ndn | |
84 | dimnames(x) <- dn | |
85 | x | |
86 | } | |
87 | ||
88 | "colnames<-" <- function (x, value) | |
89 | { | |
90 | dn <- dimnames(x) | |
91 | ndn <- names(dn) | |
92 | dn <- list(if (!is.null(dn)) dn[[1]], value) | |
93 | names(dn) <- ndn | |
94 | dimnames(x) <- dn | |
95 | x | |
96 | } | |
97 | ||
98 | # from the MASS library by Venables & Ripley | |
99 | ginv <- function (X, tol = sqrt(.Machine$double.eps)) | |
100 | { | |
101 | if (length(dim(X)) > 2 || !(is.numeric(X) || is.complex(X))) | |
102 | stop("X must be a numeric or complex matrix") | |
103 | if (!is.matrix(X)) | |
104 | X <- as.matrix(X) | |
105 | Xsvd <- svd(X) | |
106 | if (is.complex(X)) | |
107 | Xsvd$u <- Conj(Xsvd$u) | |
108 | Positive <- Xsvd$d > max(tol * Xsvd$d[1], 0) | |
109 | if (all(Positive)) Xsvd$v %*% (1/Xsvd$d * t(Xsvd$u)) | |
110 | else if (!any(Positive)) array(0, dim(X)[2:1]) | |
111 | else Xsvd$v[, Positive] %*% ((1/Xsvd$d[Positive]) * t(Xsvd$u[, Positive])) | |
112 | } | |
113 | ||
114 | ||
115 | "format.pval" <- | |
116 | function (pv, digits = max(1, getOption("digits") - 2), | |
117 | eps = .Machine$double.eps, | |
118 | na.form = "NA") | |
119 | { | |
120 | if ((has.na <- any(ina <- is.na(pv)))) | |
121 | pv <- pv[!ina] | |
122 | r <- character(length(is0 <- pv < eps)) | |
123 | if (any(!is0)) { | |
124 | rr <- pv <- pv[!is0] | |
125 | expo <- floor(log10(pv)) | |
126 | fixp <- expo >= -3 | (expo == -4 & digits > 1) | |
127 | if (any(fixp)) | |
128 | rr[fixp] <- format(pv[fixp], dig = digits) | |
129 | if (any(!fixp)) | |
130 | rr[!fixp] <- format(pv[!fixp], dig = digits) | |
131 | r[!is0] <- rr | |
132 | } | |
133 | if (any(is0)) { | |
134 | digits <- max(1, digits - 2) | |
135 | if (any(!is0)) { | |
136 | nc <- max(nchar(rr)) | |
137 | if (digits > 1 && digits + 6 > nc) | |
138 | digits <- max(1, nc - 7) | |
139 | sep <- if (digits == 1 && nc <= 6) | |
140 | "" | |
141 | else " " | |
142 | } | |
143 | else sep <- if (digits == 1) | |
144 | "" | |
145 | else " " | |
146 | r[is0] <- paste("<", format(eps, digits = digits), sep = sep) | |
147 | } | |
148 | if (has.na) { | |
149 | rok <- r | |
150 | r <- character(length(ina)) | |
151 | r[!ina] <- rok | |
152 | r[ina] <- na.form | |
153 | } | |
154 | r | |
155 | } | |
156 | ||
157 | "%in%" <- function (x, table) match(x, table, nomatch = 0) > 0 | |
158 | ||
159 | strwidth <- function(...) | |
160 | { | |
161 | par("cin")[1] / par("fin")[1] * (par("usr")[2] - par("usr")[1]) | |
162 | } | |
163 | ||
164 | strheight <- function(...) | |
165 | { | |
166 | par("cin")[2] / par("fin")[2] * (par("usr")[4] - par("usr")[3]) | |
167 | } | |
168 | ||
169 | boxplot.formula <- function(x, data = sys.parent(), ..., ask = TRUE) | |
170 | { | |
171 | if(!inherits(x, "formula")) | |
172 | x <- as.formula(x) | |
173 | ||
174 | mf <- model.frame(x, data, na.action = function(z) z) | |
175 | if(length(names(mf)) > 2) | |
176 | stop("boxplot.formula only accepts models with 1 predictor") | |
177 | ||
178 | resp <- attr(attr(mf, "terms"), "response") | |
179 | class(mf) <- NULL | |
180 | y <- mf[[resp]] | |
181 | x <- mf[[-resp]] | |
182 | xlab <- names(mf)[-resp] | |
183 | ylab <- names(mf)[resp] | |
184 | ||
185 | boxplot(split(y, x), xlab = xlab, ylab = ylab, ...) | |
186 | } | |
187 | ||
188 | nlevels <- function(x) length(levels(x)) | |
189 | ||
190 | NULL | |
191 | ||
192 | } | |
193 | addLast <- function( fun ) | |
194 | { | |
195 | if (!is.function(fun)) stop("fun must be a function") | |
196 | if(!exists(".Last", env=.GlobalEnv)) | |
197 | assign(".Last", fun, env=.GlobalEnv) | |
198 | else | |
199 | { | |
200 | Last <- get(".Last", env=.GlobalEnv) | |
201 | newfun <- function(...) | |
202 | { | |
203 | fun() | |
204 | Last() | |
205 | } | |
206 | assign(".Last", newfun, env=.GlobalEnv) | |
207 | } | |
208 | } | |
209 | ## useful function, raises an error if the FLAG expression is FALSE | |
210 | assert <- function( FLAG ) | |
211 | { | |
212 | if(!all(FLAG)) | |
213 | stop("Failed Assertion") | |
214 | } | |
215 | # $Id: combinations.R,v 1.7 2005/06/09 14:20:28 nj7w Exp $ | |
216 | # | |
217 | ||
218 | ## | |
219 | ## From email by Brian D Ripley <ripley@stats.ox.ac.uk> to r-help | |
220 | ## dated Tue, 14 Dec 1999 11:14:04 +0000 (GMT) in response to | |
221 | ## Alex Ahgarin <datamanagement@email.com>. Original version was | |
222 | ## named "subsets" and was Written by Bill Venables. | |
223 | ## | |
224 | ||
225 | combinations <- function(n, r, v = 1:n, set = TRUE, repeats.allowed=FALSE) | |
226 | { | |
227 | if(mode(n) != "numeric" || length(n) != 1 | |
228 | || n < 1 || (n %% 1) != 0) stop("bad value of n") | |
229 | if(mode(r) != "numeric" || length(r) != 1 | |
230 | || r < 1 || (r %% 1) != 0) stop("bad value of r") | |
231 | if(!is.atomic(v) || length(v) < n) | |
232 | stop("v is either non-atomic or too short") | |
233 | if( (r > n) & repeats.allowed==FALSE) | |
234 | stop("r > n and repeats.allowed=FALSE") | |
235 | if(set) { | |
236 | v <- unique(sort(v)) | |
237 | if (length(v) < n) stop("too few different elements") | |
238 | } | |
239 | v0 <- vector(mode(v), 0) | |
240 | ## Inner workhorse | |
241 | if(repeats.allowed) | |
242 | sub <- function(n, r, v) | |
243 | { | |
244 | if(r == 0) v0 else | |
245 | if(r == 1) matrix(v, n, 1) else | |
246 | if(n == 1) matrix(v, 1, r) else | |
247 | rbind( cbind(v[1], Recall(n, r-1, v)), | |
248 | Recall(n-1, r, v[-1])) | |
249 | } | |
250 | else | |
251 | sub <- function(n, r, v) | |
252 | { | |
253 | if(r == 0) v0 else | |
254 | if(r == 1) matrix(v, n, 1) else | |
255 | if(r == n) matrix(v, 1, n) else | |
256 | rbind(cbind(v[1], Recall(n-1, r-1, v[-1])), | |
257 | Recall(n-1, r, v[-1])) | |
258 | } | |
259 | sub(n, r, v[1:n]) | |
260 | } | |
261 | ||
262 | ## | |
263 | ## Original version by Bill Venables and cited by by Matthew | |
264 | ## Wiener (mcw@ln.nimh.nih.gov) in an email to R-help dated | |
265 | ## Tue, 14 Dec 1999 09:11:32 -0500 (EST) in response to | |
266 | ## Alex Ahgarin <datamanagement@email.com> | |
267 | ## | |
268 | ## | |
269 | ||
270 | ||
271 | permutations <- function(n, r, v = 1:n, set = TRUE, repeats.allowed=FALSE) | |
272 | { | |
273 | if(mode(n) != "numeric" || length(n) != 1 | |
274 | || n < 1 || (n %% 1) != 0) stop("bad value of n") | |
275 | if(mode(r) != "numeric" || length(r) != 1 | |
276 | || r < 1 || (r %% 1) != 0) stop("bad value of r") | |
277 | if(!is.atomic(v) || length(v) < n) | |
278 | stop("v is either non-atomic or too short") | |
279 | if( (r > n) ) #& repeats.allowed==FALSE) | |
280 | stop("r > n") # and repeats.allowed=FALSE") | |
281 | if(set) { | |
282 | v <- unique(sort(v)) | |
283 | if (length(v) < n) stop("too few different elements") | |
284 | } | |
285 | v0 <- vector(mode(v), 0) | |
286 | ## Inner workhorse | |
287 | if(repeats.allowed) | |
288 | sub <- function(n, r, v) | |
289 | { | |
290 | if(r==1) matrix(v,n,1) else | |
291 | if(n==1) matrix(v,1,r) else | |
292 | { | |
293 | inner <- Recall(n, r-1, v) | |
294 | cbind( rep( v, rep(nrow(inner),n) ), | |
295 | matrix( t(inner), ncol=ncol(inner), nrow=nrow(inner) * n , | |
296 | byrow=TRUE ) | |
297 | ) | |
298 | } | |
299 | } | |
300 | else | |
301 | sub <- function(n, r, v) | |
302 | { | |
303 | if(r==1) matrix(v,n,1) else | |
304 | if(n==1) matrix(v,1,r) else | |
305 | { | |
306 | X <- NULL | |
307 | for(i in 1:n) | |
308 | X <- rbind( X, cbind( v[i], Recall(n-1, r - 1, v[-i]))) | |
309 | X | |
310 | } | |
311 | } | |
312 | ||
313 | sub(n, r, v[1:n]) | |
314 | } | |
315 | ## Code from | |
316 | ## | |
317 | ## @Article{Rnews:Lumley:2001, | |
318 | ## author = {Thomas Lumley}, | |
319 | ## title = {Programmer's Niche: Macros in {R}}, | |
320 | ## journal = {R News}, | |
321 | ## year = 2001, | |
322 | ## volume = 1, | |
323 | ## number = 3, | |
324 | ## pages = {11--13}, | |
325 | ## month = {September}, | |
326 | ## url = {http://CRAN.R-project.org/doc/Rnews/} | |
327 | ##} | |
328 | defmacro <- function(..., expr) #, DOTS=FALSE) | |
329 | { | |
330 | expr <- substitute(expr) | |
331 | a <- substitute(list(...))[-1] | |
332 | ||
333 | ## process the argument list | |
334 | nn <- names(a) | |
335 | if (is.null(nn)) | |
336 | nn <- rep("", length(a)) | |
337 | for(i in 1:length(a)) | |
338 | { | |
339 | if (nn[i] == "") | |
340 | { | |
341 | nn[i] <- paste(a[[i]]) | |
342 | msg <- paste(a[[i]], "not supplied") | |
343 | a[[i]] <- substitute(stop(foo), | |
344 | list(foo = msg)) | |
345 | } | |
346 | if (nn[i] == "DOTS") | |
347 | { | |
348 | nn[i] <- "..." | |
349 | a[[i]] <- formals(function(...){})[[1]] | |
350 | } | |
351 | } | |
352 | names(a) <- nn | |
353 | a <- as.list(a) | |
354 | ||
355 | ## this is where the work is done | |
356 | ff <- eval(substitute( | |
357 | function() | |
358 | { | |
359 | tmp <- substitute(body) | |
360 | eval(tmp, parent.frame()) | |
361 | }, | |
362 | list(body = expr))) | |
363 | ||
364 | ## add the argument list | |
365 | formals(ff) <- a | |
366 | ||
367 | ## create a fake source attribute | |
368 | mm <- match.call() | |
369 | mm$expr <- NULL | |
370 | mm[[1]] <- as.name("macro") | |
371 | attr(ff, "source") <- c(deparse(mm), | |
372 | deparse(expr)) | |
373 | ||
374 | ## return the 'macro' | |
375 | ff | |
376 | } | |
377 | ||
378 | # $Id: dirichlet.R,v 1.4 2005/06/09 14:20:28 nj7w Exp $ | |
379 | ||
380 | # Posted by Ben Bolker to R-News on Fri Dec 15 2000 | |
381 | # http://www.r-project.org/nocvs/mail/r-help/2000/3865.html | |
382 | # | |
383 | # Some code (originally contributed by Ian Wilson | |
384 | # <i.wilson@maths.abdn.ac.uk> | |
385 | ||
386 | ||
387 | # functions for the "Dirichlet function", the multidimensional | |
388 | # generalization of the beta distribution: it's the Bayesian | |
389 | # canonical # distribution for the parameter estimates of a | |
390 | # multinomial distribution. | |
391 | ||
392 | # "pdirichlet" and "qdirichlet" (distribution function and quantiles) | |
393 | # would be more difficult because you'd first have to decide how to | |
394 | # define the distribution function for a multivariate distribution | |
395 | # ... I'm sure this could be done but I don't know how | |
396 | ||
397 | ||
398 | ||
399 | ddirichlet<-function(x,alpha) | |
400 | ## probability density for the Dirichlet function, where x=vector of | |
401 | ## probabilities | |
402 | ## and (alpha-1)=vector of observed samples of each type | |
403 | ## ddirichlet(c(p,1-p),c(x1,x2)) == dbeta(p,x1,x2) | |
404 | { | |
405 | ||
406 | dirichlet1 <- function(x, alpha) | |
407 | { | |
408 | logD <- sum(lgamma(alpha)) - lgamma(sum(alpha)) | |
409 | s<-sum((alpha-1)*log(x)) | |
410 | exp(sum(s)-logD) | |
411 | ||
412 | } | |
413 | ||
414 | # make sure x is a matrix | |
415 | if(!is.matrix(x)) | |
416 | if(is.data.frame(x)) | |
417 | x <- as.matrix(x) | |
418 | else | |
419 | x <- t(x) | |
420 | ||
421 | if(!is.matrix(alpha)) | |
422 | alpha <- matrix( alpha, ncol=length(alpha), nrow=nrow(x), byrow=TRUE) | |
423 | ||
424 | if( any(dim(x) != dim(alpha)) ) | |
425 | stop("Mismatch between dimensions of 'x' and 'alpha'.") | |
426 | ||
427 | pd <- vector(length=nrow(x)) | |
428 | for(i in 1:nrow(x)) | |
429 | pd[i] <- dirichlet1(x[i,],alpha[i,]) | |
430 | ||
431 | # Enforce 0 <= x[i,j] <= 1, sum(x[i,]) = 1 | |
432 | pd[ apply( x, 1, function(z) any( z <0 | z > 1)) ] <- 0 | |
433 | pd[ apply( x, 1, function(z) all.equal(sum( z ),1) !=TRUE) ] <- 0 | |
434 | pd | |
435 | } | |
436 | ||
437 | ||
438 | rdirichlet<-function(n,alpha) | |
439 | ## generate n random deviates from the Dirichlet function with shape | |
440 | ## parameters alpha | |
441 | { | |
442 | l<-length(alpha); | |
443 | x<-matrix(rgamma(l*n,alpha),ncol=l,byrow=TRUE); | |
444 | sm<-x%*%rep(1,l); | |
445 | x/as.vector(sm); | |
446 | } | |
447 | ||
448 | # $Id: foldchange.R,v 1.3 2005/06/09 14:20:29 nj7w Exp $ | |
449 | ||
450 | foldchange <- function(num,denom) | |
451 | { | |
452 | ifelse(num >= denom, num/denom, -denom/num) | |
453 | } | |
454 | ||
455 | ||
456 | # Compute foldchange from log-ratio values | |
457 | logratio2foldchange <- function(logratio, base=2) | |
458 | { | |
459 | retval <- base^(logratio) | |
460 | retval <- ifelse(retval < 1, -1/retval, retval) | |
461 | retval | |
462 | } | |
463 | ||
464 | # vice versa | |
465 | foldchange2logratio <- function(foldchange, base=2) | |
466 | { | |
467 | retval <- ifelse( foldchange<0, 1/-foldchange, foldchange) | |
468 | retval <- log(retval,base) | |
469 | retval | |
470 | } | |
471 | ||
472 | # $Id: invalid.R,v 1.4 2005/06/09 14:20:29 nj7w Exp $ | |
473 | ||
474 | invalid <- function(x) | |
475 | { | |
476 | if( missing(x) || is.null(x) || length(x)==0 ) | |
477 | return(TRUE) | |
478 | if(is.list(x)) | |
479 | return(all(sapply(x,invalid))) | |
480 | else if(is.vector(x)) | |
481 | return(all(is.na(x))) | |
482 | else | |
483 | return(FALSE) | |
484 | } | |
485 | # $Id: logit.R,v 1.2 2005/06/09 14:20:29 nj7w Exp $ | |
486 | ||
487 | logit <- function(x, min=0, max=1) | |
488 | { | |
489 | p <- (x-min)/(max-min) | |
490 | log(p/(1-p)) | |
491 | } | |
492 | ||
493 | inv.logit <- function(x, min=0, max=1) | |
494 | { | |
495 | p <- exp(x)/(1+exp(x)) | |
496 | p <- ifelse( is.na(p) & !is.na(x), 1, p ) # fix problems with +Inf | |
497 | p * (max-min) + min | |
498 | } | |
499 | ||
500 | # $Id: mixedsort.R,v 1.10 2005/06/13 17:08:41 nj7w Exp $ | |
501 | ||
502 | mixedsort <- function(x) x[mixedorder(x)] | |
503 | ||
504 | mixedorder <- function(x) | |
505 | { | |
506 | # - Split each each character string into an vector of strings and | |
507 | # numbers | |
508 | # - Separately rank numbers and strings | |
509 | # - Combine orders so that strings follow numbers | |
510 | ||
511 | delim="\\$\\@\\$" | |
512 | ||
513 | numeric <- function(x) | |
514 | { | |
515 | optwarn = options("warn") | |
516 | on.exit( options(optwarn) ) | |
517 | options(warn=-1) | |
518 | as.numeric(x) | |
519 | } | |
520 | ||
521 | nonnumeric <- function(x) | |
522 | { | |
523 | optwarn = options("warn") | |
524 | on.exit( options(optwarn) ) | |
525 | options(warn=-1) | |
526 | ||
527 | ifelse(is.na(as.numeric(x)), toupper(x), NA) | |
528 | } | |
529 | ||
530 | ||
531 | x <- as.character(x) | |
532 | ||
533 | which.nas <- which(is.na(x)) | |
534 | which.blanks <- which(x=="") | |
535 | ||
536 | if(length(which.blanks) >0) | |
537 | x[ which.blanks ] <- -Inf | |
538 | if(length(which.nas) >0) | |
539 | x[ which.nas ] <- Inf | |
540 | ||
541 | #### | |
542 | # - Convert each character string into an vector containing single | |
543 | # character and numeric values. | |
544 | #### | |
545 | ||
546 | # find and mark numbers in the form of +1.23e+45.67 | |
547 | delimited <- gsub("([+-]{0,1}[0-9\.]+([eE][\+\-]{0,1}[0-9\.]+){0,1})", | |
548 | paste(delim,"\\1",delim,sep=""), x) | |
549 | ||
550 | # separate out numbers | |
551 | step1 <- strsplit(delimited, delim) | |
552 | ||
553 | # remove empty elements | |
554 | step1 <- lapply( step1, function(x) x[x>""] ) | |
555 | ||
556 | # create numeric version of data | |
557 | step1.numeric <- lapply( step1, numeric ) | |
558 | ||
559 | # create non-numeric version of data | |
560 | step1.character <- lapply( step1, nonnumeric ) | |
561 | ||
562 | # now transpose so that 1st vector contains 1st element from each | |
563 | # original string | |
564 | maxelem <- max(sapply(step1, length)) | |
565 | ||
566 | step1.numeric.t <- lapply(1:maxelem, | |
567 | function(i) | |
568 | sapply(step1.numeric, | |
569 | function(x)x[i]) | |
570 | ) | |
571 | ||
572 | step1.character.t <- lapply(1:maxelem, | |
573 | function(i) | |
574 | sapply(step1.character, | |
575 | function(x)x[i]) | |
576 | ) | |
577 | ||
578 | # now order them | |
579 | rank.numeric <- sapply(step1.numeric.t,rank) | |
580 | rank.character <- sapply(step1.character.t, | |
581 | function(x) as.numeric(factor(x))) | |
582 | ||
583 | # and merge | |
584 | rank.numeric[!is.na(rank.character)] <- 0 # mask off string values | |
585 | ||
586 | rank.character <- t( | |
587 | t(rank.character) + | |
588 | apply(matrix(rank.numeric),2,max,na.rm=TRUE) | |
589 | ) | |
590 | ||
591 | rank.overall <- ifelse(is.na(rank.character),rank.numeric,rank.character) | |
592 | ||
593 | order.frame <- as.data.frame(rank.overall) | |
594 | if(length(which.nas) > 0) | |
595 | order.frame[which.nas,] <- Inf | |
596 | retval <- do.call("order",order.frame) | |
597 | ||
598 | return(retval) | |
599 | } | |
600 | ||
601 | ||
602 | # $Id: oddeven.R,v 1.3 2005/06/09 14:20:29 nj7w Exp $ | |
603 | ||
604 | # detect odd/even integers | |
605 | odd <- function(x) x!=as.integer(x/2)*2 | |
606 | even <- function(x) x==as.integer(x/2)*2 | |
607 | # $Id: permute.R,v 1.3 2005/06/09 14:20:29 nj7w Exp $ | |
608 | ||
609 | permute <- function(x) sample( x, size=length(x), replace=FALSE ) | |
610 | # $Id: quantcut.R,v 1.4 2005/06/09 14:20:29 nj7w Exp $ | |
611 | ||
612 | quantcut <- function(x, q=seq(0,1,by=0.25), na.rm=TRUE, ... ) | |
613 | { | |
614 | quant <- quantile(x, q, na.rm=na.rm) | |
615 | dups <- duplicated(quant) | |
616 | if(any(dups)) | |
617 | { | |
618 | flag <- x %in% unique(quant[dups]) | |
619 | retval <- ifelse(flag, | |
620 | paste("[", | |
621 | as.character(x), | |
622 | "]", | |
623 | sep=''), | |
624 | NA) | |
625 | uniqs <- unique(quant) | |
626 | ||
627 | # move cut points over a bit... | |
628 | reposition <- function(cut) | |
629 | { | |
630 | flag <- x>=cut | |
631 | if(sum(flag)==0) | |
632 | return(cut) | |
633 | else | |
634 | return(min(x[flag], na.rm=na.rm)) | |
635 | } | |
636 | ||
637 | newquant <- sapply(uniqs, reposition) | |
638 | retval[!flag] <- as.character(cut(x[!flag], | |
639 | breaks=newquant, | |
640 | include.lowest=TRUE,...)) | |
641 | ||
642 | levs <- unique(retval[order(x)]) # ensure factor levels are | |
643 | # properly ordered | |
644 | retval <- factor(retval, levels=levs) | |
645 | ||
646 | ## determine open/closed interval ends | |
647 | mkpairs <- function(x) # make table of lower, upper | |
648 | sapply(x, | |
649 | function(y) if(length(y)==2) y[c(2,2)] else y[2:3] | |
650 | ) | |
651 | pairs <- mkpairs(strsplit(levs, '[^0-9+\\.\\-]+', extended=TRUE)) | |
652 | rownames(pairs) <- c("lower.bound","upper.bound") | |
653 | colnames(pairs) <- levs | |
654 | ||
655 | closed.lower <- rep(F,ncol(pairs)) # default lower is open | |
656 | closed.upper <- rep(T,ncol(pairs)) # default upper is closed | |
657 | closed.lower[1] <- TRUE # lowest interval is always closed | |
658 | ||
659 | for(i in 2:ncol(pairs)) # open lower interval if above singlet | |
660 | if(pairs[1,i]==pairs[1,i-1] && pairs[1,i]==pairs[2,i-1]) | |
661 | closed.lower[i] <- FALSE | |
662 | ||
663 | for(i in 1:(ncol(pairs)-1)) # open upper inteval if below singlet | |
664 | if(pairs[2,i]==pairs[1,i+1] && pairs[2,i]==pairs[2,i+1]) | |
665 | closed.upper[i] <- FALSE | |
666 | ||
667 | levs <- ifelse(pairs[1,]==pairs[2,], | |
668 | pairs[1,], | |
669 | paste(ifelse(closed.lower,"[","("), | |
670 | pairs[1,], | |
671 | ",", | |
672 | pairs[2,], | |
673 | ifelse(closed.upper,"]",")"), | |
674 | sep='') | |
675 | ) | |
676 | levels(retval) <- levs | |
677 | } | |
678 | else | |
679 | retval <- cut( x, quant, include.lowest=TRUE, ... ) | |
680 | return(retval) | |
681 | } | |
682 | # $Id: running.R,v 1.12 2005/06/09 14:20:29 nj7w Exp $ | |
683 | ||
684 | "running" <- function(X, Y=NULL, | |
685 | fun=mean, | |
686 | width=min(length(X), 20), | |
687 | allow.fewer=FALSE, pad=FALSE, | |
688 | align=c("right", "center", "left"), | |
689 | simplify=TRUE, | |
690 | by, # added a parameter | |
691 | ...) | |
692 | { | |
693 | align=match.arg(align) | |
694 | ||
695 | n <- length(X) | |
696 | ||
697 | if (align=="left") | |
698 | { | |
699 | from <- 1:n | |
700 | to <- pmin( (1:n)+width-1, n) | |
701 | } | |
702 | else if (align=="right") | |
703 | { | |
704 | from <- pmax( (1:n)-width+1, 1) | |
705 | to <- 1:n | |
706 | } | |
707 | else #align=="center" | |
708 | { | |
709 | from <- pmax((2-width):n,1) | |
710 | to <- pmin(1:(n+width-1),n) | |
711 | if(!odd(width)) stop("width must be odd for center alignment") | |
712 | ||
713 | } | |
714 | ||
715 | elements <- apply(cbind(from, to), 1, function(x) seq(x[1], x[2]) ) | |
716 | ||
717 | if(is.matrix(elements)) | |
718 | elements <- as.data.frame(elements) # ensure its a list! | |
719 | ||
720 | names(elements) <- paste(from,to,sep=':') | |
721 | ||
722 | if(!allow.fewer) | |
723 | { | |
724 | len <- sapply(elements, length) | |
725 | skip <- (len < width) | |
726 | } | |
727 | else | |
728 | { | |
729 | skip <- 0 | |
730 | } | |
731 | ||
732 | ||
733 | run.elements <- elements[!skip] | |
734 | ||
735 | if(!invalid(by)) | |
736 | run.elements <- run.elements[seq(from=1, to=length(run.elements), | |
737 | by=by)] | |
738 | ||
739 | ||
740 | if(is.null(Y)) # univariate | |
741 | { | |
742 | funct <- function(which,what,fun,...) fun(what[which],...) | |
743 | ||
744 | if(simplify) | |
745 | Xvar <- sapply(run.elements, funct, what=X, fun=fun, ...) | |
746 | else | |
747 | Xvar <- lapply(run.elements, funct, what=X, fun=fun, ...) | |
748 | } | |
749 | else # bivariate | |
750 | { | |
751 | funct <- function(which,XX,YY,fun,...) fun(XX[which],YY[which], ...) | |
752 | ||
753 | if(simplify) | |
754 | Xvar <- sapply(run.elements, funct, XX=X, YY=Y, fun=fun, ...) | |
755 | else | |
756 | Xvar <- lapply(run.elements, funct, XX=X, YY=Y, fun=fun, ...) | |
757 | } | |
758 | ||
759 | ||
760 | if(allow.fewer || !pad) | |
761 | return(Xvar) | |
762 | ||
763 | if(simplify) | |
764 | if(is.matrix(Xvar)) | |
765 | { | |
766 | wholemat <- matrix( new(class(Xvar[1,1]), NA), | |
767 | ncol=length(to), nrow=nrow(Xvar) ) | |
768 | colnames(wholemat) <- paste(from,to,sep=':') | |
769 | wholemat[,-skip] <- Xvar | |
770 | Xvar <- wholemat | |
771 | } | |
772 | else | |
773 | { | |
774 | wholelist <- rep(new(class(Xvar[1]),NA),length(from)) | |
775 | names(wholelist) <- names(elements) | |
776 | wholelist[ names(Xvar) ] <- Xvar | |
777 | Xvar <- wholelist | |
778 | } | |
779 | ||
780 | return(Xvar) | |
781 | } | |
782 | ||
783 | # $Id: scat.R,v 1.2 2005/06/09 14:20:29 nj7w Exp $ | |
784 | ||
785 | # cat to stdout and immediately flush | |
786 | scat <- function(...) | |
787 | { | |
788 | DEBUG <- options()$DEBUG | |
789 | if( !is.null(DEBUG) && DEBUG) | |
790 | { | |
791 | cat("### ", file=stderr()) | |
792 | cat(..., file=stderr()) | |
793 | cat(" ###\n", file=stderr()) | |
794 | flush(stderr()) | |
795 | } | |
796 | invisible(NULL) | |
797 | } | |
798 | setTCPNoDelay <- function( socket, value=TRUE ) | |
799 | { | |
800 | if(!any(c("socket","sockconn") %in% class(socket))) | |
801 | stop("socket must be a socket object") | |
802 | ||
803 | buffer <- paste(rep(" ", 1000), sep='', collapse='') | |
804 | ||
805 | conn <- getConnection(socket[1]) | |
806 | ||
807 | retval <- .C("R_setTCPNoDelay", | |
808 | socket=as.integer(socket[1]), | |
809 | flag=as.integer(value), | |
810 | status=integer(1), | |
811 | status.str=as.character(buffer), | |
812 | status.len=as.integer(nchar(buffer)), | |
813 | package="gtools" | |
814 | ) | |
815 | ||
816 | if(retval$status != 0) | |
817 | stop( retval$status.str ) | |
818 | else | |
819 | invisible(retval$status.str) | |
820 | } | |
821 | ||
822 | strmacro <- function(..., expr, strexpr) | |
823 | { | |
824 | if(!missing(expr)) | |
825 | strexpr <- deparse(substitute(expr)) | |
826 | ||
827 | a <- substitute(list(...))[-1] | |
828 | ||
829 | nn <- names(a) | |
830 | if (is.null(nn)) | |
831 | nn <- rep("", length(a)) | |
832 | for(i in 1:length(a)) | |
833 | { | |
834 | if (nn[i] == "") | |
835 | { | |
836 | nn[i] <- paste(a[[i]]) | |
837 | msg <- paste(a[[i]], "not supplied") | |
838 | a[[i]] <- substitute(stop(foo), | |
839 | list(foo = msg)) | |
840 | } | |
841 | else | |
842 | { | |
843 | a[[i]] <- a[[i]] | |
844 | } | |
845 | #if (nn[i] == "DOTS") | |
846 | # { | |
847 | # nn[i] <- "..." | |
848 | # a[[i]] <- formals(function(...){})[[1]] | |
849 | # } | |
850 | } | |
851 | names(a) <- nn | |
852 | a <- as.list(a) | |
853 | ||
854 | ## this is where the work is done | |
855 | ff <- | |
856 | function(...) | |
857 | { | |
858 | ## build replacement list | |
859 | reptab <- a # copy defaults first | |
860 | reptab$"..." <- NULL | |
861 | #reptab$DOTS <- "" | |
862 | ||
863 | args <- match.call(expand.dots=TRUE)[-1] | |
864 | #print(args) | |
865 | ||
866 | for(item in names(args)) | |
867 | ##if(item %in% names(reptab)) | |
868 | reptab[[item]] <- args[[item]] | |
869 | ##else | |
870 | ## { | |
871 | ## browser() | |
872 | ## oldval <- reptab[["DOTS"]] | |
873 | ## addval <- paste(item, "=", args[[item]]) | |
874 | ## if(oldval>"") | |
875 | ## newval <- paste(c(oldval, addval), collapse=", ") | |
876 | ## else | |
877 | ## newval <- addval | |
878 | ## reptab[["DOTS"]] <- newval | |
879 | ## } | |
880 | ||
881 | #print(reptab) | |
882 | ||
883 | ## do the replacements | |
884 | body <- strexpr | |
885 | for(i in 1:length(reptab)) | |
886 | { | |
887 | pattern <- paste("\\b", | |
888 | names(reptab)[i], | |
889 | "\\b",sep='') | |
890 | ||
891 | value <- reptab[[i]] | |
892 | if(missing(value)) | |
893 | value <- "" | |
894 | ||
895 | body <- gsub(pattern, | |
896 | value, | |
897 | body, | |
898 | extended=TRUE) | |
899 | } | |
900 | ||
901 | #print(body) | |
902 | ||
903 | fun <- parse(text=body) | |
904 | eval(fun, parent.frame()) | |
905 | ||
906 | ||
907 | } | |
908 | ||
909 | ||
910 | ||
911 | ## add the argument list | |
912 | formals(ff) <- a | |
913 | ||
914 | ## create a fake source attribute | |
915 | mm <- match.call() | |
916 | mm$expr <- NULL | |
917 | mm[[1]] <- as.name("macro") | |
918 | attr(ff, "source") <- c(deparse(mm), strexpr) | |
919 | ||
920 | ## return the 'macro' | |
921 | ff | |
922 | } | |
923 | ||
924 | ||
925 | ||
926 |
0 | gtools (2.2.3-1) unstable; urgency=low | |
1 | ||
2 | * New upstream release | |
3 | ||
4 | * debian/rules: No longer call R to update html index | |
5 | ||
6 | -- Dirk Eddelbuettel <edd@debian.org> Wed, 21 Dec 2005 18:22:09 -0600 | |
7 | ||
0 | 8 | gtools (2.2.2-1) unstable; urgency=low |
1 | 9 | |
2 | 10 | * New upstream release |
8 | 8 | |
9 | 9 | case "$1" in |
10 | 10 | configure) |
11 | if test -x /usr/bin/R; then | |
12 | /usr/bin/R CMD perl /usr/lib/R/share/perl/build-help.pl --htmllists | |
13 | fi | |
11 | # if test -x /usr/bin/R; then | |
12 | # /usr/bin/R CMD perl /usr/lib/R/share/perl/build-help.pl --htmllists | |
13 | # fi | |
14 | 14 | ;; |
15 | 15 | abort-upgrade|abort-remove|abort-deconfigure) |
16 | 16 | ;; |
8 | 8 | |
9 | 9 | case "$1" in |
10 | 10 | upgrade|remove|purge) |
11 | if test -x /usr/bin/R; then | |
12 | /usr/bin/R CMD perl /usr/lib/R/share/perl/build-help.pl --htmllists | |
13 | fi | |
11 | # if test -x /usr/bin/R; then | |
12 | # /usr/bin/R CMD perl /usr/lib/R/share/perl/build-help.pl --htmllists | |
13 | # fi | |
14 | 14 | ;; |
15 | 15 | failed-upgrade|abort-install|abort-upgrade|disappear) |
16 | 16 | ;; |
Binary diff not shown
0 | DLLLIBS:=$(DLLLIBS) -lwsock32 |
0 | 0 | #include <R.h> |
1 | 1 | #include <Rinternals.h> |
2 | 2 | |
3 | #include <sys/types.h> | |
4 | #include <sys/socket.h> | |
5 | #include <netinet/in.h> | |
3 | # include <sys/types.h> | |
4 | ||
5 | #ifdef WIN32 | |
6 | # include <winsock2.h> | |
7 | /*#include <gnuwin32.h>*/ | |
8 | #else | |
9 | # include <sys/socket.h> | |
10 | # include <netinet/in.h> | |
11 | #endif | |
12 | ||
6 | 13 | #include <errno.h> |
7 | 14 | |
8 | 15 | #define TCP_NODELAY 1 |
16 | ||
17 | ||
18 | /* Macro to: | |
19 | 1: Check if the constant is defined. If not, omit. | |
20 | 2: Generate a case statement for the constant, which creates a | |
21 | string error description constructed from the constant name and | |
22 | the supplied error message. | |
23 | */ | |
24 | #define CASE_ERR(ERRNO, DESCR) | |
25 | #ifdef ERRNO | |
26 | case ERRNO | |
27 | strncpy( status_str, | |
28 | ERRNO ":" DESCR, | |
29 | status_len); | |
30 | break; | |
31 | #endif | |
32 | ||
33 | ||
9 | 34 | |
10 | 35 | /* Convert integer status into a string error code */ |
11 | 36 | void checkStatus(int status, |
12 | 37 | char* status_str, |
13 | 38 | int status_len) |
14 | 39 | { |
40 | ||
15 | 41 | status_len = status_len>1000?1000:status_len; |
16 | 42 | |
17 | 43 | switch(status) |
18 | 44 | { |
19 | case EBADF: | |
20 | strncpy( status_str, | |
21 | "EBADF: Invalid descriptor.", | |
22 | status_len); | |
23 | break; | |
24 | case ENOTSOCK: | |
25 | strncpy( status_str, | |
26 | "ENOTSOCK: Descriptor is a file, not a socket.", | |
27 | status_len); | |
28 | break; | |
29 | case ENOPROTOOPT: | |
30 | strncpy( status_str, | |
31 | "ENOPROTOOPT: The option is unknown at the level indicated.", | |
32 | status_len); | |
33 | break; | |
34 | case EFAULT: | |
35 | strncpy( status_str, | |
36 | "EFAULT: invalid pointer", | |
37 | status_len); | |
38 | break; | |
39 | case EINVAL: | |
40 | strncpy( status_str, | |
41 | "EINVAL: optlen invalid in setsockopt", | |
42 | status_len); | |
43 | break; | |
45 | ||
46 | /* Unix messages */ | |
47 | CASE_ERR(EBADF, "Invalid descriptor."); | |
48 | CASE_ERR(ENOTSOCK, "Descriptor is a file, not a socket."); | |
49 | CASE_ERR(ENOPROTOOPT, "The option is unknown at the level indicated."); | |
50 | CASE_ERR(EFAULT, "invalid pointer"); | |
51 | CASE_ERR(EINVAL, "optlen invalid in setsockopt"); | |
52 | ||
53 | /* Windows messages */ | |
54 | CASE_ERR(WSANOTINITIALISED, "A successful WSAStartup call must occur before using this function."); | |
55 | CASE_ERR(WSAENETDOWN, "The network subsystem has failed."); | |
56 | CASE_ERR(WSAEFAULT, "optval is not in a valid part of the process address space or optlen parameter is too small."); | |
57 | CASE_ERR(WSAEINPROGRESS, "A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function."); | |
58 | CASE_ERR(WSAEINVAL, "level is not valid, or the information in optval is not valid."); | |
59 | CASE_ERR(WSAENETRESET, "onnection has timed out when SO_KEEPALIVE is set."); | |
60 | CASE_ERR(WSAENOPROTOOPT, "he option is unknown or unsupported for the specified provider or socket (see SO_GROUP_PRIORITY limitations)."); | |
61 | CASE_ERR(WSAENOTCONN, "Connection has been reset when SO_KEEPALIVE is set."); | |
62 | CASE_ERR(WSAENOTSOCK, "The descriptor is not a socket."); | |
63 | ||
44 | 64 | case 0: |
45 | 65 | strncpy( status_str, |
46 | 66 | "SUCCESS", |
47 | 67 | status_len); |
48 | 68 | break; |
69 | ||
49 | 70 | default: |
50 | 71 | strncpy(status_str, strerror(status), status_len); |
51 | 72 | break; |
52 | 73 | } |
53 | 74 | |
54 | status_str[status_len-1] = 0x0; /* Just in case */ | |
75 | status_str[status_len-1] = 0x0; /* Just in case... */ | |
55 | 76 | } |
77 | ||
56 | 78 | |
57 | 79 | /* Function to de-nagle a TCP socket connection */ |
58 | 80 | void R_setTCPNoDelay(int *socket, |
79 | 101 | |
80 | 102 | return; |
81 | 103 | } |
82 | ||
83 | 104 | |
84 | 105 | /* function to check socket options */ |
85 | 106 | /* NOT USED... |