I'd propose an alternative that I think is superior: rely on the semantics
of ... to do the work for you:
f1 <- function(...){
one <- list(...)[['a']]
two <- ...elt(match('a', ...names()))
c(one, two, three(...))
}
three <- function(a, ...) {
a
}
f1(a = 1, b = 2, c = 3)
#> [1] 1 1 1
On
Out of interest, I asked chatGPT to take the original code, convert it to
tidyverse style, use the base pipe, and collapse to a single mutate
(interestingly I didn't need to explicitly ask to use across() and
case_when), and I got code pretty similar to yours:
df3 <- df0 |>
mutate(
across(st
The place to start for such problems is always usethis::git_sitrep()
Hadley
On Thu, Jun 20, 2024 at 11:17 PM Robert Baer wrote:
> I am trying to install a package from github which has worked fine in
> the past, but now seems to be stuck on some new authentication issues.
> Does anyone know how
You're getting confused between the contents of the string and the
printed representation of the string. There's a little bit about this
in R4DS: https://r4ds.hadley.nz/strings#escapes
(or in brief, do writeLines(trailing.7.message))
Hadley
On Fri, Sep 8, 2023 at 7:23 AM Christopher Ryan via R-h
These days I'd recommend duckdb
(https://cran.r-project.org/web/packages/duckdb/index.html) instead.
It's a similar design to RSQLite (i.e. you don't need a separate
server) but it's designed for the needs of data science.
Hadley
On Tue, Aug 29, 2023 at 9:22 AM Martin Møller Skarbiniks Pedersen
You might find this chapter of R for Data Science helpful:
https://r4ds.hadley.nz/databases
Hadley
On Tue, Aug 29, 2023 at 3:47 AM Stephen H. Dawson, DSL via R-help
wrote:
>
> Good Morning,
>
>
> I am doing some research to develop a new course where I teach. I am
> looking for a book to use in
It sounds like you might want a rolling join, e.g.
https://dplyr.tidyverse.org/reference/join_by.html#rolling-joins.
(And data.table has similar functionality which inspired dplyr)
Hadley
On Mon, Aug 7, 2023 at 9:32 PM Naresh Gurbuxani
wrote:
>
>
> I have two dataframes, each with a column for
> I am not sure what your example means but text to image conversion can be
> done quite easily in many programming environments and does not need an AI
> unless you are using it to hunt for info. I mean you can open up many Paint
> or Photo programs and look at the menus and often one allows you
I'm not aware of widespread problems, but it's possible that some
combination of OS, RStudio version, and R version might be causing
problems. Unfortunately I don't think there's enough information in
this thread for anyone to tell if that's the case.
Hadley
On Fri, Apr 7, 2023 at 1:18 PM Sorkin,
This often indicates you need to restart R.
Hadley
On Friday, February 3, 2023, Nick Wray wrote:
> Hello When trying to call various packages eg
> library(raster)
> library(sp)
> library(rgdal)
>
> I get this error message:
> Loading required package: sp
> Error: package or namespace load faile
On Sun, Dec 4, 2022 at 1:22 PM wrote:
>
> This may be a fairly dumb and often asked question about some functions like
> strsplit() that return a list of things, often a list of ONE thing that be
> another list or a vector and needs to be made into something simpler..
>
> The examples shown bel
On Sun, Dec 4, 2022 at 12:50 PM Hervé Pagès wrote:
>
> On 03/12/2022 07:21, Bert Gunter wrote:
> > Perhaps it is worth pointing out that looping constructs like lapply() can
> > be avoided and the procedure vectorized by mimicking Martin Morgan's
> > solution:
> >
> > ## s is the string to be sear
If this happens again in the future, you might try the development
version of pak:
install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/";)
pak::pak("tidyverse")
pak automatically diagnoses a number of common problems that causes
install.packages() to fail.
Hadley
On Sun, Apr 25,
On Tuesday, January 12, 2021, Duncan Murdoch
wrote:
> On 12/01/2021 1:12 p.m., Sigbert Klinke wrote:
>
>> Hi,
>>
>> thanks a lot, but maybe I was to vague.
>>
>> I do not want to replace \eqn{...} and \deqn{...} by \mjseqn{...} and
>> \mjsdeqn{...}. I would like to use $...$ and $$...$$ as in Rma
I'd recommend two places to get started:
* https://r4ds.had.co.nz/data-visualisation.html for a quick intro to
ggplot2 (and the rest of the book explains the general tidyverse
philosophy)
* https://ggplot2-book.org for the full details of ggplot2.
Hadley
On Wed, Nov 18, 2020 at 11:37 AM C W wr
On Wed, Aug 19, 2020 at 10:03 AM Ivan Calandra wrote:
>
> Dear useRs,
>
> I'm new to the tidyverse world and I need some help on basic things.
>
> I have the following tibble:
> mytbl <- structure(list(files = c("a", "b", "c", "d", "e", "f"), prop =
> 1:6), row.names = c(NA, -6L), class = c("tbl_d
> | but they won't receive any new
> | features, and we believe that there
> | are now better approaches to solving
> | the same problem.
>
> Is tidyr::pivot_longer this better
> solution? It is an easier to understand
> version of the now retired and confusing
> (for me) tidyr::gather which at le
features, and we believe that there are now better approaches to
solving the same problem.
Hadley
On Mon, Aug 17, 2020 at 3:58 AM Eric Berger wrote:
>
> Thanks for this information Thierry. I was not aware.
> The author of the packages is Hadley Wickham. He writes on Github that he
> d
You can get pretty close with label_number_si():
pounds <- scales::label_number_si(prefix = "£")
pounds(10 ^ (0:7))
#> [1] "£1""£10" "£100" "£1K" "£10K" "£100K" "£1M" "£10M"
Created on 2019-12-09 by the [reprex
package](https://reprex.tidyverse.org) (v0.3.0.9001)
Hadley
On Fri, Dec
See this new vignette in dev ggplot2:
https://ggplot2.tidyverse.org/dev/articles/ggplot2-in-packages.html
Hadley
On Saturday, November 16, 2019, Rolf Turner wrote:
>
> I need to call ggplot() from another function with the names of the
> faceting variables supplied as arguments to the calling f
On Wed, Apr 17, 2019 at 1:06 PM Jeff Newmiller wrote:
>
> From reading
>
> > namespace ‘rlang’ 0.3.0 is already loaded, but >= 0.3.1 is required
>
> it would seem that you need to upgrade your rlang package...
Typically this indicates you need to restart R.
Hadley
--
http://hadley.nz
rlang works with R 3.1 and up, but it does require compilation from
source, which I suspect is the root cause of this problem.
Hadley
On Wed, Mar 6, 2019 at 5:36 PM peter dalgaard wrote:
>
> Also, R seems to be version 3.2.x i.e. 3-4 years old. Earliest rlang is anno
> 2017 as far as I can tell
I'd highly recommend Yihui's extensive write up:
https://yihui.name/en/2018/09/notebook-war/
Hadley
On Thu, Oct 11, 2018 at 4:08 AM Spencer Graves
wrote:
>
> Hello:
>
>
>What are the differences between Jupyter notebooks and RMarkdown
> vignettes?
>
>
>I'm trying to do real time m
You need to recursively walk the parse tree/AST. See, e.g.,
https://adv-r.hadley.nz/expressions.html#ast-funs
Hadley
On Wed, Jun 20, 2018 at 10:08 AM, Sigbert Klinke
wrote:
> Hi,
>
> I have read an R program with
>
> expr <- parse("myRprg.R")
>
> How can I extract the parameters of a specifc R c
On Wed, May 2, 2018 at 11:53 AM, Jeff Newmiller
wrote:
> Another approach:
>
>
> library(tidyr)
> L <- list( A = data.frame( x=1:2, y=3:4 )
> , B = data.frame( x=5:6, y=7:8 )
> )
> D <- data.frame( Type = names( L )
>, stringsAsFactors = FALSE
>
Is there a reason that you can't use the binary provided by CRAN?
That's the easiest way to get xml2.
Hadley
On Sat, Feb 17, 2018 at 1:53 AM, Peter Meilstrup
wrote:
> i am trying to install xml2 from CRAN, and it is throwing an error
> that it cannot find the libxml2 library configuration.
>
> Th
Or try haven::read_xpt(): http://haven.tidyverse.org/reference/read_xpt.html
Hadley
On Thu, Nov 30, 2017 at 3:13 PM, Jim Lemon wrote:
> Hi SAS_learner,
> Have a look at the read.xport function in the foreign package.
>
> Jim
>
> On Fri, Dec 1, 2017 at 7:50 AM, SAS_learner wrote:
>> Hello all ,
> Did you read this?
> https://cran.r-project.org/doc/contrib/Leisch-CreatingPackages.pdf
>
> Maybe it could give you some insight in how to create package.
That resource is ~9 years old. There are more modern treatments
available. You can read mine at http://r-pkgs.had.co.nz.
Hadley
--
http:/
I just finished the first draft of the chapters on OO programming for
the 2nd edition of "Advanced R": https://adv-r.hadley.nz - you might
find them helpful.
Hadley
On Thu, Sep 14, 2017 at 7:58 AM, Alexander Shenkin wrote:
> Hello all,
>
> I am trying to decide how to structure an R package. Sp
This was a change in tidyr 0.7.0 that is causing a lot of confusion,
so we are preparing tidyr 0.7.1 which will back this change out.
If you want a work around in the meantime, you can express your
operation a bit more elegantly as:
library(tidyr)
df <- data.frame(v1 = 1:5, somestring = 6:10, v3
The most likely explanation is you have a new version of dplyr/tibble
and an old version of rlang. Try re-installing rlang.
Hadley
On Mon, Aug 14, 2017 at 9:26 AM, Szumiloski, John
wrote:
> UseRs,
>
> When doing some data manipulations using the tidyverse, I am repeatedly
> getting the same err
You might find http://adv-r.hadley.nz/s3.html to be helpful (in
particular, http://adv-r.hadley.nz/s3.html#constructors-1, gives my
advice about subclass constructors)
Hadley
On Mon, Aug 7, 2017 at 7:06 PM, Kym Nitschke wrote:
> Hi R Users,
>
> I am relatively new to programming in R … so I apol
On Thu, Jun 8, 2017 at 2:45 PM, Bert Gunter wrote:
> I think you may be confusing (S3) class and ?mode.
Your point is well made, but to be precise, I think you should talk
about the "type of" an object, not it's mode. mode() is a wrapper
around typeof(), designed (I believe) for S compatibility.
On Fri, May 19, 2017 at 6:38 AM, S Ellison wrote:
>> TRUE & FALSE is FALSE but TRUE & TRUE is TRUE, so TRUE & NA could be
>> either TRUE or FALSE and consequently is NA.
>>
>> OTOH FALSE & (anything) is FALSE so FALSE & NA is FALSE.
>>
>> As I said *think* about it; don't just go with your immedia
On Sun, Feb 19, 2017 at 3:01 PM, David Winsemius wrote:
>
>> On Feb 19, 2017, at 11:37 AM, C W wrote:
>>
>> Hi R,
>>
>> I am a little confused by the data.table package.
>>
>> library(data.table)
>>
>> df <- data.frame(w=rnorm(20, -10, 1), x= rnorm(20, 0, 1), y=rnorm(20, 10, 1),
>> z=rnorm(20, 20
On Mon, Feb 20, 2017 at 7:31 AM, Martin Maechler
wrote:
>> Hervé Pagès
>> on Tue, 14 Feb 2017 17:10:05 -0800 writes:
>
> > Hi, tapply() will work on any object 'X' that has a length
> > and supports single-bracket subsetting. These objects are
> > sometimes called "vector-
It seems like this should be consistent with split(), since that's
what actually powers the behaviour.
Reading the description for split leads to this rather interesting example:
tapply(mtcars, 1:11, I)
Hadley
On Tue, Feb 14, 2017 at 7:10 PM, Hervé Pagès wrote:
> Hi,
>
> tapply() will work on
E), "/WorkSet//Description")
>
> ## Produces the following error message.
> Error in UseMethod("xml_find_all") :
> no applicable method for 'xml_find_all' applied to an object of class
> "character"
>
>
>
> R. Mark Sharp, Ph.D.
See the last example in ?xml2::xml_find_all or use xml2::xml2::xml_ns_strip()
Hadley
On Tue, Jan 31, 2017 at 9:43 AM, Mark Sharp wrote:
> I am trying to read a series of XML files that use a namespace and I have
> failed, thus far, to discover the proper syntax. I have a reproducible
> example
You might find http://adv-r.had.co.nz/Computing-on-the-language.html helpful.
Hadley
On Tue, Jan 10, 2017 at 2:49 AM, wrote:
> Hi All,
>
> I have a function like
>
> my_func <- function(dataset)
> {
> some operation
> }
>
> Now I would like not only to operate on the dataset (how this is done
You are going to find your life much easier if you:
* Organise your code so it's easier to read
* Use a consistent naming scheme for your variables
* Learn a bit more about how to modify variables succintly
Here's my rewriting of your script to make it easier to see what's going on.
library(tidy
On Tue, Nov 29, 2016 at 11:52 AM, William Dunlap wrote:
>>The other option would be to load dplyr first (which would give the waring
>> that >stats::lag was masked) and then later load plm (which should give a
>> further >warning that dplyr::lag is masked). Then the plm::lag function will
>> be fo
Two quick hints:
* use simplifyDataFrame = FALSE in fromJSON()
* read
https://jennybc.github.io/purrr-tutorial/ls02_map-extraction-advanced.html
(and https://jennybc.github.io/purrr-tutorial/)
Hadley
On Tue, Nov 29, 2016 at 8:06 AM, Daniel Bastos wrote:
> Greetings!
>
> In an SQL table, I hav
>> We have a question about ‘The R Project’.
>>
>> It looks like it’s an open source software, but the document from the
>> website shows that it’s free of use not free of price.
>>
>> Please, confirm us the if it cost fees to use it for commercial use.
>>
>> If needed, could you inform us the pri
You can use readr::write_excel_csv() which adds a BOM that forces excel to
read as UTF-8.
Hadley
On Friday, September 2, 2016, Erich Neuwirth
wrote:
> read_excel in Hadley’s readxl package
> should handle your encoding problems.
> Writing Excel files on a Mac, however, still is somewhat messy.
Or readxl.
Hadley
On Mon, Aug 22, 2016 at 5:54 AM, jim holtman wrote:
> try the openxlsx package
>
>
> Jim Holtman
> Data Munger Guru
>
> What is the problem that you are trying to solve?
> Tell me what you want to do, not how you want to do it.
>
> On Sun, Aug 21, 2016 at 1:30 PM, Kevin Kowitsk
> I think that's a bit too strict for me, so I wrote my own:
>
> na.warn <- function(object, ...) {
> missing <- complete.cases(object)
> if (any(missing)) {
> warning("Dropping ", sum(missing), " rows with missing values",
> call. = FALSE)
> }
>
> na.exclude(object, ...)
> }
That shou
On Tue, Jul 26, 2016 at 3:24 AM, Martin Maechler
wrote:
> I have been asked (in private)
Martin was very polite to not share my name, but it was me :)
> > Hi Martin,
>
> y <- c(1, 2, 3, NA, 4)
> x <- c(1, 2, 2, 1, 1)
>
> t.test(y ~ x)
> lm(y ~ x)
>
> > Normally, most R fu
I'd recommend reading up on how to create a minimal reproducible
example (e.g. http://r4ds.had.co.nz/exploratory-data-analysis.html).
It is unlikely anyone will be able to help you unless you can reliably
communicate _exactly_ what you're doing. Unlike human languages,
computer languages are extrem
The first place to start is to make sure you have the latest version of
devtools. If that doesn't work, please file an issue on devtools' GitHub.
Hadley
On Wednesday, July 20, 2016, Steven Yen wrote:
> Here is what I found. I had to go back to as early as R 3.0.3 (March,
> 2014) along with Rtoo
On Fri, Jun 10, 2016 at 8:27 AM, Marcelo Perlin wrote:
> I don't know Hadley. But you can see evidence of "something" systematically
> installing the packages in the log data. From my two CRAN packages I noticed
> a high correlation in the number of downloads.
>
> Try the following script, which w
On Thu, Jun 9, 2016 at 9:24 AM, Marcelo Perlin wrote:
> Hi,
>
> I recently released two packages (RndTexExams and GetTDData) in CRAN and
> I'm trying to track the number of downloads and location of users.
>
> I wrote a simple script to download and analyze the log files in http://cran
> -logs.rst
On Wed, Jun 1, 2016 at 7:16 PM, Jared Rodecker wrote:
> Greetings fellow R users.
>
> I'm struggling with the syntax of submitting a PUT request
>
> I'm trying to insert a few PUT requests into some legacy R code that I have
> that performs daily ETL on a small database. These requests will add us
On Mon, May 9, 2016 at 7:12 AM, peter dalgaard wrote:
>
> On 09 May 2016, at 02:46 , Bert Gunter wrote:
>
>> ... To be clear, Hadley or anyone else should also feel free to set me
>> straight, preferably publicly, but privately if you prefer.
>
> Not really to "set anyone straight", but there are
On Sun, May 8, 2016 at 7:28 PM, Bert Gunter wrote:
> Jeff:
>
> That's easy to do already with substitute(), since you can pass around
> an unevaluated expression (a parse tree) however you like. As I read
> it, (admittedly quickly) what it's main feature is that it allows you
> more control over t
You may want to read http://rpubs.com/hadley/157957, which captures my
latest thinking (and tooling) around this problem. Feedback is much
appreciated.
Hadley
On Fri, May 6, 2016 at 2:14 PM, David Winsemius wrote:
>
>> On May 6, 2016, at 5:47 AM, Spencer Graves
>> wrote:
>>
>>
>>
>> On 5/6/201
You normally see these errors when compiling on a vm that has very
little memory.
Hadley
On Tue, Apr 19, 2016 at 2:47 PM, Ben Tupper wrote:
> Hello,
>
> I am getting a fresh CentOS 6.7 machine set up with all of the goodies for R
> 3.2.3, including dplyr package. I am unable to successfully inst
== is also vectorised, and you're better off with TRUE and FALSE
rather than 1 and 0, so I'd recommend:
colordata$response <- colordata$color == 'blue'
Hadley
On Thu, Apr 7, 2016 at 6:52 AM, David Barron wrote:
> ifelse is vectorised, so just use that without the loop.
>
> colordata$response <-
It will be included in the next version of devtools - it's totally
do-able, but no one has done it yet.
Hadley
On Wed, Feb 17, 2016 at 6:44 PM, Jeff Newmiller
wrote:
> AFAIK the answer is no. That would be one of the main drawbacks of depending
> on github for packages. It isn't really a packag
vjust was always a hack that I never thought should work. The margins
parameter is the correct way to solve this problem as of ggplot2 2.0.0.
Hadley
On Tuesday, December 22, 2015, Nordlund, Dan (DSHS/RDA)
wrote:
> Ista,
>
> You are correct, I was not at the latest release of ggplot2. I updated
On Wed, Dec 16, 2015 at 9:34 AM, Hadley Wickham wrote:
> On Tue, Dec 15, 2015 at 9:55 AM, Martin Maechler
> wrote:
>>
>>
>>[]
>>
>> > You are missing the closing bracket on the boxplot()
>> > command. Ju
On Tue, Dec 15, 2015 at 9:55 AM, Martin Maechler
wrote:
>
>
>[]
>
> > You are missing the closing bracket on the boxplot()
> > command. Just finish with a ')'
>
> Hmm... I once learned
>
> '()' =: parenthesis/es
> '[]' =: bracket(s)
> '{}' =: brace(s)
>
> Of course, I'm
>> I wonder if R is missing an equality operator for this case. Currently:
>>
>> * == is suboptimal because it's vectorised
>> * all.equal is suboptimal because it returns TRUE or a text string
>> * identical is suboptimal because it doesn't do common coercions
>>
>> Do we need another function (eq
On Sat, Dec 12, 2015 at 1:51 PM, Martin Maechler
wrote:
>>>>>> Hadley Wickham
>>>>>> on Sat, 12 Dec 2015 08:08:54 -0600 writes:
>
> > On Sat, Dec 12, 2015 at 3:54 AM, Martin Maechler
> > wrote:
> >>>>>>>
On Sat, Dec 12, 2015 at 3:54 AM, Martin Maechler
wrote:
>> Henrik Bengtsson
>> on Fri, 11 Dec 2015 08:20:55 -0800 writes:
>
> > On Fri, Dec 11, 2015 at 8:10 AM, David Winsemius
> wrote:
> >>
> >>> On Dec 11, 2015, at 5:38 AM, Dario Beraldi
> wrote:
> >>>
> >>>
On Fri, Dec 11, 2015 at 1:13 PM, Duncan Murdoch
wrote:
> On 11/12/2015 1:52 PM, Mario José Marques-Azevedo wrote:
>>
>> Hi Duncan and David,
>>
>> Thank you for explanation. I'm really disappointed with this R "resource".
>> I think that partial match, mainly in function args, must be optional and
ostly focussed on funding people who have the
skills to solve a problem. In the future, we will explore how to
match up people with skills and people with problems.
* Proposals are due Jan 10.
Please let me know if you have any questions!
Hadley Wickham
Chair, ISC
--
http://had.
I'd recommend reading the ggplot2 book - learning more about how
scales work in ggplot2 will help you understand why this isn't
possible.
Hadley
On Thu, Oct 29, 2015 at 6:31 PM, sbihorel
wrote:
> Thank for your reply,
>
> I may accept your point about the mapping consistency when the different
>
You have two problems:
* geom_line() always draws from right-to-left
* you're defining colour outside of the plot in a very non-ggplot2 way.
Here's how I'd do it:
library(ggplot2)
data <- data.frame(
x = rep(1:4, each = 25),
y = rep(1:25, times = 4),
g = rep(1:4, each = 25)
)
data$x <- dat
The problem is that quotes in csv files are commonly held to me
meaningless (i.e. they don't automatically force components to be
strings).
Earlier this morning I committed a fix to readr so that numbers
starting with a sequence of zeros are read as character strings. You
may want to try out the d
The problem is that within.data.frame calls as.list.environment with
the default value of all.names = FALSE. I doubt this is a deliberate
feature, and is more likely to be a minor oversight.
Hadley
On Sun, Sep 20, 2015 at 11:49 AM, Brian wrote:
> Dear List,
>
> Somewhere I missed something, and
Something like this?
df <- data.frame(
x = runif(30),
y = runif(30),
z = factor(1:30)
)
ggplot(df, aes(x, y)) +
geom_point(aes(shape = z), size = 5) +
scale_shape_manual(values = c(letters, 0:9))
Hadley
On Thu, Aug 27, 2015 at 4:48 PM, Marian Talbert wrote:
> I'm trying to produce a
On Thu, Aug 27, 2015 at 3:46 PM, John McKown
wrote:
> On Thu, Aug 27, 2015 at 2:29 PM, Abraham Mathew
> wrote:
>
>> I have a user-defined function that I'm using alongside a postgresql
>> connection to
>> summarize some data. I've connected to the local machine with no problem.
>> However,
>> the
RStudio just calls the same underlying R functions, so it doesn't make
any difference that you're using RStudio. Currently, there's no
automatic way to update packages installed from github.
Hadley
On Tue, Aug 18, 2015 at 8:14 AM, John Kane wrote:
> Hi Michal,
>
> Because RStudio seems to use i
> I think that is because the value returned from postForm has an attribute;
> remove it by casting the return to a vector
>
> fl <- tempfile(fileext=".pdf")
> writeBin(as.vector(postForm(url, binary=TRUE)), fl)
>
>
> The httr package might also be a good bet
>
> writeBin(content(POST(url)),
Install the latest version of dplyr? Should be fixed there.
Hadley
On Tue, Aug 4, 2015 at 9:40 AM, Conklin, Mike (GfK)
wrote:
> I read in spss files using haven's read_spss. Each column then gets
> attributes assigned named
> label - a long description of the variable
> class -" labelled"
> labe
>> length(df[,1]).
>>
>> Both commands will return n.
>>
>> However, once dplyr is loaded,
>>
>> length(df[,1]) will return a value of 1.
>>
>> length(df$m1) and also length(df[[1]]) will correctly return n.
>>
>> I know that using length() may not be the most elegant or efficient way to
>> get th
> No, the effect I described has nothing to do wit USING dplyr. It occurs with
> any (preexisting) data.frame once dplyr is LOADED (require(dplyr). It is
> this silent, sort of "backward acting" effect that disturbs me.
You're going to need to provide some evidence for that charge: dplyr
does not
I'm a bit confused what you're trying to accomplish - the mix of
annotate() and geom_text() is confusing. The following code works for
me, and I think might be what you want:
ggplot(ins, aes(td, glucose)) +
geom_point(colour = "red") +
geom_line(colour = "blue") +
annotate("text", x = texdat
Try this:
ggplot(mydf,aes(x)) +
geom_line(aes(y = y1, colour = "y1")) +
geom_line(aes(y = y2, colour = "y2")) +
scale_color_manual(values = c(y1 = "green4", y2 = "blue2"))
Note that you don't need to use `mydf` and names in the manual scale
should match the values in the aes() calls.
Alsoi
(FWIW this would've been better send to me directly or filed on
github, rather than sent to R-help)
I think this is more of a problem with the way that you're accessing
the info, than the design of the underlying structure. I'd do
something like this:
attr_default <- function(x, which, default) {
epard wrote:
> On Fri, 10 Jul 2015, Hadley Wickham wrote:
>
>> You shouldn't be explicitly opening a device in a knitr document.
>
>
> Hadley,
>
> Didn't think so.
>
>> I think maybe you should post a minimal document so we can figure out
>> what
You shouldn't be explicitly opening a device in a knitr document. I think
maybe you should post a minimal document so we can figure out what's going
wrong.
Hadley
On Friday, July 10, 2015, Rich Shepard wrote:
> On Fri, 10 Jul 2015, Hadley Wickham wrote:
>
> Have you tri
Have you tried explicitly print()ing the lattice graphics in your knitr doc?
Hadley
On Friday, July 10, 2015, Rich Shepard wrote:
> Hadley's ggplot2 book is quite old and a new version is in the works, but
> not yet out. I've been using lattice graphics but the knitr package doesn't
> support
It doesn’t appear to me that mpfr was ever designed to handle expressions
as the first argument.
>>>
>>> This could be a start. Obviously one would wnat to include code to do other
>>> substitutions probably using the all.vars function to pull out the other
>>> “constants” and ’numeric
In that case, you need to create a minimal reproducible example and make it
publicly available.
Hadley
On Friday, July 3, 2015, Federico Calboli
wrote:
>
> > On 3 Jul 2015, at 12:14, Hadley Wickham > wrote:
> >
> > It might be a line break problem - I think you w
It might be a line break problem - I think you want:
Description: Functions designed to test for single gene/phenotype
association and
for pleiotropy on genetic and genomic data.
Hadley
On Fri, Jul 3, 2015 at 10:09 AM, Federico Calboli
wrote:
> Hi All,
>
> I am upgrading a package for CRAN,
On Tue, Jun 16, 2015 at 12:24 PM, Dimitri Liakhovitski
wrote:
> Hello!
>
> I have a data frame:
>
> md <- data.frame(a = c(3,5,4,5,3,5), b = c(5,5,5,4,4,1), c = c(1,3,4,3,5,5),
> device = c(1,1,2,2,3,3))
> myvars = c("a", "b", "c")
> md[2,3] <- NA
> md[4,1] <- NA
> md
>
> I want to count num
I have also seen this problem on a student's windows machine (with R
3.2.0 and on multiple mirrors). It appeared that the package zip
itself was being corrupted (with an error to the tune of downloaded
file size does not agree with actual file size). The most likely
explanation that I could come up
It's been fixed in the dev version, and I'm planning on submitting to
CRAN in the near future.
Hadley
On Tue, Apr 21, 2015 at 6:01 PM, Shi, Tao wrote:
> hi list,
>
> Any updates on this issue? Thank you very much!
>
> Tao
>
>
>> devtools::install_github("rstudio/packrat")
> WARNING: Rtools 3.3 f
On Mon, Apr 20, 2015 at 1:57 PM, arnaud gaboury
wrote:
> On Mon, Apr 20, 2015 at 6:09 PM, William Dunlap wrote:
>
>> The hyphen without a following digit confuses tidyr::extract_numeric().
>> E.g.,
>>> extract_numeric("23 ft-lbs")
>>Warning message:
>>In extract_numeric("23 ft-lbs") :
You might want to try readxl instead, as it doesn't have any external
dependencies.
Hadley
On Sat, Apr 18, 2015 at 3:07 PM, John Sorkin
wrote:
> Windows 7 64-bit
> R 3.1.3
> RStudio 0.98.1103
>
>
> I am having difficulty loading and installing the xlsx package. The
> loading occurred without any
You might try the readxl package - it's only available on github but it
reads both xlsx and xls. All going well, it should be on its way to CRAN
next week.
Hadley
On Friday, April 3, 2015, Luigi Marongiu wrote:
> Dear all,
> I am trying to open excel files using the gdata package. I can do that
On Tue, Mar 31, 2015 at 6:42 PM, Sarah Goslee wrote:
> On Tue, Mar 31, 2015 at 6:35 PM, Richard M. Heiberger wrote:
>> I got rid of the extra column.
>>
>> data.frame(r=seq(8), foo=NA, bar=NA, row.names="r")
>
> Brilliant!
>
> After much fussing, including a disturbing detour into nested lapply
>
> I didn't dispute whether '%>%' may be useful -- I just pointed out that it
> is slow. However, it is only part of the problem: 'filter()' and
> 'select()', although aesthetically pleasing, also seem to be slow:
>
>> all.states <- data.frame(state.x77, Name = rownames(state.x77))
>>
>> f1 <- func
This somewhat simpler rvest code does the trick for me:
library(rvest)
library(dplyr)
i <- 1:10
urls <- paste0('http://games.crossfit.com/scores/leaderboard.php?stage=5',
'&sort=0&division=1®ion=0&numberperpage=100&competition=0&frontpage=0',
'&expanded=1&year=15&full=1&showtoggles=0&hidedrop
Hi John,
Just printing the result gives a good indication where the problem lies:
> frm %>% rowwise() %>% do(MM=max(as.numeric(.)))
Source: local data frame [6 x 1]
Groups:
MM
1
2
3
4
5
6
do() is designed to produce scalars (e.g. a linear model), not
vectors, so it doesn't join t
On Tue, Feb 17, 2015 at 6:02 PM, Hervé Pagès wrote:
> On 02/17/2015 02:10 PM, Erich Neuwirth wrote:
>>
>> AFAIK dplyr imports magrtittr.
>> So dplyr ses %>% from migrittr, it does not have its own version.
>
> But it has its own man page so who knows?
If you import and re-export a function from a
Maybe https://groups.google.com/forum/#!forum/shiny-discuss ?
Hadley
On Thu, Feb 12, 2015 at 9:07 AM, Doran, Harold wrote:
> I found a google user group for shiny, and am curious if there is an SIG as
> well. Didn't see one in my searches, but looking for an active place to ask
> questions and
On Sun, Feb 8, 2015 at 5:15 PM, Duncan Murdoch wrote:
> On 08/02/2015 4:06 PM, Glenn Schultz wrote:
>> Hello All,
>>
>> I am in the final stages of building my first package "BondLab" and the
>> check throughs the following warning. I think this is namespace thing. I
>> have not done anything
1 - 100 of 1521 matches
Mail list logo