Re: [R] Function for displaying arbitrary text as in 'help'.

2019-01-02 Thread Duncan Murdoch
because of all the possible ways to display help. You might be able to adapt it to your own needs, though it won't be trivial. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo

Re: [R] Function for displaying arbitrary text as in 'help'.

2019-01-02 Thread Duncan Murdoch
ystem; maybe it will be good enough. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide

Re: [R] Function for displaying arbitrary text as in 'help'.

2019-01-02 Thread Duncan Murdoch
is possible to have dynamic content in help pages. Web pages (e.g. generated using R-markdown or Shiny) are even more flexible for content, but maybe not meeting your requirement for displaying in an ESS buffer or Linux terminal window. Duncan Murdoch El mié., 2 ene. 2019 a las 14:31, Jeff

Re: [R] Accessing Data Frame

2019-01-03 Thread Duncan Murdoch
{ which(deck$face == card$face & deck$suit == card$suit & deck$value = card$value) } removeCard <- function(deck, card) { deck[-whichCard(deck, card), ] } deck <- removeCard(deck, topCard) Duncan Murdoch Benoit Jeff Newmiller a écrit : In my programmer's head, something

Re: [R] Accessing Data Frame

2019-01-03 Thread Duncan Murdoch
rd is always produced by subsetting the deck. If a user does something like topCard <- data.frame(face = "queen", suit = "spades", value = 12) then the rownames won't match, and removing topCard will remove the wrong one. Duncan Murdoch Benoit Jeff Newmille

Re: [R] Why does R do this?

2019-01-08 Thread Duncan Murdoch
entries. Follow Thierry's advice, and don't use which() unless you really need a vector of indices, and are prepared for an empty one. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/m

Re: [R] Diff'ing 2 strings

2019-01-10 Thread Duncan Murdoch
so ?tools::Rdiff should get what you want even in that version. But as you note, it isn't a general purpose diff for character vectors, it is targeted at comparing R output files. Duncan Murdoch - Original Message - From: "Jeff Newmiller" To: r-help@r-projec

Re: [R] User Interfaces for R

2019-01-10 Thread Duncan Murdoch
1439856826) describes the major R packages for GUI programming: RGtk2, qtbase, Tcl/Tk, and gWidgets. That book was published in 2012, and things have moved on since then. Eric's suggestion of Shiny is newer, and is a really well-designed system. A fairly steep learning curve, but wor

Re: [R] Was there a change to R ver. 3.5.2 so that it now treats warnings during installs as errors?

2019-01-20 Thread Duncan Murdoch
: (converted from warning) installation of package ‘/tmp/Rtmp4hnMMO/file7fb929638ed8/gGnome_0.1.tar.gz’ had non-zero exit status That message indicates that options("warn") is 2 or higher when the warning occurs. What is its setting before you start the install? Duncan Murdoch __

Re: [R] Function in default parameter value closing over variables defined later in the enclosing function

2019-01-23 Thread Duncan Murdoch
InsideFn) { defaultInsideFn <- function() print(secret) secret <- 'secret' inside() } which is essentially equivalent, other than having a shorter header on the outside() function. Duncan Murdoch __ R-help@r-project.org mailing li

Re: [R] Function in default parameter value closing over variables defined later in the enclosing function

2019-01-23 Thread Duncan Murdoch
would fail, because even though secret is defined in the caller of g() and is therefore in the call stack, that's irrelevant: it's not in g's evaluation frame (which has no variables) or its parent (which is the global environment if those definitions were evaluated there). Dun

Re: [R] Packages

2019-01-23 Thread Duncan Murdoch
attach the packages, you haven't told R to look in the alternate location. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-

Re: [R] Packages

2019-01-23 Thread Duncan Murdoch
r message). Perhaps the mirror you used doesn't have it? I'd recommend using the cloud.r-project.org mirror rather than a local one in almost any case. In any case, Neal's advice to update R is likely to make your life a lot easier. Duncan Murdoch > install.packages(&q

Re: [R] Why is there error in as.POSIXlt.character when using strftime()?

