Re: [R] Flat tables for confidence intervals with "survey" package

2015-02-04 Thread Duncan Murdoch
Percent(denom=Equal(X_CNTY), fn=LCI) + Percent(denom=Equal(X_CNTY), fn=UCI), data=nh.smart) You'll need to write the LCI and UCI functions to compute the confidence limits. I don't know how to extract those from the objects you've got; you may need t

Re: [R] how to draw paired mosaic plot?

2015-02-06 Thread Duncan Murdoch
on? There are examples on the help page, though I don't think a mosaic plot is there. Duncan Murdoch Many thanks! My best. -- QQ: 1733768559 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUB

Re: [R] Unable to use `eval(parse(text))' in nlme::lme

2015-02-08 Thread Duncan Murdoch
ction uses it, the x and y variables are evaluated in the original context. In your example, as.formula() will convert the string to a formula, and attach the current environment. So you'd better hope that whatever variable yname names, as well as time and gvhd, are all available there. Duncan Murd

Re: [R] Package build help

2015-02-08 Thread Duncan Murdoch
I am turning my attention to > the namespace now. Am I correct this can be a handled by the namespace? > I would guess you have imported the lubridate and plyr packages, and also defined your own duration() and here() functions, hiding theirs. Duncan Murdoch > Thanks, > Glenn

Re: [R] piecewise regression and lm() question

2015-02-11 Thread Duncan Murdoch
tion. W hat you want is lm(y ~ I((x<=10)*x) + I(x>10 & x<=20) + I((x>20)*x)) This doesn't give exactly the same results as the segmented regression, because it uses the same intercept in all three segments; you might want to add I(x <= 10) as well if you don't w

Re: [R] 32bit R303 calls external C functions

2015-02-12 Thread Duncan Murdoch
4 bit dlls, in which case both versions can use the binary of the package. If you've already done all that, then you'll need to give more details, e.g. access to the source for the package, to get more specific help. Duncan Murdoch __ R-h

Re: [R] Noob question re: writing while loops on one line

2015-02-15 Thread Duncan Murdoch
On 15/02/2015 10:08 AM, Sun Shine wrote: > Thanks John: understanding it as a line return makes sense! But it's not right. This is one statement, and it returns the value 3: 1 + 2 This is an error: 1 + ; 2 The semicolon is a statement separator, not a line return. Duncan

Re: [R] Noob question re: writing while loops on one line

2015-02-15 Thread Duncan Murdoch
On 15/02/2015 11:20 AM, John McKown wrote: > On Sun, Feb 15, 2015 at 9:54 AM, Duncan Murdoch > mailto:murdoch.dun...@gmail.com>>wrote: > > On 15/02/2015 10:08 AM, Sun Shine wrote: > > Thanks John: understanding it as a line return makes sense! > > Bu

Re: [R] peer assessment

2015-02-15 Thread Duncan Murdoch
> Raja Dey, Ph. D.UCONN You're writing to the wrong place. You need to write to your course instructor, we have no idea about your course. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/m

Re: [R] How do I provide path character string to extdata content?

2015-02-16 Thread Duncan Murdoch
ther than exporting the strings, it's easier to export a function that produces the strings, e.g. fig <- function(name) system.file(file.path("fig", name), package="foo") to be called as fig("man.png") Duncan Murdoch __

Re: [R] Coding style question

2015-02-17 Thread Duncan Murdoch
R2 has a missing value, you get NA from the equality tests, but FALSE from the %in% tests. That won't affect subset (where NA and FALSE both result in the omission of the observation), but it might affect other code like this. For example, if you

Re: [R] %>%

2015-02-17 Thread Duncan Murdoch
of the Introduction to R for a description of how to define these.) 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.

Re: [R] %>%

2015-02-18 Thread Duncan Murdoch
n that links to the original docs. (I notice it doesn't escape % properly, so the generated page for "%>%" wouldn't work; sigh.) Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.

Re: [R] find a previous command that starts with a certain letter

2015-02-19 Thread Duncan Murdoch
ers.) If you're using some other front-end, you'll need to read its documentation. 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

Re: [R] Issue writing correct code for Coursera assignment--performing matrix inversion

2015-02-19 Thread Duncan Murdoch
On 19/02/2015 3:13 PM, Samuel Colon wrote: > Hello All, > > I'm new to this mailing list, so please let me know if I've committed any > posting faux-pas. Yes, you should probably be using the Coursera support resources instead of this list. Duncan Murdoch > > I&#x

Re: [R] package 'corrplot'

2015-02-19 Thread Duncan Murdoch
wever, the legend is still in red color. > I need the legend be in black color. > How can I get rid of the red color in the legend produced by'corrplot'? See the help page ?corrplot. It appears that the ... argument to corrplot.mixed can be any of the arguments to corrplot, an

Re: [R] non-terminal token lacking children from utils::getParseData

2015-02-19 Thread Duncan Murdoch
ample, I wanted to verify that this is in fact unexpected > behavior (under R 3.1.2)? Before I spend the time thinking about that, I'd like to see a reproducible example. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more

Re: [R] trouble with .Rd file

2015-02-20 Thread Duncan Murdoch
ld be at the word dates in the first line of the > plot.fore4nodate line. > > This is making me a little nuts. Actually a lot nuts. > > If anyone can see anything, I would really appreciate any suggestions. Generally percent symbols (%) need to be escaped in Rd files. So t

Re: [R] creating a distinct zip file

2015-02-21 Thread Duncan Murdoch
On 21/02/2015 2:47 PM, Erin Hodgess wrote: > I have Windows, but the "R CMD INSTALL --build pack" does not produce a > compiled zip. What does it do? Can you show us a transcript? Duncan Murdoch > > Thanks, > Erin > > > On Sat, Feb 21, 2015 at 1:49 PM,

Re: [R] decimal places

2015-02-24 Thread Duncan Murdoch
", x$data.name, "\n\n") pp <- format.pval(x$p.value, digits, na.form = "-") attributes(pp) <- attributes(x$p.value) print(pp, quote = FALSE, ...) cat("\nP value adjustment method:", x$p.adjust.method, "\n") invisible(x) } Your d

Re: [R] R crashes with "Error in UseMethod("depth")" when resizing ggplot windows

2015-02-24 Thread Duncan Murdoch
the location of the crash. As far as I know only gdb supports debugging R on Windows (there's a copy in the Rtools collection), but perhaps that will change now that Microsoft has purchased Revolution Analytics. Duncan Murdoch __ R-help@r-project.o

Re: [R] Getting Rmarkdown to generate custom LaTEX environment

2015-02-25 Thread Duncan Murdoch
ept # call the knitr latex hook # restore the options } knitr::knit_hooks$set(fullpage = hook_fullpage) Then any chunk where you wanted this kind of inclusion you'd use the fullpage=TRUE option, and knitr would insert a bit of LaTeX code into the middle of your markdown document. Duncan Murd

Re: [R] How many digits are there in left of dot of 0.0001 ?

2015-02-26 Thread Duncan Murdoch
har(sub("^[[:digit:]]*[.]", "", a)) should work. (Note that default formatting is scientific for 0.0001.) If you want some other formatting, then format first, and pass a character object, e.g. chars <- format(a, scientific = FALSE) nchar(sub("

Re: [R] Save a list of list and search for values

2015-02-26 Thread Duncan Murdoch
ly numbers that you need. You'd use code like this to produce the matrix: results <- matrix(NA_real_, 1, ncols = however many you keep ) for (i in 1:1) { fit <- code to get the fit object results[i,] <- with(

Re: [R] Schedule R function/Code to run at specific time

2015-02-26 Thread Duncan Murdoch
an OS. If you want it to start 1000 seconds from now, use Sys.sleep(1000) as your first statement. You'll have a process sitting there using no CPU (but perhaps lots of virtual memory) until the sleeping is done. Using cron is better. Dunc

Re: [R] Why does R replace all row values with NAs

2015-02-27 Thread Duncan Murdoch
e works because in the cases where x$c is NA, it evaluates NA | TRUE, and that evaluates to TRUE. In the cases where x$c is not NA, you get x$c < 6 | FALSE, and that's the same as x$c < 6, which will be either TRUE or FALSE. Duncan Murdoch _

Re: [R] Why does R replace all row values with NAs

2015-02-27 Thread Duncan Murdoch
thout actually triggering a warning or error. BTW, I should have mentioned that the example where you indexed using -which(x$c>=6) is a bad idea: if none of the entries were 6 or more, this would be indexing with an empty vector, and you'd get nothing, not everything. Duncan Murdoch

Re: [R] Why does R replace all row values with NAs

2015-02-27 Thread Duncan Murdoch
$c<6) | is.na(x$c),] I would write it as x[is.na(x$c) | x$c < 6,] but that's purely a style difference, I don't think it would affect execution time (or results). I like to put the weird case first because it will remind me that things are more complicated than you might guess.

Re: [R] Variable Column Names and Lists

2015-02-27 Thread Duncan Murdoch
construct that list as structure(list(sum(get(bvar))), names=sumvar) i.e. the full expression would be dt_min <- dt[, structure(list(sum(get(bvar))), names=sumvar), by=list(a)] The idea is that structure() produces list(sum(get(bvar))) with attribute "names" set to the contents of sumvar.

Re: [R] Firefox not showing R help.

2015-02-28 Thread Duncan Murdoch
;) give you in R? If it is just a character string (e.g. "xdg-open" is what I get in Ubuntu), does it work from your command line, outside of R, e.g. for me that test would be xdg-open http://www.r-project.org If that doesn't work, but you can figure out a command line way to op

Re: [R] Firefox not showing R help.

2015-03-01 Thread Duncan Murdoch
On 28/02/2015 6:43 PM, Rolf Turner wrote: > > See inline below. > > On 01/03/15 10:59, Duncan Murdoch wrote: >> On 28/02/2015 4:10 PM, Rolf Turner wrote: >>> >>> Firefox recently updated itself on my laptop. Now when I ask for R help >>> --- e.g. ?

Re: [R] Firefox not showing R help.

2015-03-01 Thread Duncan Murdoch
is TRUE; I had thought it wasn't. The -remote arg is also used for mozilla and opera; is it needed there? Duncan Murdoch > > Best, > Ista > > On Sun, Mar 1, 2015 at 7:14 AM, Duncan Murdoch > wrote: >> On 28/02/2015 6:43 PM, Rolf Turner wrote: >>> >

Re: [R] Installed R to Windows, but having trouble with read.csv

2015-03-02 Thread Duncan Murdoch
appreciated. Setting the filename using the file.choose() function is usually easiest. I.e. f <- file.choose() perf_data <- read.csv(f) You'll get the usual file choose dialog (at least in Windows and OSX; not sure about Linux) when file.choose() runs and can navigate to the file. The fu

Re: [R] vignette advice

2015-03-06 Thread Duncan Murdoch
g to do. (Of course, as the package evolves, the paper might become obsolete; then you have a problem: update it, or just declare it of historical interest?) Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.et

Re: [R] SPSS command "match files" for merging one-to-many (hierarchical) equivalent in R?

2015-03-09 Thread Duncan Murdoch
showing what you're starting with, and what you want to produce. From what you wrote, I'd guess merge(), not match(), but you might really be asking for something completely different. Duncan Murdoch __ R-help@r-project.org

Re: [R] Trouble Clearing Environment

2015-03-18 Thread Duncan Murdoch
You seem to be talking about something in the RStudio front end, not in R, which means you're writing to the wrong place. They have their own support forums. Duncan Murdoch On 18/03/2015 4:59 PM, Chad Danyluck wrote: > I use R Studio (Version 0.98.994 on Mac) and R version 3.1.1 (20

Re: [R] Why do my posts not get accepted to the mailing list?

2015-03-19 Thread Duncan Murdoch
ts from nabble; perhaps they are now banned completely. 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.h

Re: [R] Fast evaluation of functions in 3D domains

2015-03-25 Thread Duncan Murdoch
t;> 16*pi*(5^3)*(log(5+40) - log(5) - 40/(40+5)) > [1] 8220.516 > > However, I can not try the same with cubature since the code is prepared only > to be > used in hypercubes. I don't know how well the cubature package would deal with the discontinuity, but a simple way to

Re: [R] Debug package options

2015-03-30 Thread Duncan Murdoch
point me to the right doc. See the ?Startup help topic. You probably want to use one of the profile files rather than .First, because .First needs to be in a workspace, and you shouldn't be loading a workspace every time. Duncan Murdoch __ R-hel

Re: [R] Randomly interleaving data frames while preserving order

2015-03-31 Thread Duncan Murdoch
rep(1, nrow(df1)), rep(2, nrow(df2)), rep(3, nrow(df3 # Create an empty dataframe to hold the results df <- data.frame(strat=NA, id=NA, pid=NA)[rep(1, length(sel)),] # Put the original dataframes into the appropriate slots: df[sel == 1,] <- df1 df[sel == 2,] <- df2 df[sel == 3,] <-

Re: [R] idiom for constructing data frame

2015-03-31 Thread Duncan Murdoch
atically within a function? Sarah, still sure I'm missing something obvious The matrix() function has a dimnames argument, so you could do this: names <- c("strat", "id", "pid") data.frame(matrix(NA, nrow=10, ncol=3, dimnames=list(NULL, names))) Duncan Mur

Re: [R] Inverse of many small matrices

2015-04-02 Thread Duncan Murdoch
, but that's likely slower and less accurate than other equivalent ones, such as x %*% solve(A, x), and I wouldn't be surprised if there are better ones. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more,

Re: [R] "R" help leaves out lines of text

2015-04-16 Thread Duncan Murdoch
n 3.0.1-1 > The Cygwin release is not supported by us, and is known to be buggy, because it doesn't handle line endings properly. You'll need to talk to the Cygwin folks if you can't reproduce this in one of our releases available from cran.r-project.org/bin/windows/base. Duncan

Re: [R] "function" as variable name - probably better error message

2015-04-16 Thread Duncan Murdoch
s the reserved words (see section 10.3.3). It oversimplifies things, saying they can't be used as variable names, when in fact almost any string can be used with proper quoting. For example, both of these work: "function" <- "Not an

Re: [R] source script file that contains Unicode non-English characters

2018-08-12 Thread Duncan Murdoch
ng on Windows, in a non-UTF-8 locale? Posting sessionInfo() would be helpful. Duncan Murdoch -Farid On Sun, Aug 12, 2018 at 7:24 AM, Jeff Newmiller wrote: ... and read the Posting Guide... only a few file types will ever make it through the mailing list so repeatedly sending files not among thos

Re: [R] source script file that contains Unicode non-English characters

2018-08-12 Thread Duncan Murdoch
% source() %>% close() # works fine is a nice way to avoid this problem. Duncan Murdoch R version 3.5.1 (2018-07-02) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200) Matrix products: default locale: [1] LC_COLLATE=English_United States.1

Re: [R] Mysterious seg fault.

2018-08-12 Thread Duncan Murdoch
rt when you get the segfault. I don't know which report will be more informative. Duncan Murdoch and got a lot of (mysterious to me) output: /usr/local/bin/valgrind R ==18051== Memcheck, a memory error detector ==18051== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==18

Re: [R] Spline function

2018-08-14 Thread Duncan Murdoch
nverse of the original spline interpolator except at observed (x,y) pairs, but will usually be close, especially if the functions are pretty smooth. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/

Re: [R] source script file that contains Unicode non-English characters

2018-08-17 Thread Duncan Murdoch
p will probably not result in any action on it. Posting it to the bug page will at least result in a fairly permanent record. Duncan Murdoch thanks Farid On Sun, Aug 12, 2018 at 9:03 PM, Duncan Murdoch mailto:murdoch.dun...@gmail.com>> wrote: On 12/08/2018 11:48 AM, Far

Re: [R] differing behavior of mean(), median() and sd() with na.rm

2018-08-22 Thread Duncan Murdoch
s sum(x)/length(x), so if x is length 0, you get 0/0 which is NaN. median(x) is documented in its help page to give NA for x of length 0. sd(x) is documented to give an error for such x and NA for length 1, but it gives NA for both. Duncan Murdoch x <- c(NA, NA, NA) mean(x, na.rm=TRUE)

Re: [R] Plots in ioslides and R markdown

2018-08-25 Thread Duncan Murdoch
ation: default --- ```{r global_options, echo=FALSE} knitr::opts_chunk$set(tidy=TRUE, warning=FALSE, message=FALSE, cache=FALSE, dpi = 300) Drop the dpi setting and it will work fine. Duncan Murdoch

