Re: [R] R CMD check Note: Non-standard file found at top level

2013-09-03 Thread Hadley Wickham
The note is telling you that you usually shouldn't have a file called build in the top level of your package. What's in the file and why is it there? Hadley On Tue, Sep 3, 2013 at 10:01 AM, S Subramanian wrote: > My R CMD check pkgname and R CMD build pkgname run without any notes or > warnings

Re: [R] Should I wrap more package examples in \dontrun{} ?

2013-09-03 Thread Hadley Wickham
>> It was my understanding that package authors are responsible for not >> breaking other CRAN packages without warning. For example, before I >> release a new version of plyr or ggplot2, I run R CMD check on every >> package that depends on my package. I then let the maintainers know if >> someth

Re: [R] RStudio Server init script

2013-09-10 Thread Hadley Wickham
You might find ?Startup helpful - it describes all the places the R looks for config files when starting up. Hadley On Mon, Sep 9, 2013 at 11:51 PM, Bembi Prima wrote: > Hi All, > > Anyone here using RStudio Server? > I want to ask how can I put .Rprofile that can be accessed by all user. > So i

Re: [R] Merging list of dataframes with reshape merge_all

2013-01-11 Thread Hadley Wickham
> PS: Just a related side-question: Why is merge_all not included in the > "newer" package reshape2 as this is considered to be a reboot of the > reshape package? Because it doesn't work very well, as you've discovered. There's an equivalent join_all in plyr. Hadley -- Chief Scientist, RStudio

Re: [R] function coverage

2013-01-14 Thread Hadley Wickham
> I think codetools could do this reasonably well with the walkCode function, > but I've never done it so I don't have sample code, and walkCode is mostly > an internal function. There are a couple of approaches here: http://stackoverflow.com/questions/14276728/ Hadley -- Chief Scientist, RStud

Re: [R] First R Package --- Advice?

2013-02-06 Thread Hadley Wickham
> Other people have recommended Roxygen, but honestly I haven't seen a package > documented with Roxygen where the documentation was adequate. > It looks as though it's great to get initial documentation created, but does > not appear to encourage followup. I don't think that's a problem with roxy

Re: [R] First R Package --- Advice?

2013-02-06 Thread Hadley Wickham
>> I have heard of people using noweb to do this, but I can't point to any >> examples. I'd actually recommend against it. Good documentation files >> don't >> make good source files. > > the compiler package in base R is, apparently, developed using noweb > https://svn.r-project.org/R/trunk/src/

Re: [R] 2 setGeneric's, same name, different method signatures

2013-02-15 Thread Hadley Wickham
This is unfortunately reinforced by the "(Not So) Short Introduction to S4 Object Oriented Programming in R" - I wouldn't recommend that document to learn about S4. The most important thing to get about OO in R is that methods belong to generic functions, not like classes, as in most other program

Re: [R] ls() with different defaults: Solution;

2013-03-12 Thread Hadley Wickham
On Tue, Mar 12, 2013 at 12:59 PM, Szumiloski, John wrote: > Dear useRs, > > Some time ago I queried the list as to an efficient way of building a > function which acts as ls() but with a different default for all.names: > > http://tolstoy.newcastle.edu.au/R/e6/help/09/03/7588.html > > I have stru

Re: [R] categorized complete list of R commands?

2013-04-04 Thread Hadley Wickham
Here's a categorisation of all the functions in base and utils that I made recently (not sure if the csv will survive posting the list). Feedback welcomed - this was just a quick first pass, and it's not authoritative. Hadley On Thu, Apr 4, 2013 at 12:34 AM, ivo welch wrote: > every time I read t

Re: [R] quotes in cat() within function

2013-04-09 Thread Hadley Wickham
On Tue, Apr 9, 2013 at 3:06 AM, Daniel Caro wrote: > Hello all, > > Sorry if this question has been answered in the past, but I could not find > an answer. > > I am trying to print quotes within a cat output. The arguments are: > > file= "Data labels" > directory= "/home/mylaptop/" > > The functio

Re: [R] Stringr Package

