Re: [R] Accessing Data From packages
>From the "Companion to Analyzing Baseball Data with R" on GitHub (https://github.com/maxtoki/baseball_R) it says: "In order to have a working copy of the code in the book, download the zip file of this repository and extract the content of the zip file in a folder of your convenience. The data folder contains datasets used in the book, except those downloadable from websites. In order to get the missing datasets, read the readme.txt files stored inside the lahman, sqldumps and wizardry subfolders of the data folder. The script folder contains one script named _setWorkingDir.R. Before running any code, open that file, change the path to reflect the folder of your installed files and run it." So it seems like you downloaded the zip file but still have to make sure that the working directory is set correctly (see third paragraph in the instructions above). Hope that helps! Stefan On Thu, 27 Feb 2020 at 08:05, Phillip Heinrich wrote: > > I am continuing to have problems downloading data as prescribed in books > about R such as “Analyzing Baseball Data with R”. > > In chapter 3 (page 67) the instructions to download baseball Hall of Fame > data from the package tidyverse are: > > library(tidyverse) > -- Attaching packages --- tidyverse > 1.3.0 -- v ggplot2 3.2.1 > v purrr 0.3.3 v tibble 2.1.3 > v dplyr 0.8.3 v tidyr 1.0.0 v stringr 1.4.0 > v readr 1.3.1 v forcats 0.4.0 > > -- Conflicts -- > tidyverse_conflicts() -- x dplyr::filter() masks stats::filter() > x dplyr::lag() masks stats::lag() > Warning messages: 1: package ‘tidyverse’ was built under R version 3.6.2 2: > package ‘purrr’ was built under R version 3.6.2 > > The package seems to load correctly but when I try to call up the data I get > an error message. > *** > > > hof <- read_csv("data/hofbatting.csv") > > Error: 'data/hofbatting.csv' does not exist in current working directory > ('C:/Users/Owner/Documents'). > > *** > I have no idea where the data is hiding. Can someone give me some > directions. > > __ > 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-contained, reproducible code. __ 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-contained, reproducible code.
Re: [R] Annotate question
Since factor levels (groups) are coded by integers, you can use 1, 2, 3 etc. as your x values. If you want to annotate in between you can simply pick values in between 1, 2, 3, etc. On Wed, Feb 19, 2020, 13:26 Thomas Subia, wrote: > Colleagues, > > To add an annotation using ggplot, I've used > annotate("text",x=17,y=2130,label="16 u"). > > However, this does not work when trying to annotate box plots by groups > since groups are factors. > > Any advice would be appreciated. > > Thomas Subia > ASQ CQE > > IMG Companies > 225 Mountain Vista Parkway > Livermore, CA 94551 > T. (925) 273-1106 > F. (925) 273- > E. tsu...@imgprecision.com > > > Precision Manufacturing for Emerging Technologies > imgprecision.com > > The contents of this message, together with any attachments, are intended > only for the use of the individual or entity to which they are addressed > and may contain information that is legally privileged, confidential and > exempt from disclosure. If you are not the intended recipient, you are > hereby notified that any dissemination, distribution, or copying of this > message, or any attachment, is strictly prohibited. If you have received > this message in error, please notify the original sender or IMG Companies, > LLC at Tel: 925-273-1100 immediately by telephone or by return E-mail and > delete this message, along with any attachments, from your computer. Thank > you. > > __ > 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-contained, reproducible code. > [[alternative HTML version deleted]] __ 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-contained, reproducible code.
[R] object.size vs lobstr::obj_size
I am currently working through Advanced R by H. Wickham and came across the `lobstr::obj_size` function which appears to calculate the size of an object by taking into account whether the same object has been referenced multiple times, e.g. x <- runif(1e6) y <- list(x, x, x) lobstr::obj_size(y) # 8,000,128 B # versus: object.size(y) # 24000224 bytes Reading through `?object.size` in the "Details" it reads: [...] but does not detect if elements of a list are shared [...]. My questions are: (1) is the result of `obj_size()` the "correct" one when it comes to actual size used in memory? (2) And if yes, why wouldn't `object.size()` be updated to reflect the more precise calculation of an object in question similar to `obj_size()`? There are probably valid reasons for this and any insight would be greatly appreciated. __ 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-contained, reproducible code.
Re: [R] density vs. mass for discrete probability functions
Thank you Peter and Spencer. That clears things up. Also since no one responded the second part of my question, I'm still wondering if it was noted that there is a hyperlink in the dbinom help file (?dbinom) that isn't directing correctly? Stefan On Fri, Mar 15, 2019, 07:37 peter dalgaard, wrote: > Mathematically, you can bring discrete and continuous distributions on a > common footing by defining probability functions as densities wrt. counting > measure. You don't really need Radon-Nikodym derivatives to understand the > idea, just the fact that sums can be interpreted as integrals wrt counting > measure, hence sum_{x in A} f(x) and int_A f(x) dx are essentially the same > concept. > > -pd > > > On 15 Mar 2019, at 01:43 , Stefan Schreiber > wrote: > > > > Dear R users, > > > > While experimenting with the dbinom() function and reading its > > documentation (?dbinom) it reads that "dbinom gives the density" but > > shouldn't it be called "mass" instead of "density"? I assume that it > > has something to do with keeping the function for "density" consistent > > across discrete and continuous probability functions - but I am not > > sure and was hoping someone could clarify? > > > > Furthermore the help file for dbinom() function references a link > > (http://www.herine.net/stat/software/dbinom.html) but it doesn't seem > > to land where it should. Maybe this could be updated? > > > > Thank you, > > Stefan > > > > __ > > 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-contained, reproducible code. > > -- > Peter Dalgaard, Professor, > Center for Statistics, Copenhagen Business School > Solbjerg Plads 3, 2000 Frederiksberg, Denmark > Phone: (+45)38153501 > Office: A 4.23 > Email: pd@cbs.dk Priv: pda...@gmail.com > > > > > > > > > > [[alternative HTML version deleted]] __ 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-contained, reproducible code.
[R] density vs. mass for discrete probability functions
Dear R users, While experimenting with the dbinom() function and reading its documentation (?dbinom) it reads that "dbinom gives the density" but shouldn't it be called "mass" instead of "density"? I assume that it has something to do with keeping the function for "density" consistent across discrete and continuous probability functions - but I am not sure and was hoping someone could clarify? Furthermore the help file for dbinom() function references a link (http://www.herine.net/stat/software/dbinom.html) but it doesn't seem to land where it should. Maybe this could be updated? Thank you, Stefan __ 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-contained, reproducible code.