Re: [R] Multiple counters in a single for loop

2018-08-25 Thread Duncan Murdoch
L, 0L). Better to use for ( i in seq_along(var1) ) { Duncan Murdoch elem1 <-var1[i] elem2 <- var2[i] } if you want more abstraction you could then wrap that up in a function HTHOn 25 Aug 2018 18:57, Jeff Newmiller wrote: look at the map2 function in the purrr package. On August 24

Re: [R] Plots in ioslides and R markdown

2018-08-25 Thread Duncan Murdoch
On 25/08/2018 7:37 PM, Patrick Connolly wrote: On Sat, 25-Aug-2018 at 07:53AM -0400, Duncan Murdoch wrote: |> On 25/08/2018 6:21 AM, Patrick Connolly wrote: |> >--- |> >title: "Barking up the wrong tree" |> >author: "Patrick Connolly" |> >

Re: [R] Multiple counters in a single for loop

2018-08-26 Thread Duncan Murdoch
On 26/08/2018 3:10 AM, Jeremie Juste wrote: Duncan Murdoch writes: for ( i in 1:length(var1)){ This is generally a bad idea: if length(var1) == 0, it does the wrong thing, since 1:0 is c(1L, 0L). Better to use for ( i in seq_along(var1) ) { granted. One should check the validity of

Re: [R] Plots in ioslides and R markdown

2018-08-26 Thread Duncan Murdoch
On 26/08/2018 4:40 AM, Patrick Connolly wrote: On Sat, 25-Aug-2018 at 08:10PM -0400, Duncan Murdoch wrote: |> On 25/08/2018 7:37 PM, Patrick Connolly wrote: |> >On Sat, 25-Aug-2018 at 07:53AM -0400, Duncan Murdoch wrote: |> > |> >|> On 25/08/2018 6:21 AM

Re: [R] Casting Date to char

2018-09-05 Thread Duncan Murdoch
113569 This might just be a typo in your message, but as.character() is the function you want, not as.Character(). The other typo or error above is that you are trying to convert dp$sampdate, but the dataframe has no column with that name according to the lines above. Duncan Murdoch I don&#x

Re: [R] frequency distribution in figures....

2018-09-08 Thread Duncan Murdoch
y(xhth) You could use table(cut(xht, breaks=2*(0:5))) which produces (0,2] (2,4] (4,6] (6,8] (8,10] 2 2 2 2 2 for your dataset. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] argument "string" is missing, with no default

2018-09-08 Thread Duncan Murdoch
Thank you. Use traceback() to see which function called stri_split_regex. Break up the long pipeline into smaller parts so you can see where the error is comming from. Don't post in HTML. Duncan Murdoch __ R-help@r-project.org mailing lis

Re: [R] getting 21 very different colours

2018-09-11 Thread Duncan Murdoch
o use other characteristics as well, such as the symbol. You could plot 21 different letters in 5 different colours and it might work, but it's not going to be easy for viewers. Duncan Murdoch I could pick them by hand, but that is about 15 colours more than I know (I have a detailed c

Re: [R] YAML for bookdown

2018-09-12 Thread Duncan Murdoch
xactly the arguments to the bookdown::gitbook function. It passes ... to rmarkdown::html_document, so those arguments are available too. If you're using a different bookdown output format, the allowed entries will be the arguments to whatever function you use.

Re: [R] Link from vignette to package documentation

2018-09-21 Thread Duncan Murdoch
to make the URL predictable, either by something like options(help.ports = 12345) (which will put help on port 12345, blocking that port for any other use, including help in another R session), or by putting a static copy of the help pages on some other web server. Duncan Murdoch

Re: [R] Link from vignette to package documentation

2018-09-22 Thread Duncan Murdoch
On 22/09/2018 4:14 AM, Martin Maechler wrote: Duncan Murdoch on Fri, 21 Sep 2018 05:02:32 -0400 writes: > On 21/09/2018 4:54 AM, Sigbert Klinke wrote: >> Hi, >> >> is it possible to make a link from a vignette to a (Rd) >> help files

Re: [R] For Loop

2018-09-23 Thread Duncan Murdoch
. It is very similar to (but probably a little faster than) log(c1[2:len]/c1[1:(len-1)]) There are differences in borderline cases (like length(c1) != len, or len < 2) that are not relevant in the original context. Duncan Murdoch Thank you, John John David Sorkin M.D., Ph.D. Professor

Re: [R] For Loop

2018-09-23 Thread Duncan Murdoch
function so it acts as if it is vectorized. The "performance penalty" part of your statement is true. It will generally save some computing cycles to write a new function using a for loop instead of using Vectorize(). But that may waste some programmer time. Duncan Murdoch (writ

Re: [R] For Loop

2018-09-23 Thread Duncan Murdoch
"try it and see". Sometimes it probably helps a lot, sometimes it's probably detrimental. Duncan Murdoch P.S. I last worked in a corporate computing environment 40 years ago when I was still wet behind the ears, so you'd probably want to ask someone else. However, more rec

Re: [R] Summarizing R script

2018-09-26 Thread Duncan Murdoch
s though for submission there enforces some good coding and documentation practices. Duncan Murdoch   And there are publications like "R Journal" that are looking for descriptions of what you've done.  I have a paper in "R Journal" describing the "sos" pa

Re: [R] using S4 objects in "with"?

2018-09-26 Thread Duncan Murdoch
s far as I recall, this is an undocumented implementation detail, and you aren't supposed to count on it. 2. You could write an as.list() method for the Wave class, then with(as.list(Wobj), would work. This may be the "right" way to do this. Duncan Murdoch

Re: [R] how to pass arguments to panel.cor in pairs()

2018-10-09 Thread Duncan Murdoch
nt the regular one sometimes and a custom one other times, you could make your own panel function: panel.cor2 <- function(...) panel.cor(..., prefix = "r = ") Then use pairs(USJudgeRatings, lower.panel = panel.smooth, upper.panel = panel.cor2, gap=0, row1attop=FALSE) Duncan Mur

Re: [R] Genuine relative paths with R

2018-10-10 Thread Duncan Murdoch
you talking about? On Unix-alikes, you'd need an "echo" ahead of that, and it would print the user's working directory, not the working directory of the script. Duncan Murdoch ​ __FILE__ in C relates to the source code directory that is usually not where the executable

Re: [R] Genuine relative paths with R

2018-10-10 Thread Duncan Murdoch
irectory of the script. At least for me (I am running on the last version of Ubuntu)... Not for me. Always prints the user's working directory. Duncan Murdoch Best regards, Olivier ---- *De :* Duncan Murdoch *E

Re: [R] Genuine relative paths with R

2018-10-10 Thread Duncan Murdoch
On 10/10/2018 11:20 AM, Duncan Murdoch wrote: On 10/10/2018 11:18 AM, Olivier GIVAUDAN wrote: Hi Duncan, Yes, if you need to display the content of $PWD you obviously need to type 'echo' before this variable. It prints the user's working directory if run from a terminal but if

Re: [R] Genuine relative paths with R

2018-10-10 Thread Duncan Murdoch
believable that you are seeing anything different from that on a Unix-alike. Duncan Muroch -------- *De :* Duncan Murdoch *Envoyé :* mercredi 10 octobre 2018 15:20 *À :* Olivier GIVAUDAN; Jeff Newmiller *Cc :* r-help@r-projec

Re: [R] Genuine relative paths with R

2018-10-10 Thread Duncan Murdoch
ctory in your source. When the package is installed, those files will be moved up one level, i.e. Olivier/inst/foo will become system.file("foo", package = "Olivier") Duncan Murdoch __ R-help@r-project.org mailing list --

Re: [R] Genuine relative paths with R

2018-10-10 Thread Duncan Murdoch
rk using package.skeleton(). Really, if you are distributing R code, you should do it in the standard way, not invent your own. Duncan Murdoch -------- *De :* Duncan Murdoch *Envoyé :* mercredi 10 octobre 2018 20:54 *À :* Olivier

Re: [R] Genuine relative paths with R

2018-10-10 Thread Duncan Murdoch
directory of the program they are running, because the ones you've tried do it that way. But they don't. Duncan Murdoch ------------ *De :* Duncan Murdoch *Envoyé :* mercredi 10 octobre 2018 21:39 *À :* Olivier GIVAUDAN; Jef

Re: [R] Genuine relative paths with R

2018-10-10 Thread Duncan Murdoch
is not a good idea. It might be a good idea, if you know the system very, very well. Otherwise, it's probably better to work the standard way. Duncan Murdoch For example, you might thinkthat all front ends set the working directory to the directory of theprogram they are running, b

Re: [R] Genuine relative paths with R

2018-10-10 Thread Duncan Murdoch
ve it (batch, shell, C, LaTeX, SAS with macro-variables, etc.)?" Duncan Murdoch -------- *De :* Duncan Murdoch *Envoyé :* mercredi 10 octobre 2018 22:31 *À :* Olivier GIVAUDAN; Jeff Newmiller *Cc :* r-help@r-project.org *Obje

Re: [R] Genuine relative paths with R

2018-10-10 Thread Duncan Murdoch
d out what line foo starts on, using fooline <- getSrcLocation(foo) This is a lot like __LINE__ in C. Duncan Murdoch 'getwd()' is indeed not equivalent to VBA 'Application.ThisWorkbook.Path' or C macro '__FILE__' or SAS %sysget(SAS_EXECFILENAME), etc. ---

Re: [R] Reorder file names read by list.files function

2018-10-10 Thread Duncan Murdoch
or of filenames. Duncan Murdoch I have not tried RUI's yet, but i will if nothing else works out. Thanks again--EK had to strip off file.names from the extension PDF, but when i paste the month.name with .PDF to get the correct file names, i am getting the same error. On Tue, Oct 9, 2018

Re: [R] Genuine relative paths with R

2018-10-11 Thread Duncan Murdoch
On 10/10/2018 8:08 PM, Olivier GIVAUDAN wrote: I think Gabor (at least) already suggested this solution. But the problem is: how do you source this file containing this 'foo' function without writing its absolute path? You only need its relative path to source it. Duncan Murdoc

Re: [R] RMarkdown vignettes v. Jupyter notebooks?

2018-10-11 Thread Duncan Murdoch
onnect.com/content/2671/Combining-Shiny-R-Markdown.html>. Other than my two notes above, your comments about Rmarkdown seem right on the mark. Duncan Murdoch I'm trying to do real time monitoring of the broadcast quality of a radio station, and it seems to me that it may be e

Re: [R] GLM Model Summary

2018-10-16 Thread Duncan Murdoch
that what you meant? What would probably be best is if you showed us a simple example of what you are doing, and then referred to the results from that when saying what you want to extract. Duncan Murdoch We therefore ask, is it possible for us to get the Summary(Model) column by column, i.

Re: [R] source() fails in same directory as script: cannot find file

2018-10-27 Thread Duncan Murdoch
x27;t know why others didn't Duncan Murdoch On October 26, 2018 1:11:19 PM PDT, Jeremie Juste wrote: Hello, I suspect the error is in the file input-summerize.R. I creating a new file input-summerize2.R with only print("hello") for instance and check if setwd(

Re: [R] Question about function scope

2018-10-30 Thread Duncan Murdoch
ere is my scope problem if (c==1) bar1() if (c==2) bar2() # some more code cat(sprintf('foo: x=%d, y=%d, z=%d\n', x, y, z)) } foo(c=0) foo(c=1) foo(c=2) I get this output: > foo(c=0) foo: x=0, y=0, z=0 > foo(c=1) bar1: x=1, y=1, z=1 foo: x=1, y=1, z=1 > foo(c=2) bar2

Re: [R] Question about function scope

2018-10-30 Thread Duncan Murdoch
problem if (c==1) bar1(environment()) if (c==2) bar2(environment()) # some more code cat(sprintf('foo: x=%d, y=%d, z=%d\n', x, y, z)) } foo(c=0) foo(c=1) foo(c=2) Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIB

Re: [R] Question about function scope

2018-10-30 Thread Duncan Murdoch
uot;]] y <- result[["y"]] z <- result[["z"]] Duncan Murdoch - Original Message - From: "Duncan Murdoch" To: "Sebastien Bihorel" , r-help@r-project.org Sent: Tuesday, October 30, 2018 4:13:05 PM Subject: Re: [R] Question about function

