Re: [R] sapply returning list instead of matrix

2014-02-03 Thread S Ellison
I can read the documentation, I see why it happens, but who in their right mind would design a function this way? I think you're possibly starting from the wrong perspective, or at least it might be useful to look at it from a different perspective. In many cases, such as simulations, lapply

[R] stats::runmed - crashes R - session

2014-02-03 Thread Witold E Wolski
R version 3.0.1 (2013-05-16) -- Good Sport Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) length(log2ro) [1] 16152 summary(log2ro) Min. 1st Qu. MedianMean 3rd Qu.Max.NA's -10 0 0 Inf 0 Inf

[R] match - returns a vector of the positions of (first) matches - looking for All positions.

2014-02-03 Thread Witold E Wolski
Looking for a build in function which returns a vector of the positions of _ALL_ matches. -- Witold Eryk Wolski __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] package mgcv - predict with bam: Error in X[ind, ] : subscript out of bounds

2014-02-03 Thread Simon Wood
I suppose there may be an error of sorts, but have you considered the fact that solving the error might not gain you admittance into heaven? Look at the RHS of the model: sensor2 + s(site, bs = re) ... and think about the fact that you are smoothing a factor variable. - Actually this is ok.

Re: [R] match - returns a vector of the positions of (first) matches - looking for All positions.

2014-02-03 Thread Kehl Dániel
Dear Witold, as a first hint: read posting guide please! People are answering in their free time, so please try to be polite! For your first problem: what are you expecting? You have a dataset where most of the values is missing, the others all 0's most of the time, and some Inf values as

Re: [R] match - returns a vector of the positions of (first) matches - looking for All positions.

2014-02-03 Thread PIKAL Petr
Hi which(table == match) or which(table %in% match) Petr -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Witold E Wolski Sent: Monday, February 03, 2014 11:19 AM To: r-help@r-project.org Subject: [R] match - returns a

Re: [R] package mgcv - predict with bam: Error in X[ind, ] : subscript out of bounds

2014-02-03 Thread Simon Wood
Hi Katharina, Thanks for sending this. The problem is that the prediction data for site contain levels not available in the (useable non-NA) fit data... levels(m$model$site) [1] KRB NP.FOR WKS.FRE WKS.KRE WKS.RIE WKS.WUE levels(gapData$site) [1] KRB NP.FOR RIE.2 WKS.BBR WKS.FRE

Re: [R] package mgcv - predict with bam: Error in X[ind, ] : subscript out of bounds

2014-02-03 Thread Katharina May
Hi Simon, many thanks for looking into this and making me understand the problem! I'll adjust my factor levels right away... Best, Katharina On 3 February 2014 12:42, Simon Wood s.w...@bath.ac.uk wrote: Hi Katharina, Thanks for sending this. The problem is that the prediction data for site

Re: [R] match - returns a vector of the positions of (first) matches - looking for All positions.

2014-02-03 Thread Witold E Wolski
Hi Petr, I was actually citing the match (%in%) docu - match returns the positions of (first) matches. I am looking for something returning ALL matches (sure it's easy to write a function which does it ... my intuition however is, that there is already such a function in R - is there something

Re: [R] stats::runmed - crashes R - session

2014-02-03 Thread Martin Maechler
Witold E Wolski wewol...@gmail.com on Mon, 3 Feb 2014 11:06:15 +0100 writes: R version 3.0.1 (2013-05-16) -- Good Sport Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) length(log2ro) [1] 16152 summary(log2ro) Min. 1st Qu.

[R] ggplot2: removing empty factor levels in facet_grid

2014-02-03 Thread Anna Zakrisson Braeunlich
Hi, I would like to thank you for a great package and for all help I have recieved in the past. To my question: I have a plot where I have used facet_grid. I have factor: station (B1, BY31, H2) and factor: year (2007, 2008). The plot has two plot panels empty as there are no combinations

Re: [R] Problem connecting to database via RPostgreSQL/RS-DBI: could not connect error

2014-02-03 Thread Christian Oswald
Hello, what's your operating system? Windows? Perhaps you don't have an account administrator in the postgresql. libpg is not a R-library it's system dependent. (ubuntu apt-get install libpg-dev) Christian Am 31.01.2014 22:40, schrieb andrewH: In the description section of the