2013-04-10 Thread Hadley Wickham
> with(dat, data.frame(X=rep(X, each=2), Y=unlist(strsplit(Y, split=" - " str_split_fixed would be a bit safer here. Hadley -- Chief Scientist, RStudio http://had.co.nz/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-

[R] 10% off Intro R training from RStudio: NYC May 13-14, SF May 20-21

2013-04-16 Thread Hadley Wickham
Hi all, At RStudio, we're hosting our Introduction to R Workshop this May in two locations. As an R-help subscriber, we're offering 10% off! * Intro to data science with R (http://goo.gl/bplg3) May 13-14 New York City * Intro to data science with R (http://goo.gl/VCUFL) May 20-21 San Francis

Re: [R] 10% off Intro R training from RStudio: NYC May 13-14, SF May 20-21

2013-04-16 Thread Hadley Wickham
-- please excuse typos. > > On Apr 16, 2013, at 8:09 AM, Hadley Wickham wrote: > >> Hi all, >> >> At RStudio, we're hosting our Introduction to R Workshop this May in >> two locations. As an R-help subscriber, we're offering 10% off! >>

Re: [R] NAMESPACE and imports

2013-04-19 Thread Hadley Wickham
Hi Frank, The problem is you can't lump together multiple S3 methods. Instead of: > S3method(latex, anova.rms, bj, cph, Glm, Gls, lrm, naprint.delete, ols, > pphsm, psm, rms, Rq, summary.rms, validate) You need S3method(latex, anova.rms) S3method(latex, bj) S3method(latex, cph) etc. Hadley

Re: [R] identify object that causes "Error in loadNamespace(name) : there is no package called ‘R.utils’"

2013-04-24 Thread Hadley Wickham
> I must admit that I'm a bit surprised by this. I was always under the > impression that saving/restoring workspaces was the proper workflow in > R. If you use R interactively (e.g., not by running scripts), how else > would you store your data, intermediary results, etc., while working > on a pro

Re: [R] Need help to building R package with devtools

2013-05-14 Thread Hadley Wickham
>> Can someone help what I need to do to make 'devtools' work? > > A quick asking around indicates that Rtools 3.0 should work fine for 2.15.3 > maintenance. Thus, the issue is probably a purely formal bug in devtools's > version comparison logic, and you need to pester its maintainer. Unless it

Re: [R] Lexical scoping is not what I expect

2013-06-27 Thread Hadley Wickham
> I too find R's lexical scoping rules straightforward. > However, I'd say that if your code relies on lexical scoping to find > something, you should probably rewrite your code. Except of course that almost every function relies on lexical scoping to some extent! Do you want: f <- function(a,

Re: [R] multi-column factor

2012-09-17 Thread Hadley Wickham
If you have a million levels is it really necessary to use a factor? I'm not sure what advantages it will to have to a string in this circumstance (especially since you don't seem to know the levels a priori but have to learn them from the data). Hadley On Sunday, September 16, 2012, Sam Steingol

Re: [R] qplot: plotting precipitation data

2012-09-20 Thread Hadley Wickham
s = levels) mydata$end <- factor(mydata$end, levels = levels) ggplot(mydata, aes(x = start)) + geom_rect(aes(xmin = start, xmax = end, ymin = 0, ymax = peak)) + xlim(as.character(levels)) On Sun, Sep 16, 2012 at 11:11 AM, Rui Barradas wrote: > Maybe a bug in ggplot2::geom_rec

Re: [R] New Submission to CRAN note

2012-09-22 Thread Hadley Wickham
After uploading your package via ftp, in your email to c...@r-project.org you need to state that you agree to the CRAN repository policy (http://cran.r-project.org/web/packages/policies.html) Hadley On Sat, Sep 22, 2012 at 1:02 AM, Christopher Desjardins wrote: > Hi, > I want to submit a package

Re: [R] Is there a way to source from a specific Git repository without hardcoding the location everywhere?

2012-09-27 Thread Hadley Wickham
>> where myProject is a package containing all the scripts, written as >> functions. > > Yes, the eventual fate of these functions is expected to be a package. I'd > like the pushed/pulled code to be runable as is without an intermediate > step of package creation or gsub()ing hardcoded paths. You

Re: [R] Is there a way to source from a specific Git repository without hardcoding the location everywhere?

2012-09-27 Thread Hadley Wickham
>> > I'd like to have the code source files from the 'local' git repository >> > without modification, where 'local' could mean c:\yada\ for one > person, >> > m:\my documents\wetlands\ for another, and > l:\foo\bar\sharedRemote\wet\ to >> > another user. >> > ... >> >> Yes. Use >> >> library(myPr

Re: [R] Is there a way to source from a specific Git repository without hardcoding the location everywhere?

2012-09-27 Thread Hadley Wickham
> I would usually do more than that: I find the R documentation system > helpful even when I'm the only user of a package (and there are the prompt* > functions for quickly creating it, as well as package.skeleton to set things > up at the beginning). Vignettes are a great way to organize and doc

Re: [R] Basic question about: <<- and method start with dot.

2012-10-02 Thread Hadley Wickham
>> What is the special meaning for the method name start with a dot? > > It means nothing in particular, except that such objects don't show up in > ls() by default. The _intention_ is usually that the function is only to be > used internally and not for end-user use. But these days, if you're w

Re: [R] Regarding licensing Terms

2012-10-03 Thread Hadley Wickham
> Most critical issues vis-a-vis open source licenses come into play when you > cross the line from simply being a user/developer to copying and > distributing. In the latter case, whether you plan to charge for the > resultant product or make it available for free, is irrelevant. I think the m

Re: [R] print and execute functions in a package namespace

2012-10-30 Thread Hadley Wickham
> But I need to work with the names of the figure functions instead, something > like > > figlist <- paste0("fig", 1:3) Are the functions exported or internal? # Use for internal functions pkg <- asNamespace("mypackage") # Use for exported functions: pkg <- "package:mypackage" # Find functions m

Re: [R] getting arg names in function calls?

2014-04-08 Thread Hadley Wickham
You might find it helpful to read http://adv-r.had.co.nz/Expressions.html, and look at pryr:: standardise_call(). Hadley On Tue, Apr 8, 2014 at 6:52 PM, Spencer Graves wrote: > Hi, Bill: > > > Thanks for the reply. Unfortunately, I don't see how that solves the > example I gave of extract

Re: [R] R, RStudio, and a server for my iPad.

2014-04-11 Thread Hadley Wickham
Even if you do get Rstudio running on a server, unfortunately it won't help. The ipad doesn't support quite enough html to get a fully functional Rstudio interface - almost everything works but you can't type anything :/ It would be possible to fix this, but fundamentally we don't believe that the

Re: [R] R, RStudio, and a server for my iPad.

2014-04-11 Thread Hadley Wickham
BT/18/GR) > Baltimore, MD 21201-1524 > (Phone) 410-605-7119 > (Fax) 410-605-7913 (Please call phone number above prior to faxing) >>>> Hadley Wickham 4/11/2014 6:01 PM >>> > > Even if you do get Rstudio running on a server, unfortunately it won't > help.

Re: [R] Growth of CRAN?

2014-04-14 Thread Hadley Wickham
For finer level detail, have a look at https://github.com/hadley/cran-packages. It contains the description file of every package ever uploaded to CRAN (the cache is a few months out of date, but you can easily re-run) Hadley On Sun, Apr 13, 2014 at 12:59 PM, Spencer Graves wrote: > What d

Re: [R] Growth of CRAN?

2014-04-14 Thread Hadley Wickham
Yes, because it has every version of every DESCRIPTION. Hadley On Mon, Apr 14, 2014 at 11:13 AM, Spencer Graves wrote: > Hi, Hadley: > > > > On 4/14/2014 5:53 AM, Hadley Wickham wrote: >> >> For finer level detail, have a look at >> https://github.com/hadl

Re: [R] get element of list with default?

2014-04-15 Thread Hadley Wickham
You really want to use the names of the list since lists can contain null. I'd recommend something more like: getElement <- function(x, i, default) { if (i %in% names(x)) return(x[[i]]) default } Hadley On Tue, Apr 15, 2014 at 10:53 AM, Spencer Graves wrote: > Hello: > > > Do you kno

Re: [R] as.character(quote(x$y) ) = "$" "x" "y" not "x$y"?

2014-05-09 Thread Hadley Wickham
Beware of the is.* functions: * is.object() does not test the usual definition of objects * is.vector() does not test the usual definition of vectors * is.numeric() does not work the same way as is.character() or is.integer() * is.Date() doesn't exist * is.nan() doesn't return TRUE for some NaNs

Re: [R] Documenting docType data

2014-05-20 Thread Hadley Wickham
Don't export the dataset? (as mentioned in the answer to that question). If that doesn't help, please supply a minimal reproducible example. Hadley On Tue, May 20, 2014 at 3:35 AM, Witold E Wolski wrote: > Hi, > > I am Trying to document data using roxygen2 by following the > stackoverflow quest

Re: [R] Rscript fails where Rterm works

2014-06-12 Thread Hadley Wickham
Explicitly load the methods package: library(methods) Hadley On Thu, Jun 12, 2014 at 2:22 PM, Bond, Stephen wrote: > I have a script which loads > > library(XLConnect) > wb <- loadWorkbook("wbname") > > the code works without errors when run from ESS which uses > R version 3.0.1 (2013-05-16) --

Re: [R] Best practice: to factor or not to factor for float variables

2014-07-04 Thread Hadley Wickham
alysis techniques. > > In my particular case, I have measurements of several variables at > several, sometimes equal, heights. Following the tidy data approach of > Hadley Wickham, I want to put all data in one data frame. In principle, > the height variable is something like a

Re: [R] list of valid R encodings.in source(...,encoding=)

2014-07-11 Thread Hadley Wickham
It's documented in the Encodings section of ?file: "As from R 3.0.0 the encoding "UTF-8-BOM" is accepted for reading and will remove a Byte Order Mark if present (which it often is for files and webpages generated by Microsoft applications). If it is required (it is not recommended) when writing i

Re: [R] String comparison, trailing blanks make a difference.

2014-07-19 Thread Hadley Wickham
If you have unicode strings, you may need to do even more because there are often multiple ways of representing the same glyph. I made a little demo at http://rpubs.com/hadley/unicode-normalisation, since any unicode characters are likely to get mangled by email. Hadley On Fri, Jul 18, 2014 at 11

Re: [R] A general question: Is language S a component part of R?

2012-11-05 Thread Hadley Wickham
On Monday, November 5, 2012, Rolf Turner wrote: > On 06/11/12 09:40, Iurie Malai wrote: > >> So, R (as a language) can be viewed as an extended S language (S + some >> improvements)? And the R environment includes this (extended) language + >> extensions? >> > > Are others getting as sick of this

Re: [R] devtools - document() weiredness

2012-11-14 Thread Hadley Wickham
> I know this scenario is strange as there's no roxygenizable stuff in the > package, but I am trying to track down an identical error in one of my > nascent packages and am wondering > 1) where this behavior originates and > 2) why document() does not provide more informative feedback. See https:

Re: [R] ggplot2: "varwidth"-equivalent for geom_boxplot?

2012-11-18 Thread Hadley Wickham
> I'd like to resurrect this issue: is the "varwidth" equivalent (boxplot > box-width scaling according to number of data points) emulatable in the > 0.9.* versions of ggplot2? Width still doesn't seem capable of accepting a > vector with length > 1 ... No, and it's not currently on the to do list

Re: [R] gc() vs memory.profile()

2013-12-27 Thread Hadley Wickham
Hi Ross, It's not obvious how useful memory.profile() is here. I created the following little experiment to help me understand what memory.profile() is showing (and to make it easier to see the changes), but it's left me more confused than enlightened: m_delta <- function(expr) { # Evaluate in

Re: [R] Package dependencies in building R packages

2013-12-31 Thread Hadley Wickham
> Thanks for your kind response Duncan. To be more specific, I'm using the > function mvrnorm from MASS. The issue is that MASS depends on survival and > I have a function in my package named tt() which conflicts with a function > in survival of the same name. I can think of 2 alternatives solution

Re: [R] RSQLite: Tracking an error message to its source

2014-01-05 Thread Hadley Wickham
> Can you, or anyone, give me any hint on where -- no, not where, _how_ -- to > find the code for any of the functions called between dbGetQuery method for > conn="SQLiteConnection", or for any of the functions that are called by the > dbGetQuery method for SQLite connections that are in the chain

Re: [R] RSQLite: Tracking an error message to its source

2014-01-05 Thread Hadley Wickham
> Though I admit that it bothers me that, although the SQLite syntax > documentation for "CREATE INDEX", here: > http://www.sqlite.org/lang_createindex.html > does say the database name is optional, it also says that, if you include > it, the period the period between the db name and the table nam

[R] The R Journal, Volume 5, Issue 2

2014-01-07 Thread Hadley Wickham
Dear all, The latest issue of The R Journal is now available at http://journal.r-project.org/archive/2013-2/ Many thanks to all contributors. Hadley -- Editor-in-chief, The R Journal ___ r-annou...@r-project.org mailing list https://stat.ethz.ch/mail

Re: [R] recoding table dimensions interactively

2014-01-09 Thread Hadley Wickham
Hi Michael, It's pretty easy with reshape: library(reshape2) ucbm <- melt(UCBAdmissions) acast(ucbm, Admit + Gender ~ Dept) acast(ucbm, Admit ~ Dept + Gender) acast(ucbm, Admit + Dept + Gender ~ .) # You can also do aggregations acast(ucbm, Admit ~ Dept, fun = sum) Hadley On Thu, Jan 9, 2014 a

Re: [R] Find the package of a class given classname

2014-01-13 Thread Hadley Wickham
>> How to find the package of a class given classname? >> For example, there is a class called GAlignments, I want to do something >> like >> attr("GAlignments", "package") that gives you the package where the class >> is defined? But of course, attr("GAlignments", "package") won't work... > > You

Re: [R] Type III tests and Cox models

2014-01-20 Thread Hadley Wickham
To save others a little hunting, you can read the vignette online at http://cran.r-project.org/web/packages/survival/vignettes/tests.pdf Hadley On Mon, Jan 20, 2014 at 11:47 AM, Terry Therneau wrote: > Someone asked a question about this on the list a couple months ago. I > replied that I didn'

Re: [R] Understanding namespace for plyr / dplyr

2014-01-29 Thread Hadley Wickham
If you load plyr first, then dplyr, I think everything should work. dplyr::summarise works similarly enough to plyr::summarise that it shouldn't cause problems. Hadley On Wed, Jan 29, 2014 at 4:19 PM, Trevor Davies wrote: > I think I have a hole in my understanding of how R uses packages (or at

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 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 its > libraries

Re: [R] Packages Depending on my package

2014-02-06 Thread Hadley Wickham
> Is there a way to determine which, if any, CRAN packages depend on my CRAN > package, mondate? > devtools::revdep("mondate") [1] "zoo" If you want to contact the maintainers: > devtools::revdep_maintainers("mondate") [1] "Achim Zeileis " If you want all recursive dependencies: > length(devt

Re: [R] Change data format query

2014-02-19 Thread Hadley Wickham
You might want to try reading http://vita.had.co.nz/papers/tidy-data.html, which lays out the principles by which you might want to organise your data, matching each task with the appropriate reshape2 function. Hadley On Wed, Feb 19, 2014 at 9:18 AM, drruddy gmail wrote: > > # Data manipulation

Re: [R] CRAN policies - citing others

2014-02-20 Thread Hadley Wickham
I believe this is what you should do: * In the lbfgsb.cpp from base R, include the GPL blurb and R copyright holders. Also add your own names. (see e.g. https://github.com/hadley/pryr/blob/master/src/typename.cpp) * In the DESCRIPTION, add the R core team as a contributor, https://github.com/had

Re: [R] Survfit error

2014-03-07 Thread Hadley Wickham
On Fri, Mar 7, 2014 at 6:46 AM, Therneau, Terry M., Ph.D. wrote: >>> The help page for the survfit function says it expects a formula as its >>> first argument so try: >>> >>> > sleepfit <- survfit(Surv(timeb, death)~1, data = sleep) >>> >>> David >>> Sent from my iPhone ... so unable to test. >>>

Re: [R] Syntax for order()

2014-03-25 Thread Hadley Wickham
If you want to continue to be spoiled, try: library(dplyr) arrange(dat1, val) Hadley On Tue, Mar 25, 2014 at 2:20 PM, John Kane wrote: > Thank. > > Once I got Sarah's email I realised I should have been usling with(). > Hadley's ggplot syntax has spoiled/confused me. > > John Kane > Kingston

Re: [R] using data.table ,plyr

2014-03-27 Thread Hadley Wickham
It's rude to ask a question both on r-help and on stackoverflow (http://stackoverflow.com/questions/22685896), because people might spend their time answering your question when it's already been answered elsewhere. Hadley On Thu, Mar 27, 2014 at 6:01 AM, Rohit Gupta wrote: > I have a data A whi

Re: [R] Environment variable defined in .bashrc is not recognized by R

2014-04-01 Thread Hadley Wickham
Use .Renviron Hadley On Tue, Apr 1, 2014 at 2:33 AM, Luca Cerone wrote: > Thanks, > effectively I was using RStudio (on an Ubuntu 12.04 machine). > > Is there any other way to make the variable available to Rstudio? > Now I have simply written the path manually, but I like the idea of > having a

Re: [R] microbenchmark

2013-09-17 Thread Hadley Wickham
I'm not sure why either, but here's a simpler (and much faster) illustration of the problem: library(microbenchmark) A <- matrix(1:9,3) replicate(10, microbenchmark(colMeans(A), times = 4)$time) replicate(10, microbenchmark(A, times = 4)$time) Hadley On Mon, Sep 16, 2013 at 8:11 AM, Christophe

Re: [R] speeding up "sum of squared differences" calculation

2013-10-22 Thread Hadley Wickham
> There's little practical difference; both hover from 0.00 to 0.03 s system > time. I could barely tell the difference even averaged over 100 runs; I was > getting an average around 0.007 (system time) and 2.5s user time for both > methods. It's almost always better to use a high precision tim

Re: [R] S4; Setter function is not chaning slot value as expected

2013-11-09 Thread Hadley Wickham
Modelling a mutable entity, i.e. an account, is really a perfect example of when to use reference classes. You might find the examples on http://adv-r.had.co.nz/OO-essentials.html give you a better feel for the strengths and weaknesses of R's different OO systems. Hadley On Sat, Nov 9, 2013 at 9

Re: [R] Functional Programming patterns

2013-11-20 Thread Hadley Wickham
I have some notes on functional programming in R at http://adv-r.had.co.nz/. Hadley On Wed, Nov 20, 2013 at 3:02 AM, wrote: > Hi, > ' > Not specific to 'R'. I search for patterns and found > http://patternsinfp.wordpress.com/ which is too heavy for me. There is a > 'Pragmatic Programmer' book o

Re: [R] Should there be an R-beginners list?

2013-11-25 Thread Hadley Wickham
>> I do not see how it can be illegal to download and duplicate the >> posts, since all the content is licensed under CC BY-SA. I might have >> missed something there: http://stackexchange.com/legal If that is >> really the case, I think I will have to reconsider if I should use it >> any more. > >

Re: [R] Should there be an R-beginners list?

2013-11-25 Thread Hadley Wickham
Here's a similar plot for stackoverflow: http://data.stackexchange.com/stackoverflow/query/150130/r-questions-and-answers-per-year#graph and one broken down by month http://data.stackexchange.com/stackoverflow/query/150129/r-questions-and-answers-per-month#graph Hadley On Mon, Nov 25, 2013 at 9:

Re: [R] Should there be an R-beginners list?

2013-11-25 Thread Hadley Wickham
Oops, I misunderstood the database schema, and that only includes _questions_ tagged R, not the corresponding answers. Hadley On Mon, Nov 25, 2013 at 9:55 AM, Hadley Wickham wrote: > Here's a similar plot for stackoverflow: > http://data.stackexchange.com/stackoverflow/query/150130/

Re: [R] ifelse -does it "manage the indexing"?

2013-12-03 Thread Hadley Wickham
A better solution to this problem is to use character indexing: x <- c("Tuesday", "Thursday", "Sunday") c(Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6, Sunday = 7)[x] http://adv-r.had.co.nz/Subsetting.html#lookup-tables-character-subsetting Hadley On Mon, Dec 2

Re: [R] roxygen2 and install.packages()

2013-12-09 Thread Hadley Wickham
Unfortunately roxygen2 3.0.0 now requires R 3.0.2. See https://github.com/klutometis/roxygen/issues/163 for some discussion as to why. Hadley On Mon, Dec 9, 2013 at 12:28 PM, François Lefebvre wrote: > Hi, I am unable to install roxygen2 on R<3.0.2. Any idea why? > > > >> install.packages("roxyg

Re: [R] Graphics question: How to create a changing "smudge factor" for overlapping lines?

2010-06-15 Thread Hadley Wickham
> My current solution is to use a constant jitter (based on "seq") on all the > k number of clusters, but that causes glitches in the produced image (run my > code to see). What are the glitches? It looks pretty good to me. (I'm not sure if the colour does anything apart from make it pretty thou

Re: [R] Graphics question: How to create a changing "smudge factor" for overlapping lines?

2010-06-15 Thread Hadley Wickham
> The glitches are the cases where you would have a bundle of lines belonging > to a specific cluster, but had spaces between them (because the place of one > of the lines was saved for another line that in the meantime moved to > another cluster). I think that display looked just fine! > I just

Re: [R] Popularity of R, SAS, SPSS, Stata...

2010-06-20 Thread Hadley Wickham
> I agree with all your points. What I have so far is nowhere near the big > picture, but it's a start. When you install some software it asks if you > mind it reporting usage stats back to its home site. I know that sort of > thing has been discussed before on R-help. I'd love to see that added so

Re: [R] Popularity of R, SAS, SPSS, Stata...

2010-06-20 Thread Hadley Wickham
> I've given thought in the past to the question of estimating the R > user base, and came to the conclusion that it is impossible to get > an estimate of the number of users that one could trust (or even > put anything like a margin of error to). I find it hard to believe that it should be harder

Re: [R] Time in ggplot2

2010-06-20 Thread Hadley Wickham
Hi Ottar, It's impossible to tell what the problem is without a reproducible example (http://gist.github.com/270442) Hadley On Sun, Jun 20, 2010 at 4:38 PM, Ottar Kvindesland wrote: > I have a problem that puzzles me a bit today. When loading off data from a > database and plotting using ggplot

Re: [R] Time in ggplot2

2010-06-20 Thread Hadley Wickham
six months, particularly with values that > have no  time portion. You have promised a fix before, but l haven't seen it, > so I convert to Date to work around the bug. > > "Hadley Wickham" wrote: > >>Hi Ottar, >> >>It's impossible to tell what th

Re: [R] Time in ggplot2

2010-06-22 Thread Hadley Wickham
y > similar SQL set. The select clause carries more coloumns in the failing data > set. > > ottar > > On 20 June 2010 18:28, Hadley Wickham wrote: >> >> Hi Ottar, >> >> It's impossible to tell what the problem is without a reproducible >> example (http:/

Re: [R] xtable for latex: setting some values globally

2010-06-23 Thread Hadley Wickham
> If anybody has quick fix, that would be helpful. Write your own function that wraps xtable... Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/ __ R-help@r-project.org mailing

Re: [R] About normality tests...

2010-06-23 Thread Hadley Wickham
> Finally, FWIW, 1 is not considered "very large" these days; maybe > 10,000,000,000 might be... It's off topic, but I rather like Mike Driscoll's definition of big data: it's too big to fit on a single machine and must be stored on many (http://www.slideshare.net/dataspora/s-4455027). A smal

Re: [R] ggplot2: deterministic position_jitter & geom_line with position_jitter

2010-06-25 Thread Hadley Wickham
> I'm having the same problem as Stephan (see below), but what I'm trying to > jitter is not a numeric vector, but a factor. How do I proceed? (Naively > jittering a factor makes it numeric, no longer factor, so I don't get the > custom ordering which conveniently comes with using a factor. I'm not

Re: [R] Stacked Histogram, multiple lines for dates of news stories?

2010-06-28 Thread Hadley Wickham
Hi Simon, Here are two ways to do that with ggplot: qplot(test2, data = test_df, geom = "freqpoly", colour = test, binwidth = 30, drop = F) qplot(test2, data = test_df, geom = "bar", fill = test, binwidth = 30) binwidth is in days. If you want to bin by other intervals (like months), I'd recomm

Re: [R] Basic question - more efficient method than loop?

2010-06-28 Thread Hadley Wickham
1) Create a table with two columns: payor and payor.group. 2) Merge that table with your original data Hadley On Mon, Jun 28, 2010 at 10:46 AM, GL wrote: > > I'm guessing there's a more efficient way to do the following using the index > features of R. Appreciate any thoughts > > for (i in

[R] Performance enhancement for ave

2010-06-28 Thread Hadley Wickham
library(plyr) n<-10 grp1<-sample(1:750, n, replace=T) grp2<-sample(1:750, n, replace=T) d<-data.frame(x=rnorm(n), y=rnorm(n), grp1=grp1, grp2=grp2) system.time({ d$avx1 <- ave(d$x, list(d$grp1, d$grp2)) d$avy1 <- ave(d$y, list(d$grp1, d$grp2)) }) # user system elapsed # 39.300 0.279

Re: [R] Performance enhancement for ave

2010-06-29 Thread Hadley Wickham
On Tue, Jun 29, 2010 at 8:02 AM, Matthew Dowle wrote: > >> dt = data.table(d,key="grp1,grp2") >> system.time(ans1 <- dt[ , list(mean(x),mean(y)) , by=list(grp1,grp2)]) >   user  system elapsed >   3.89    0.00    3.91        # your 7.064 is 12.23 for me though, so this > 3.9 should be faster for y

Re: [R] transposing a data frame from horizontal to vertical (stacking)

2010-06-29 Thread Hadley Wickham
On Tue, Jun 29, 2010 at 12:22 PM, Dimitri Liakhovitski wrote: > Hello, everyone! > I have a very simple task - I have a data frame (see MyData below) and > I need to stack the data (see result below). > I wrote the syntax below - it's very basic and it does what I need. > But I am sure what I am t

Re: [R] anyone know why package "RandomForest" na.roughfix is so slow??

2010-07-01 Thread Hadley Wickham
Here's another version that's a bit easier to read: na.roughfix2 <- function (object, ...) { res <- lapply(object, roughfix) structure(res, class = "data.frame", row.names = seq_len(nrow(object))) } roughfix <- function(x) { missing <- is.na(x) if (!any(missing)) return(x) if (is.numer

[R] Some questions about R's modelling algebra

2010-07-02 Thread Hadley Wickham
Hi all, In preparation for teaching a class next week, I've been reviewing R's standard modelling algebra. I've used it for a long time and have a pretty good intuitive feel for how it works, but would like to understand more of the technical details. The best (online) reference I've found so far

Re: [R] Some questions about R's modelling algebra

2010-07-02 Thread Hadley Wickham
> ?formula in R 2.9.2 says in para 2: > "The %in% operator indicates that the terms on its left are nested > within those on the right. For example a + b %in% a expands to the > formula a + a:b. " Ooops, missed that. So b %in% a = a:b, and that's what's meant by "different coding". Hadley -- A

[R] Non-exported data sets?

2010-07-03 Thread Hadley Wickham
> Sure.  The code uses objects() to find the exported objects in the > package, so I guess the offending object will be there.  You can check > for yourself by loading the package and calling objects() on the package > environment. So I guess my question then is how do data sets and namespaces int

Re: [R] ggplot qplot bar removing bars when truncating scale

2010-07-03 Thread Hadley Wickham
This is possible in ggplot2, but it's an not appropriate use of a bar chart - because length is used to convey value, chopping the bottoms of the bars of will give a misleading impression of the data. Instead, use a dot plot: data$Q <- unlist(lapply(data$Q, function(x) paste(strwrap(x, 20), collap

Re: [R] Separating out data values

2010-07-04 Thread Hadley Wickham
Hi Mark, Try this to get you started: table(roe1 > median(roe1), roe0 > median(roe0)) Hadley On Sun, Jul 4, 2010 at 6:29 AM, Mark Carter wrote: > I'm not very good at statistics, but I know enough to be dangerous. I'm > completely new to R, having just discovered it yesterday. Now that the >

Re: [R] Patch for legend.position={left,top,bottom} in ggplot2

2010-07-05 Thread Hadley Wickham
Or wait a couple of days for the next release of ggplot2... Hadley On Mon, Jul 5, 2010 at 11:28 AM, Sebastian Wurster wrote: > Thank you for this nice patch! > To incorporate it you have to open the ggplot2 file in "path to your R > packages\ggplot2\R", search for the first line of code and repl

Re: [R] Profiler for R ? (HFWUtils package)

2010-07-06 Thread Hadley Wickham
And the profr package for an alternative display. Hadley On Tuesday, July 6, 2010, Uwe Ligges wrote: > or just see > > ?Rprof > > and > > ?Rprofmem > > > Uwe Ligges > > > On 06.07.2010 01:21, Jim Callahan wrote: > > Message: 21 > Date: Mon, 5 Jul 2010 02:26:29 -0400 > From: Ralf B > To: "r-help@r

[R] [R-pkgs] ggplot2 version 0.8.8

2010-07-07 Thread Hadley Wickham
ggplot2 ggplot2 is a plotting system for R, based on the grammar of graphics, which tries to take the good parts of base and lattice graphics and avoid bad parts. It takes care of many of the fiddly details that make plotting a hassle (l

Re: [R] Fast string comparison

2010-07-11 Thread Hadley Wickham
== ? Hadley On Sun, Jul 11, 2010 at 2:08 PM, Ralf B wrote: > What is the fastest way to compare two strings in R? > > Ralf > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http

Re: [R] a very particular plot

2010-07-11 Thread Hadley Wickham
Hi Ian, Have a look at the examples in http://had.co.nz/ggplot2/geom_tile.html for some ideas on how to do this with ggplot2. Hadley On Sat, Jul 10, 2010 at 8:10 PM, Ian Bentley wrote: > Hi all, > > Thanks for the really great help I've received on this board in the past. > > I have a very part

Re: [R] Fast string comparison

2010-07-12 Thread Hadley Wickham
strings <- replicate(1e5, paste(sample(letters, 100, rep = T), collapse = "")) system.time(strings[-1] == strings[-1e5]) # user system elapsed # 0.016 0.000 0.017 So it takes ~1/100 of a second to do ~100,000 string comparisons. You need to provide a reproducible example that illustrates

Re: [R] How to define a function (with '<-') that has two arguments?

2010-07-14 Thread Hadley Wickham
On Wed, Jul 14, 2010 at 7:39 AM, thmsfuller...@gmail.com wrote: > Hi All, > > The last line if the following code returns the error right below this > paragraph. Essentially, I use the operator %:% to retrieve a variable > in a nested frame. Then I want to use the same operator (with '<-') to > ch

Re: [R] [R-pkgs] New package "list" for analyzing list surveyexperiments

2010-07-15 Thread Hadley Wickham
>> For some reason package writers seem to prefer maximally uninformative >> names for their packages.  To take some examples of recently announced >> packages, can anyone guess what packages 'FDTH', 'rtv', or 'lavaan' >> do?  Why the aversion to informative names along the lines of >> 'Freq_dist_a

Re: [R] qplot in ggplot2 not working any longer - (what did I do?)

2010-07-15 Thread Hadley Wickham
For a quick fix, you probably need to reinstall plyr. Hadley On Wed, Jul 14, 2010 at 11:03 PM, stephen sefick wrote: > This is the first time that I have tried to update packages with a > tinkered around with .Rprofile.  I start R with R --vanilla and it > does not load my .Rprofile, but when I i

Re: [R] Recommended way of requiring packages of a certain version?

2010-07-16 Thread Hadley Wickham
> So distributing code to other people is preferably done using R packages, > which gives you this option. However (as far as I am aware), note that this option is checked at package build time, not at load time. Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statist

Re: [R] a very particular plot

2010-07-16 Thread Hadley Wickham
On Wed, Jul 14, 2010 at 1:32 AM, Ian Bentley wrote: > I've got a couple of more changes that I want to make to my plot, and I > can't figure things out.  Thanks for all the help. > > I'm using this R script > > library(ggplot2) > library(lattice) > # Generate 50 data sets of size 100 and assign th

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