[R] which element is duplicated?

2018-11-12 Thread Duncan Murdoch
[1] FALSE FALSE TRUE TRUE What I want is a fast way to calculate [1] NA NA 2 1 or (equally useful to me) [1] 1 2 2 1 The result should have the property that if result[i] == j, then v[i] == v[j], at least for i != j. Does this already exist somewhe

Re: [R] which element is duplicated?

2018-11-13 Thread Duncan Murdoch
On 13/11/2018 12:35 AM, Pages, Herve wrote: Hi, On 11/12/18 17:08, Duncan Murdoch wrote: The duplicated() function gives TRUE if an item in a vector (or row in a matrix, etc.) is a duplicate of an earlier item.  But what I would like to know is which item does it duplicate? For example, v

Re: [R] which element is duplicated?

2018-11-13 Thread Duncan Murdoch
adley's vectors package is addressing? I don't know; hopefully someone else will respond... Duncan Murdoch Bill Dunlap TIBCO Software wdunlap tibco.com <http://tibco.com> On Tue, Nov 13, 2018 at 2:15 AM, Duncan Murdoch mailto:murdoch.dun...@gmail.com>> wrote: On 13

Re: [R] Perspective Plotting - 3D Plotting in R

2018-11-26 Thread Duncan Murdoch
t should contain the values of the two factors to your model that you are holding fixed while plotting the two that are not fixed. This Stackoverflow answer https://stackoverflow.com/questions/53349811/how-to-draw-a-response-surface-plot-for-three-factorial-design/53350259#53350259 describes a w