Re: [R] match - returns a vector of the positions of (first) matches - looking for All positions.

2014-02-03 Thread PIKAL Petr
Hi Posting questions without context may result in answers unrelated to your problem. Anyway it works for me without problem table-sample(letters[1:5], 20, replace=T) which(table %in% a) [1] 1 2 19 version _ platform i386-w64-mingw32 arch i386 os

Re: [R] match - returns a vector of the positions of (first) matches - looking for All positions.

2014-02-03 Thread Witold E Wolski
Thank you. That's what I was looking for. I am wondering what does the documentation means by (first) than? match {base} match returns a vector of the positions of (first) matches of its first argument in its second. On 3 February 2014 15:02, PIKAL Petr petr.pi...@precheza.cz wrote: Hi

Re: [R] Problem connecting to database via RPostgreSQL/RS-DBI: could not connect error

2014-02-03 Thread Hadley Wickham
On Fri, Jan 31, 2014 at 9:40 PM, andrewH ahoer...@rprogress.org wrote: In the description section of the RPostgreSQL package documentation, it states: In order to build and install this package from source, PostgreSQL itself must be present your system to provide PostgreSQL functionality via

Re: [R] Change file name

2014-02-03 Thread arun
Hi, Check ?file.rename() http://stackoverflow.com/questions/10758965/how-do-i-rename-files-using-r A.K. I have list of files in folder e.g p126r62_5t19880613_nn1.tif.gz      p126r62_5t19880613_nn2.tif.gz      p200r65_5t19880613_nn1.tif.gz and I would like to change file name to      

Re: [R] Plotting multiple time series with variables having different units

2014-02-03 Thread Bert Gunter
David: 1. Unless it is a personal answer, reply to the list, not me. I am not your personal consultant, and you are likely to get better answers that way anyway. 2. Stop looking at examples and start reading docs. ?layout says nothing about controlling plot scales -- it just partitions the

[R] In RStudio/Win7, which directory stores the markdown.css file?

2014-02-03 Thread Jeff Johnson
I'm running Windows 7 and RStudio .98.490. I need to edit the CSS file to test something out, but I've found multiple files and changing them seems to do nothing. It almost seems like the CSS may be cached or something since all changes to it do nothing. FYI, I've read the tutorials on custom CSS

Re: [R] match - returns a vector of the positions of (first) matches - looking for All positions.

2014-02-03 Thread PIKAL Petr
Hi If you are in doubt, try it. It is usually easy and does not do any harm. test-sample(letters[1:5], 20, replace=T) match(test,c) [1] NA NA NA 1 1 NA 1 1 NA NA NA 1 1 NA NA NA NA NA NA NA match(c, test) [1] 4 First occurence of c is at 4th position of test vector. There are others but

Re: [R] ggplot2: removing empty factor levels in facet_grid

2014-02-03 Thread Ista Zahn
Hi Anna, It's unclear what you want here, as it doesn't make sense in this example to remove the empty panels. Doing so will mess up the alignment of the remaining panels. Perhaps you want ggplot(mydata,aes(week,values))+ facet_wrap(~year+station, scales = fixed, drop=TRUE)+

Re: [R] match - returns a vector of the positions of (first) matches - looking for All positions.

2014-02-03 Thread William Dunlap
table-sample(letters[1:5], 20, replace=T) which(table %in% a) [1] 1 2 19 How is this different than which( table == a) ? The latter is probably a tad faster. I thought the OP had 2 vectors, x and table, and wanted a list the length of x, such that the i'th element of the list gave the

Re: [R] In RStudio/Win7, which directory stores the markdown.css file?

2014-02-03 Thread Ista Zahn
Hi Jeff, This is the wrong list--the RStudio support forum is at https://support.rstudio.com/ Best, Ista On Mon, Feb 3, 2014 at 11:36 AM, Jeff Johnson mrjeffto...@gmail.com wrote: I'm running Windows 7 and RStudio .98.490. I need to edit the CSS file to test something out, but I've found

Re: [R] In RStudio/Win7, which directory stores the markdown.css file?