2019-02-02 Thread Duncan Murdoch
;16:00" "16:46" "16:51" "17:35" "17:59" "18:17" "19:07" "19:08" [18] "19:31" "21:21" "06:00" "06:20" "06:37" "06:40" "06:46" "07:20" "07:4

Re: [R] [FORGED] I'm Working On A Data Security Article - Quick Question

2019-02-11 Thread Duncan Murdoch
x27;s asking about. There are probably thousands of them. Duncan Murdoch Personally I haven't got a clue what you are asking. Also, please note that r-help is a world wide "community" with hundreds of thousands of members. (I am but one of this large and unruly mob.) It

Re: [R] Ghost variables

2019-02-25 Thread Duncan Murdoch
by running options(warn=2) before your script, and then the script will die at the first warning. Duncan Murdoch On 25/02/2019 3:45 p.m., jlu...@ria.buffalo.edu wrote: The script is complete. When I start, the environment is empty. The warnings are issued for these "ghost" variable

Re: [R] Replacing each NA with the most recent non-NA prior to it

2019-02-26 Thread Duncan Murdoch
There are at least two packages (zoo and imputeTS) which have na.locf functions. The one in zoo does what you want: > zoo::na.locf(c(NA,NA,1,4,NA,2), na.rm=FALSE) [1] NA NA 1 4 4 2 Duncan Murdoch __ R-help@r-project.org mailing list -- To UNS

Re: [R] Error trapping in R

2019-02-27 Thread Duncan Murdoch
someOtherFunction(y) }) if (inherits(value, "try-error")) { cat ("something went wrong. There's information in value about what happened.") } else { cat ("value is fine, there was no error.") } Duncan Murdoch

Re: [R] profvis function parse_rprof not being loaded