Re: [R] [R ]Exporting rgl.snapshot and rgl.postscript

2018-11-27 Thread Duncan Murdoch
functions like open3d(), not the low-level rgl.* functions like rgl.open().) The rgl.postscript() display is limited by what the GL2PS library can do, so if it doesn't do what you want, there's not much you can do to improve it. Duncan Murdoch Can somebody please show me

Re: [R] why the base::round(0.015, 2) returns 0.02?

2018-11-28 Thread Duncan Murdoch
u multiply by 100, you get the exactly correct result. Then the apparent rule for round(x, 2) is: multiply by 100, round to an integer, divide by 100. Duncan Murdoch Therefore, according to the arithmetic rules, rounded 0.014 to the second digit is 0.01. Also, the round() function in other

Re: [R] (no subject)

2018-12-02 Thread Duncan Murdoch
? What version? What locale? 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 com

Re: [R] Bug (?): reading binary files in Windows 10

2018-12-06 Thread Duncan Murdoch
t, otherwise it is assumed to be a text file, and LF is changed to CR LF. There may also be handling of EOF marks, I forget. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo

Re: [R] Width of a text

2018-12-12 Thread Duncan Murdoch
n read how to do it here: <https://shiny.rstudio.com/articles/js-send-message.html>. Duncan Murdoch Thanks for any input. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see http