2014-02-03 Thread Jeff Newmiller
There is some small chance that someone on this list knows that the answer to your question lies within a contributed R package such as knitr or markdown, but your description certainly suggests that the problem lies in RStudio or your use of that tool. However, R is not RStudio, and this is

Re: [R] Capturing output of a C executable

2014-02-03 Thread William Dunlap
READSAS - function(sourcefile) .C(readsas, sourcefile) OUTPUT - READSAS(../SASFILES/sdrug.sas7bdat) R / C then reads a sas7bdat file and sends the contents to the terminal window. I expected OUTPUT to contain the text that appear in the terminal window (i.e.,

Re: [R] Controlling font size on code chunk outputs using Knitr

2014-02-03 Thread Yihui Xie
R.css is irrelevant. The default CSS has already been mentioned in the documentation: https://support.rstudio.com/hc/en-us/articles/200552186-Customizing-Markdown-Rendering You should not define the rstudio.markdownToHTML option _inside_ the Rmd document: do it in the current R console, or in

Re: [R] Capturing output of a C executable

2014-02-03 Thread David Winsemius
On Feb 2, 2014, at 5:09 PM, Dennis Fisher wrote: R 3.0.1 OS X Colleagues, I am experimenting with incorporating C code into R. After compiling the C code with: R CMD SHLIB -o FILE.so FILE.c and executing: dyn.load(“FILE.so”) (without any errors), I execute the

Re: [R] In RStudio/Win7, which directory stores the markdown.css file?

2014-02-03 Thread Yihui Xie
I do not think the chance is too small :) Jeff (I mean the OP), please do consider an alternative place to ask questions: http://stackoverflow.com/questions/tagged/r Nobody will bother telling you this is the wrong list, since people will just quietly help you make your question into the correct

Re: [R] Change file name

2014-02-03 Thread Qiang Kou
Of course you can use file.rename() to do this. Can you explain more the changing pattern in you case? Best, Qiang On Mon, Feb 3, 2014 at 10:48 AM, arun smartpink...@yahoo.com wrote: Hi, Check ?file.rename() http://stackoverflow.com/questions/10758965/how-do-i-rename-files-using-r A.K.

Re: [R] creating an equivalent of r-help on r.stackexchange.com ? (was: Re: Should there be an R-beginners list?)

2014-02-03 Thread MacQueen, Don
Every browser-based interface I've ever seen has a number of features that I find to be huge deterrents. To mention just two: - They waste copious amounts of screen space on irrelevant things such as votes, the number of views, the elapsed time since something or other happened, fancy web-page

Re: [R] creating an equivalent of r-help on r.stackexchange.com ? (was: Re: Should there be an R-beginners list?)

2014-02-03 Thread Bert Gunter
Don: First, I apologize if this is off topic, but I thought I should reply publicly. I would only like to say thank you for so eloquently and elegantly summarizing my views, also. Maybe that makes me a dinosaur. If so, I happily accept the label. I find SO's voting for posting business

[R] package mgcv - predict with bam: Error in X[ind, ] :, subscript out of bounds

2014-02-03 Thread William Shadish
Dear Simon, your note below says bs=re specifies a Gaussian random effect . I have been using bs = re for data modeled with Poisson and binomial distributions, or variants thereof (e.g., quasi-Poisson). Have I erred in assuming bs =re can be used to obtain random effects for such data? Will

Re: [R] creating an equivalent of r-help on r.stackexchange.com ? (was: Re: Should there be an R-beginners list?)

2014-02-03 Thread Clint Bowman
Don, Thanks for the brilliant summary of my thoughts. Clint Clint BowmanINTERNET: cl...@ecy.wa.gov Air Quality Modeler INTERNET: cl...@math.utah.edu Department of Ecology VOICE: (360) 407-6815 PO Box 47600FAX:

Re: [R] creating an equivalent of r-help on r.stackexchange.com ?

2014-02-03 Thread Rolf Turner
For what it's worth, I would like to say that I concur completely with Don and Bert. (Also I would like second Bert's vote of thanks to Don for expressing the position so clearly.) cheers, Rolf Turner On 04/02/14 09:56, Bert Gunter wrote: Don: First, I apologize if this is off topic,

Re: [R] creating an equivalent of r-help on r.stackexchange.com ?