2019-02-28 Thread Duncan Murdoch
can get to it using profvis:::parse_rprof, but the maintainer (who is cc'd) might want to fix this. Duncan Murdoch Documentation for package ‘profvis’ version 0.3.5 DESCRIPTION file. Help Pages parse_rprof Parse Rprof output file for use with profvis pause Pause an R process print.pr

Re: [R] add points to lattice cloud plot (3D scatter)

2019-02-28 Thread Duncan Murdoch
plot3d or related functions, but you'll need to do more work yourself to get an array of plots like lattice gives. Duncan Murdoch Thank you df = data.frame(Name = c("A", "B", "C", "D", "E"), x_axis = c(-0.59

Re: [R] Remove Even Number from A Vector

2019-03-03 Thread Duncan Murdoch
dataset of restaurant sales. Not a native English speaker here; what exactly do you mean by "odd" in this case? "Odd" numbers have a remainder of 1 when divided by 2; "even" numbers are multiples of 2. Duncan Murdoch If I ignore the "subject" field, it look

Re: [R] [FORGED] Q re: logical indexing with is.na

2019-03-10 Thread Duncan Murdoch
identical(x, y) takes about 5 milliseconds when the difference comes last, but 0.006 milliseconds when it comes first. Of course, all(x == y) and identical(x, y) do slightly different tests: read the docs! Duncan Murdoch Thanks again! DLG On Sat, Mar 9, 2019 at 9:07 PM Jeff Newmiller wro

Re: [R] rgl.postscript hang

2019-03-10 Thread Duncan Murdoch
vely. So far I haven't been patient enough to know what x <- (-90:90)/5 would take. This doesn't really make sense: with x <- (-n:n)/5 it will need to sort (2n + 1)^2 objects, but that should take something proportional to n^2 log(n) time, and the time seems to be growing faste

Re: [R] Installing package into...

2019-03-12 Thread Duncan Murdoch
tal message. But, is there a way to do a cleaner installation without getting such message? Thanks. Have you tried specifying the library? Then R wouldn't tell you its guess. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE

Re: [R] Global counter in library

2019-03-12 Thread Duncan Murdoch
counter best implemented? Use the Rdsm package. See ?Rdsm::Rdsm for help. Duncan Murdoch Here is a basic sketch of what I tried: library(parallel) library(flock) ## begin of code in package tmp <- tempfile() .localstuff <- new.env() .localstuff$N <- 0 .localstuff$tmp <- temp

Re: [R] ?grid::grid-package doesn't find the grid-package help page

2019-03-18 Thread Duncan Murdoch
On 18/03/2019 1:00 p.m., Jeff Newmiller wrote: Try ?grid::`grid-package` The "-" is not a legal character in a bare symbol. Or package?grid::grid which makes use of the rarely used "type" argument to "?". Duncan Murdoch On March 18, 2019 9:35:17 AM PDT, Wi

Re: [R] Fw: problem with nlsLM function

2019-03-19 Thread Duncan Murdoch
nd HM3 are predictors. The problem is I get the same error even when I use nlsLM(in the minpack.lm package): nonlin_modDH5 <- nlsLM(formulaDH5, start = list(a = 0.43143, b = 2,A = 0.09,w = 0.8,a = 0.01,C = 0.94)) You have "a" twice in your start list. That's bound to caus

Re: [R] Unable to read csv files with comma in values

2019-04-07 Thread Duncan Murdoch
;\\[|\\]', '"', readLines(f)) %>% read.csv(text = ., check.names = FALSE) }) tmp2 <- tmp1 %>% bind_rows(.id = "id") tmp3 <- tmp2 %>% select(id, User, Rule) tbl <- tmp3 %>% distinct() (You don't need p

Re: [R] Convert a character to numeric

2019-04-09 Thread Duncan Murdoch
7;t think of anything more sensible to do with NA values. You may also have character strings that cannot be converted into numbers, which will also generate NA values. I think that's the only way that message will appear. Duncan Murdoch Maybe a little example will help us to understan

Re: [R] Can one perform a dry run of a package installation?

2019-04-09 Thread Duncan Murdoch
interested in finding how dependencies would be recursively updated to newer versions. Set the `lib` parameter of `install.packages` to an empty directory, and see what gets installed there. Duncan Murdoch __ R-help@r-project.org mailing list -- To

Re: [R] Windows R doesn't recognize shortcuts ?

2014-07-23 Thread Duncan Murdoch
"a.R" "aa.sh" I don't think R should recognize that. Windows wouldn't recognize it either, if you used "dir cygwin" in a shell, for example. Duncan Murdoch __ R-help@r-project.o

Re: [R] shading cells in a latex table by value

2014-07-23 Thread Duncan Murdoch
t;- as.tabular(mat, like=tabular(Heading()*row ~ Heading()*col*Format(myformat()), data=data.frame(row=rep(letters[1:3],4), col=rep(LETTERS[1:4],3 latex(tab) produces \begin{tabular}{lcccc} \hli

Re: [R] A question about call()

2014-07-24 Thread Duncan Murdoch
> So, how i can figure out this question? In this case they deparse the same, but in other cases they wouldn't, e.g. call("mean", rnorm(10)) appears quite different from call("mean", quote(rnorm(10))) The difference is when the evaluation takes place. Which shoul

Re: [R] Set Conditional Breakpoint with setBreakpoint Function

2014-07-25 Thread Duncan Murdoch
? >I use the setBreakpoint function in combination with findLineNum for a >simple R debugging GUI. >Thank in advance for any help The conditional in the trace example is the tracer argument. setBreakpoint also has a tracer argument; have you tried that? E.g. setBreakpo

Re: [R] How to modify the body of a function?

2014-07-27 Thread Duncan Murdoch
> Results > } > I tend to agree with you, but wanted to point out a third possibility: Myfun <- function() { { a few lines of code} if (condition) { something } else { {Many, many lines of code} something.else } } In some sense this is the most "R

Re: [R] is.na() == TRUE for POSIXlt time / date of "2014-03-09 02:00:00"

2014-07-30 Thread Duncan Murdoch
, min = 0L, hour = 2, mday = 9L, mon = 2L, year = 114L, wday = 0L, yday = 67L, isdst = 0L, zone = "", gmtoff = NA_integer_), .Names = c("sec", "min", "hour", "mday", "mon", "year", "wday", "yday", "isdst

Re: [R] a knitr question

2014-07-30 Thread Duncan Murdoch
ld not have existed in the first place if we do > not include prompts at all. I'm not sure if it makes much sense to > create some mess and clean it afterwards. > So your suggestion is that the R console should not prompt for input? Do you know of *any* interactive system which d

Re: [R] a knitr question

2014-07-30 Thread Duncan Murdoch
On 30/07/2014, 8:06 PM, Joshua Wiley wrote: > On Thu, Jul 31, 2014 at 9:47 AM, Duncan Murdoch > mailto:murdoch.dun...@gmail.com>> wrote: > > On 30/07/2014, 2:20 PM, Yihui Xie wrote: > > As a reader, I often want to run the code by myself _while_ I'm > &

Re: [R] a knitr question

2014-07-31 Thread Duncan Murdoch
ginners if the document looks the same as what they see in the console. More sophisticated users don't need the prompts. Duncan Murdoch > > Regards, > Yihui > -- > Yihui Xie > Web: http://yihui.name > > > On Wed, Jul 30, 2014 at 6:47 PM, Duncan Murdoch > wrote: &

Re: [R] Need(?) way to create a "picture" (or "plot") of a data.frame

2014-07-31 Thread Duncan Murdoch
n the plotrix package which allow you to display multiple lines of text; use capture.output() to save what was printed, then textbox() to add it to a plot. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-he

Re: [R] Need(?) way to create a "picture" (or "plot") of a data.frame

2014-07-31 Thread Duncan Murdoch
On 31/07/2014, 8:06 AM, Duncan Murdoch wrote: > On 31/07/2014, 7:49 AM, John McKown wrote: >> OK, I'm probably using the wrong tool for this, but I'm doing >> everything else in this project in R, so I'm looking at how to do this >> too. I create a number of

Re: [R] installing package 'rqpd' (Regression quantiles for panel data) on windows

2014-08-01 Thread Duncan Murdoch
This appears to be an R-forge bug, because it will build from source without error. You should report this to R-forge. In the meantime, use type="source" when you do the install. You shouldn't need any special tools to do this, since it's a

Re: [R] installing package 'rqpd' (Regression quantiles for panel data) on windows

2014-08-01 Thread Duncan Murdoch
On 01/08/2014 9:50 AM, Prof Brian Ripley wrote: On 01/08/2014 14:31, Duncan Murdoch wrote: > On 01/08/2014 7:48 AM, Roy Sasson wrote: >> hello R community, >> i am trying to install rqpd package on windows, using the following >> command: >> >> install.packag

Re: [R] How to change print behaviour within a markdown document

2014-08-02 Thread Duncan Murdoch
led by the style sheet. You need to find how rmarkdown sets that, and change it. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posti

Re: [R] "no visible binding for global variable" and with() vs. within()

2014-08-17 Thread Duncan Murdoch
in() is newer, and it was less disruptive to warn about it, so the warning has been left in. (I don't remember whether the test came before or after within() was introduced.) So if you want to avoid the warning, don't use within(). Duncan Murdoch > > R version 3.1.1 (2014-07-

Re: [R] BNF description for R

2014-08-17 Thread Duncan Murdoch
On 16/08/2014, 7:32 PM, kevin2059 wrote: > HOW can I get a completely BNF description for R? I try to write a parser > for R now. The R grammar is defined in the src/main/gram.y file (in Bison format). You can get that file from https://svn.r-project.org/R/trunk/src/main/gram.y.

Re: [R] Making my own graphics device

2014-08-17 Thread Duncan Murdoch
at the grDevices >> section of the R source code (src/library/grDevices/src) >> until I figure out how it works. >> >> In case you're curious, I want to make a graphics device >> that saves the graph in Hewlett-Packard Graph

Re: [R] About radial.labels in plotrix

2014-08-18 Thread Duncan Murdoch
a", lwd = 2, start=1.56, clockwise = T) From the help page, it looks as though radial.labels should allow you to set that. You didn't post any data to demonstrate with, but I would assume it'

Re: [R] About radial.labels in plotrix

2014-08-18 Thread Duncan Murdoch
mylim-data2[data2[,1]==sta,2:length(data2)], labels=c("N","NE","E","SE","S","SW","W","NW"), rp.type="p", radial.lim=c(0,1,2,3), radial

Re: [R] About radial.labels in plotrix

2014-08-18 Thread Duncan Murdoch
ot;) radial.plot( 40-data2[,2:length(data2)], labels=c("N","NE","E","SE","S","SW","W","NW"), rp.type="p", radial.lim=c(0,40), line.col="#648bda", lwd

Re: [R] loading saved files with objects in same names

2014-08-20 Thread Duncan Murdoch
I can even loop over RData files and read in all the `x`s into a vector: > > > sapply(c("f.RData","s.RData"),function(f){getFrom(f,"x")}) > f.RData s.RData > "first" "second" > > (on second thoughts, possibly '

Re: [R] knitr and stopifnot replacement.

2014-08-22 Thread Duncan Murdoch
een knitr and Sweave is that knitr handles errors, and Sweave doesn't. I expect there's some knitr option to tell it to quit in case of error (a hook?), but you'll have to check the documentation to find it. Duncan Murdoch __ R-help@r-project

Re: [R] loading saved files with objects in same names

2014-08-22 Thread Duncan Murdoch
h() will never accidentally destroy existing >> R objects in your global environment ( = search()[[1]] ). >> >> Martin >> > > Thanks a lot. > > I try your method, and I got: > > > attach("D2.1.RData

Re: [R] rgl zooming to an arbitrary location

2014-09-01 Thread Duncan Murdoch
his a little simpler in the next major release, but no definite release date. Duncan Murdoch > > ## > # EXAMPLE CODE > ## > library(rgl) > # Make up some topography > x=runif(1e+06, min=0,max=1000) &

[R] Detect expired RSQLiteConnection?

2014-09-02 Thread Duncan Murdoch
save the workspace and then reload it, I get the expired connection.) I'd like to detect this case. Do I need to use try(), or parse the result of printing it? Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-

Re: [R] frequencies of a discrete numeric variable, including zeros

2014-09-02 Thread Duncan Murdoch
t override the include.lowest argument, the bars are for intervals [0,1], (1,2], (2,3], etc, i.e. the leftmost one includes its left end, but none of the others do. As Marc said, barplot is what you want, but you need to declare your data to be a factor to include all the levels. Duncan Murdoch &

Re: [R] Detect expired RSQLiteConnection?

2014-09-02 Thread Duncan Murdoch
On 02/09/2014, 5:28 PM, David Winsemius wrote: > > On Sep 2, 2014, at 5:32 AM, Duncan Murdoch wrote: > >> Is there a test for an expired RSQLiteConnection? For example, if I run >> >> library(RSQLite) >> f <- tempfile() >> con <- dbConnect(SQLite()

Re: [R] Simulating from a Weibull distribution

2014-09-02 Thread Duncan Murdoch
er used the random > generators that come pre-programmed in R. > > Is there a package or example someone can point me to that demonstrates how > to simulate data from any given distribution? That's the same distribution, just with the parameters specified differently. Th

Re: [R] Overwriting a procedure

2014-09-03 Thread Duncan Murdoch
namespace first, regardless of the search path. Duncan Murdoch > > As an aside, you can define your first version of fixx() more simply as > > fixx <- function(x) list(x=x) > > and the second more simply as > > fixx <- function(x) { > x[,6]<-x[,5]^2/10

Re: [R] Operator proposal: %between%

2014-09-04 Thread Duncan Murdoch
) would give this result, but it doesn't do so now. (I'm not saying you *should* rewrite it like that, but it's something you should consider.) Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinf

Re: [R] citation of a task view

2014-09-04 Thread Duncan Murdoch
hatever format your journal requires for citing any web page, e.g. something like Lewin-Koh, Nicholas (2013). CRAN Task View: Graphic Displays & Dynamic Graphics & Graphic Devices & Visualization. Web page with URL <http://cran.r-project.org/web/views/Bayesian.html>, ret

Re: [R] citation of a task view

2014-09-04 Thread Duncan Murdoch
On 04/09/2014 2:28 PM, Achim Zeileis wrote: On Thu, 4 Sep 2014, Duncan Murdoch wrote: > On 04/09/2014 4:52 AM, Dr. Pablo E. Verde wrote: >> Hi all, >> >> Which is a formal bibliography citation of an R's task view? For example >> if I want to make a cita

Re: [R] Operator proposal: %between%

2014-09-05 Thread Duncan Murdoch
precedence, so it is evaluated as (1 + 1) < (2 + 2). See the ?Syntax help page for the precedence rules. Some languages allow user-defined operators to be assigned a particular precedence, but in R the precedence is fixed. This means that user-defined operators are less readable than you mig

Re: [R] using edit to extract codes from vignette failed

2014-09-08 Thread Duncan Murdoch
is: Error in editor(file = file, title = title) : argument "name" is missing, with no default That appears to be an RStudio bug. edit(vignette("grobs",package = "grid")) works fine in R. You should report it to them. Duncan Murdoch -- PO SU mail: de

Re: [R] using edit to extract codes from vignette failed

2014-09-08 Thread Duncan Murdoch
On 08/09/2014 12:35 PM, Duncan Murdoch wrote: On 08/09/2014 12:21 PM, PO SU wrote: > Tks for correcting me not using the file argument, but the codes you supply seem still not work. > > edit(vignette("grobs",package = "grid")) can't work. > I am using win7

Re: [R] using edit to extract codes from vignette failed

2014-09-08 Thread Duncan Murdoch
On 08/09/2014 12:48 PM, Duncan Murdoch wrote: On 08/09/2014 12:35 PM, Duncan Murdoch wrote: > On 08/09/2014 12:21 PM, PO SU wrote: > > Tks for correcting me not using the file argument, but the codes you supply seem still not work. > > > > edit(vignette("grobs"

Re: [R] How to use multi paragraph comment like /* and */ in cpp?

2014-09-09 Thread Duncan Murdoch
the Code menu. (On my Mac the shortcut is C :-). Duncan Murdoch > > I would also suggest making more functions that are smaller. > --- > Jeff NewmillerThe . . Go Li

Re: [R] some question about vector[-NULL]

2014-09-10 Thread Duncan Murdoch
n't need to know whether b is null or not,but: > a[-NULL] can't work!! i just need a[-NULL]==a , how can i reach this purpose? Using !, and a logical test, e.g. a[!nullentry(a)] where nullentry() is a function based on one of the tests above, but applied to all entries. Duncan Murdoch _

Re: [R] some question about vector[-NULL]

2014-09-10 Thread Duncan Murdoch
cted (leaving out all the elements of i, i.e. nothing) if i is either of those. The solution is to use logical indexing, not negative numerical indexing. Duncan Murdoch Bill Dunlap TIBCO Software wdunlap tibco.com On Wed, Sep 10, 2014 at 8:53 AM, PO SU wrote: > > Tks for your > > a &

Re: [R] some question about vector[-NULL]

2014-09-11 Thread Duncan Murdoch
logical vector that long, then it's probably worthwhile checking the length of the integer index explicitly, i.e. instead of a <- a[ -i ] use if (any(i > 0)) a <- a[ -i ] Duncan Murdoch > I thought a way , > let d<-c(a,1) > that d<-c(1,2,3,4,5,1) > and in

Re: [R] some question about vector[-NULL]

2014-09-11 Thread Duncan Murdoch
on the efficiency of one operation over another. Duncan Murdoch > > > > > -- > > PO SU > mail: desolato...@163.com > Majored in Statistics from SJTU > > > > > At 2014-09-11 05:59:42, "PO SU" wrote: >> >> Orignally i don'

Re: [R] some question about vector[-NULL]

2014-09-11 Thread Duncan Murdoch
same as 0. Zero as an index selects nothing. Two zeroes also select nothing. What's the surprise? Duncan Murdoch Best, Philippe > Regards > Petr > > >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- >> p

Re: [R] Parliament Seats Graph

2014-09-12 Thread Duncan Murdoch
ta <- seq(0, pi, len = counts[i]) points(radii[i]*cos(theta), radii[i]*sin(theta)) N <- N - counts[i] } Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] cairo_pdf crashing R on Windows

2014-09-12 Thread Duncan Murdoch
ou'll do a lot of rebuilds until you track down the bug. I hope that helps. Remember, even completing step 1 will be very helpful for others. Actually tracking down and fixing the bug would be wonderful. Duncan Murdoch __ R-help@r-project.o

Re: [R] Generating unordered, with replacement, samples

2014-09-17 Thread Duncan Murdoch
se numbers into your original sample of k from n. For that you need to remember the derivation of that formula! Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-

Re: [R] Generating unordered, with replacement, samples

2014-09-17 Thread Duncan Murdoch
On 17/09/2014 3:07 PM, Duncan Murdoch wrote: On 17/09/2014 2:25 PM, Giovanni Petris wrote: > Hello, > > I am trying to interface in my teaching some elementary probability with Monte Carlo ideas. In sampling from a finite population, the number of distinct samples of size 'k'

Re: [R] Generating unordered, with replacement, samples

2014-09-17 Thread Duncan Murdoch
ere... I think this works, but you'd better check! Sample the placeholders: ind <- sort( sample(n + k -1, n-1) ) # I don't think sort() is necessary... Add placeholders at the start and end: ind <- c(0, ind, n+k) Take the diffs, and subtract one: diff(ind) - 1 I think this

Re: [R] Using R in our commercial business application

2014-09-18 Thread Duncan Murdoch
ing: not all distributions are built on the GPL'd original. I believe Tibco is selling an independent implementation. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting gu

Re: [R] See the numeric codes of a factor

2014-09-19 Thread Duncan Murdoch
s <- ifelse(var == 0, "Bad", ifelse(var == 1, "Good", NA)) values <- ifelse(words == "Bad", 0, ifelse(words == "Good", 1, NA)) Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

Re: [R] See the numeric codes of a factor

2014-09-19 Thread Duncan Murdoch
categories labelled. I think you are thinking of how you have done things in some other system. In R, a factor is fine in logistic regression, regardless of the fact that internally values are stored as 1 and 2. Duncan Murdo

Re: [R] A new environment within the main function

2014-09-21 Thread Duncan Murdoch
idea to post "minimal" examples; distractions are distracting. > > data.fr <- groupedData(y~-1 + x3 | g, > data=data.frame(y,x3,h, dummy)) What is groupedData? We also ask for self-contained examples, and that isn't in the default packages. A

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread Duncan Murdoch
} f1 <- makefsong() f1("I live on the second floor") f2 <- makefsong("muka") f2("I live on the second floor") Duncan Murdoch Thanks for your help! dan # Original Function fsong=function(x){ song=paste("my name is fuka,",x) return(song) }

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread Duncan Murdoch
[c(2,3,2)]] <- new But as Bill said, this is a really bad idea. If you just *think* about changing that fsong function, it will break. Duncan Murdoch Thanks again for the quick reply and help you are giving me! dan On Mon, Sep 22, 2014 at 10:37 AM, Duncan Murdoch wrote: > On 22/09/20

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread Duncan Murdoch
("fuka",body(nsong))]] > # though I believe > class(body(nsong)[[2]]) > [1] "=" > # is trying to give me a pretty blatant hint... {: -) Here's another hint: everything in R is a function call. You're looking at a call to the function named "=". Duncan

Re: [R] Copying tables from R to Excel

2014-09-23 Thread Duncan Murdoch
t was written, but the R2HTML package stopped exporting the HTML.matrix function at some point. Or maybe the author just never tried it.) Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the p

Re: [R] Copying tables from R to Excel

2014-09-24 Thread Duncan Murdoch
s not a dataframe or matrix. What you'll need to do to get this to work is to find out what class it is, and write an HTML. method to handle that class. It probably won't involve actually writing an HTML, it'll just be something like HTML. <- function(x, ...) { df <- < s

Re: [R] Rép : ANOVA and permutation tests : beware of traps

2014-09-24 Thread Duncan Murdoch
s not find the trap obvious ... Thus, my final question remains : How can we evaluate the reliability of CRAN packages that propose randomization (or bootstrap) methods ? The same way as you evaluate the reliability of any software: you examine the code for common errors, you apply tests

Re: [R] Masked from package

2014-09-24 Thread Duncan Murdoch
ilarly, you just loaded a function called "cor", so the one in NADA is hidden. (When you loaded NADA you probably got a warning that its "cor" was hiding the one in the stats package. So there are 3 "cor" functions now, and you really need to be car

Re: [R] Masked from package

2014-09-25 Thread Duncan Murdoch
The default method calls the stats::cor function. So in that sense it really does provide a kind of inheritance. Duncan Murdoch Note that packages that call "foo" will continue to find the versions they inten

Re: [R] draw piecharts or histograms at the points of a scatterplot

2014-09-29 Thread Duncan Murdoch
re complicated way would be to write the individual plots to .png files, and then use sprites3d() in rgl to plot those pictures at the point locations. (These are 2d sprites, not 3d sprites.) I'm not sure how good it would look: sprites tend to look blurry because of all the resizing that take

Re: [R] Custom Function Not Completely working

2014-09-29 Thread Duncan Murdoch
from the Rdata file into the evaluation frame of your function, and they go away afterwards. You need to specify where they should be loaded using the envir argument, e.g. load(paste0(filename,".Rdata"), envir = parent.frame()) (The funny thing here is that the default for envir is paren

Re: [R] Obtain 00Index.html

2014-09-30 Thread Duncan Murdoch
lable via tools:::httpdPort. (If that is 0, call tools::startDynamicHelp() to start it up.) -- PP is the name of the package whose index you want. You can look through the tools:::httpd function for other patterns. Duncan Murdoch __ R-help@r-pro

Re: [R] Inverse Student t-value

2014-09-30 Thread Duncan Murdoch
. Would you like to show me a manual calculation for this? Appreciate your helps in advance. That number looks pretty far off the true value. Have you got a typo in your example? You can compute the answer to your question as abs(qt(0.408831/2, df=1221)), but you'll get 4.117. D

Re: [R] Inverse Student t-value

2014-09-30 Thread Duncan Murdoch
e detail a manual equation. I really appreciate it if you may give more detail. I already gave you the expression: abs(qt(0.408831/2, df=1221)). For more detail, I suppose you could look at the help page for the qt function, using help("qt"). Duncan Murdoch Cheers! On Wed,

Re: [R] Inverse Student t-value

2014-09-30 Thread Duncan Murdoch
for TINV. Sorry, can't help. I'm not sure I understand what you want, but if it's a simple formula for quantiles of the t distribution, it doesn't exist. Duncan Murdoch Hope solve this problem. Cheers! On Wed, Oct 1, 2014 at 1:20 AM, Duncan Murdoch mailto:mu

Re: [R] a REALLY dumb question

2014-10-03 Thread Duncan Murdoch
_Like, y, mod, 0L, TRUE) refer to variables like C_ARIMA_Like, which are local to the package environment of stats. They aren't exported, so your function (which presumably has a different environment) can't see them. Duncan Murdoch __ R-

Re: [R] Removing description from lm()

2014-10-05 Thread Duncan Murdoch
(5,8,2,3)> lm(x~y) > Call: > lm(formula = x ~ y) > > Coefficients: > (Intercept)y > 0.5714 0.4286 >> lm(x~y)$coefficient[1](Intercept) > 0.5714286 > It's a name, not a description. The result is a named vector. To get rid of the na

Re: [R] Removing description from lm()

2014-10-05 Thread Duncan Murdoch
at it's for. (It is generally pretty safe to experiment in R. Don't worry, you won't break it.) Duncan Murdoch > > Thanks! > >> unname(lm(x~y)$coefficient[1]) > [1] 0.5714286 >> coef(lm(x~y))["(Intercept)"] > (Intercept) > 0.571428

Re: [R] Unable to install packages

2014-10-06 Thread Duncan Murdoch
t;) : unable to resolve 'cran.r-project.org' 2: In getDependencies(pkgs, dependencies, available, lib) : package ‘HSAUR2’ is not available (for R version 2.14.0) > Help please Sounds as though you are having Internet problems. Try the Windows FAQ 2.19, from the help

Re: [R] Evaluation of global variables in function definitions

2014-10-07 Thread Duncan Murdoch
ition? Thank you Dieter See the "open.account" example in section 10.7, "Scope", of the Introduction to R manual. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the p

<    1   2   3   4   5   6   7   8   9   10   >