Re: [R] error = FALSE causes knit2wp to throw duplicate label error

2018-12-16 Thread Duncan Murdoch
tr issue. I don't know if Yihui reads this list; you'd probably be better off on StackOverflow or filing an issue as described at https://yihui.name/knitr/faq/. Duncan Murdoch My code: ```{r setup, include=FALSE} ## Set the global chunk options for knitting reports knitr::opts

Re: [R] RTerm.exe

2018-12-17 Thread Duncan Murdoch
am Files\R\R-3.5.1\bin\x64\Rgui.exe" Not sure what your question is, but the executable is called Rterm.exe, and should be in the same directory as Rgui.exe. Duncan Murdoch __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and

Re: [R] convert columns of dataframe to same factor levels

2018-12-19 Thread Duncan Murdoch
C","D": 1 1 2 2 1 Thank you I don't think read.table() can do it for you automatically. To do it yourself, you need to get a vector of the levels. If you know this, just assign it to a variable; if you don't know it, compute it as thelevels <- unique(unlist

Re: [R] convert columns of dataframe to same factor levels

2018-12-19 Thread Duncan Murdoch
an add levels this way: levels> f <- factor(c("a","b")) levels> levels(f) <- c("c", "a", "b") levels> f [1] c a Levels: c a b levels> f <- factor(c("a","b")) levels> levels(f) <- list(C = "C&q

Re: [R] Installation Re: Problems with library...

2018-12-24 Thread Duncan Murdoch
around R. 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 commented, minimal, self

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