2014-02-03 Thread Ted Harding
Ditto. And ditto. And (by the way -- no-one seems to have mentioned it) what are the possibilities, for mail appearing on something like Stack Exchange, of having the mail sent to oneself so that it can be stored locally, on one's own machine? That is the only way I would want to work -- anything

Re: [R] predicted values

2014-02-03 Thread Felipe Carrillo
Hi Joshua, Thanks for the suggestion, I will check into log link. I just basically want to fill in missing values for days where data is not available. Negative values definetely won't work for the kind of data that I am collecting.   On Saturday, February 1, 2014 7:51 PM, Joshua Wiley

Re: [R] Controlling visibility of top-level functions

2014-02-03 Thread Greg Snow
One option that I have not seen mentioned yet, and may be the most similar to the Python approach is to name the Invisible function starting with a . (the period). Then the function will not appear when you do `ls()` but is still accessible. It however is not limited in scope and it is still

Re: [R] Capturing output of a C executable

2014-02-03 Thread Phil Spector
Dennis - The return value from .C will almost never be useful. If you want to bring results from the C environment into R, you need to do it by passing an address to .C which will receive the result. You may find this document helpful when interfacing R to C:

[R] MCPMod method

2014-02-03 Thread Mahboobe Akhlaghi
hi, I have a question about MCPMod package for finding optimal dose. does MCPMod method better than fuzzy method for finding dose?and why? many thanks. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] Change file name

2014-02-03 Thread Qiang Kou
You can do that like below: startingDir-/myDirectory filez-list.files(startingDir) sapply(filez,FUN=function(eachPath){ file.rename(from=eachPath,to=sub(pattern=xxx,replacement=newTextString,eachPath)) }) On Mon, Feb 3, 2014 at 10:48 AM, arun smartpink...@yahoo.com wrote: Hi, Check

[R] update.formula() to add interaction terms

2014-02-03 Thread Marie-Pierre Sylvestre
Hi, I have a list of formulae that I need to modify. For each formula, I need to add an interaction term between the first independent variable and the last one. I want to write a function to achieve that because the list of formulae to modify is long. For example, if the formula is y ~ x1 + x2 +

Re: [R] update.formula() to add interaction terms

2014-02-03 Thread William Dunlap
Is this the sort of thing you are looking for? fm - y ~ x1 + x2 + x3 + log(x4) # Use terms() instead of just all.vars() to keep log(x4) as log(x4) xVars - with(attributes(terms(fm)), as.list(variables)[-c(1,response+1)]) str(xVars) List of 4 $ : symbol x1 $ : symbol x2

Re: [R] package mgcv - predict with bam: Error in X[ind, ] :, subscript out of bounds

2014-02-03 Thread Gavin Simpson
The two distributions are different. The random effect is assumed to be a Gaussian random variable, just as it is with the GLMMs in the lme4 package. It is fine to use such a random effect within a GAM with a non-Gaussian error distribution, like the ones you describe using. HTH Gavin On 3

Re: [R] predicted values

2014-02-03 Thread Bert Gunter
... but do note that doing what you describe (using predicted values for missings) can mess up inference: it obviously results in underestimating error variability. If you're not doing inference, then probably no harm, no foul. If you are, then here's to irreproducibility! If you want to handle

Re: [R] creating an equivalent of r-help on r.stackexchange.com ? (was: Re: Should there be an R-beginners list?)

2014-02-03 Thread Liviu Andronic
Dear Don and Bert, Allow me to address some of your concerns below. On Mon, Feb 3, 2014 at 9:56 PM, Bert Gunter gunter.ber...@gene.com wrote: I find SO's voting for posting business especially irritating. I wish merely to post or to read the posts of others without being subjected to some

Re: [R] creating an equivalent of r-help on r.stackexchange.com ? (was: Re: Should there be an R-beginners list?)

2014-02-03 Thread Clint Bowman
Liviu, Thanks for the excellent description of the advantages of SE. However, there is a significant fraction of the population that prefers that information be pushed out to them rather than having to pull it to them. The best system is one that accommodates both equally well. Clint

Re: [R] creating an equivalent of r-help on r.stackexchange.com ?

2014-02-03 Thread Barry Rowlingson
As one of the original ranters of hey lets move to StackOverflow a few years back (see my UseR! lightning talk from Warwick) I should probably stick my oar in. I don't think the SO model is a good model for all the discussions that go on on R-help. I think SO is a good model for questions that

Re: [R] creating an equivalent of r-help on r.stackexchange.com ?

2014-02-03 Thread Marc Schwartz
Hi All, As I have noted in a prior reply in this thread, which began last November, I don't post in SO, but I do keep track of the traffic there via RSS feeds. However, the RSS feeds are primarily for new posts and do not seem to update with follow ups to the initial post. I do wish that they

[R] parallel coordinate plot showing density of curves

2014-02-03 Thread Michael Friendly
Given a set of numeric variables and a group factor, as in the iris data used below, I`d like to show a parallel coordinate plot, where instead of trace lines, I want to show something of the density distribution of the variable values for each group. Some approximations to what I want are

[R] [R-pkgs] Rcpp 0.11.0

2014-02-03 Thread Dirk Eddelbuettel
A new release 0.11.0 of Rcpp is now on CRAN, bringing a key new feature as well as a number of enhancements, extensions and and bug fixes to R --- please see the announcement text below. The key change is the fact that builds are now effectively 'header-only' and no longer require packages to

Re: [R] creating an equivalent of r-help on r.stackexchange.com ?

2014-02-03 Thread Gabor Grothendieck
On Mon, Feb 3, 2014 at 8:41 PM, Marc Schwartz marc_schwa...@me.com wrote: Hi All, As I have noted in a prior reply in this thread, which began last November, I don't post in SO, but I do keep track of the traffic there via RSS feeds. However, the RSS feeds are primarily for new posts and

Re: [R] parallel coordinate plot showing density of curves

2014-02-03 Thread Jim Lemon
On 02/04/2014 12:41 PM, Michael Friendly wrote: Given a set of numeric variables and a group factor, as in the iris data used below, I`d like to show a parallel coordinate plot, where instead of trace lines, I want to show something of the density distribution of the variable values for each

[R] Trying to install package for LMER, getting a ton of errors

2014-02-03 Thread David Kremelberg
Hi all, trying to run a linear mixed-effects model in R. Getting a ton of errors when trying to install the lme4 package (see below). I thought it was because my version of R was old, I just updated it, same exact problem, plus tried the install on the 32 and 64 bit versions. Any help appreciated.

Re: [R] Trying to install package for LMER, getting a ton of errors

2014-02-03 Thread Steve Lianoglou
Hi, On Mon, Feb 3, 2014 at 10:12 PM, David Kremelberg david.kremelb...@gmail.com wrote: Hi all, trying to run a linear mixed-effects model in R. Getting a ton of errors when trying to install the lme4 package (see below). I thought it was because my version of R was old, I just updated it,

Re: [R] Trying to install package for LMER, getting a ton of errors

2014-02-03 Thread Pascal Oettli
Hello, I am wondering why you are trying to install from source on your Windows machine. Is there any reason for you to not use Windows binaries? Regards, Pascal On 4 February 2014 15:12, David Kremelberg david.kremelb...@gmail.com wrote: Hi all, trying to run a linear mixed-effects model in

Re: [R] creating an equivalent of r-help on r.stackexchange.com ? (was: Re: Should there be an R-beginners list?)

2014-02-03 Thread Liviu Andronic
Dear Clint, On Tue, Feb 4, 2014 at 1:27 AM, Clint Bowman cl...@ecy.wa.gov wrote: Liviu, Thanks for the excellent description of the advantages of SE. However, there is a significant fraction of the population that prefers that information be pushed out to them rather than having to pull it

[R] Docs missing on Debian Wheezy

2014-02-03 Thread Jerry Sievers
Greetings. New to R. Spent the last couple weeks inhaling what docs are installed on my box such as the emacs info files. Wanting to go deeper now and find that I've got lots of these 00Index.html files but their many links all point to nonexistent files. What package(s) am I missing? Thanks

[R] GLM weights for the Poisson family

2014-02-03 Thread IamRandom
I am running a simple example of GLM. If I include weights when family=poisson then the weights are calculated iteratively and $weights and $prior.weights return different values. The $prior.weights are what I supplied and $weights are the posterior weights of the IWLS. If I include weights