8 ms·
I'm the author, and I'm happy to answer any questions. The book should be in print by (hopefully) the end of this year, or definitely by Jan 2017. The content
by hadley 10y ago
I'm the author, and I'm happy to answer any questions.
The book should be in print by (hopefully) the end of this year, or definitely by Jan 2017. The content will not change significantly, but there is will be minor fixes and a lot of proof reading.
- danso 10y agoTrivial, self-serving question: is there a library for generating the diagram of table relationships here (13.2 nycflights13) http://r4ds.had.co.nz/relational-data.html http://r4ds.had.co.nz/relational-data.html And of course, thanks for another great book, it's helpful for learning R but I'm always enlightened by how thoroughly you explain the general concepts (e.g. Relational data and joins). Have heard a few people on faculty speak enthusiastically about the book even as I hold out for more adoption of Python :)
- hadley 10y agoNo, I wish there was. Those were painstakingly drawn by hand.
- phillc73 10y agoPossibly DiagrammeR? https://github.com/rich-iannone/DiagrammeR https://github.com/rich-iannone/DiagrammeR
- crdb 10y agoIt won't be as pretty, but I deal with large data models all the time, and like to use SchemaSpy [1] which generates an interactive page in HTML and can be used on the command line (I guess you could always modify the CSS to make it pretty). It's literally one of the most useful tools in my life, and the output is good enough to show to clients. If I'm designing a DB or even just an SQL example, I'll run the code on my local machine (psql + the Postgres app [2]) or if I'm lucky, the client already has a server running Postgres and I can run it there instead. All SchemaSpy then needs is access to the DB and voila, interactive example. [1] http://schemaspy.sourceforge.net/ http://schemaspy.sourceforge.net/ [2] http://postgresapp.com/ http://postgresapp.com/
- thenipper 10y agoLucidchart has the ability to generate SQL for you to run and it'll generate a schema for you. I used it to figure out the schema for a particularly poorly designed DB I had to get data out of.
- th0br0 10y agoAs far as I recall, the MySQL Workbench has a pretty useful ER generation tool builtin.
- facorreia 10y agoI'll be sure to buy a copy -- I'd just rather wait for the final version.
- hadley 10y agoIf you pre-order on amazon, you'll get the final version as soon as it's available.
- nickdavidhaynes 10y agoIs there (or are there plans for) a version of this in Jupyter notebooks?
- hadley 10y agoNo, because I don't use Jupyter notebooks.
- baldfat 10y agoI don't see how there would be a need for that. The code will work in Jupyter Notebooks just as it will work in a different IDE. I came from Python using iPython. I missed them for the first few weeks, but now I can't switch from RStudio. It really is just such a great tool for data science.
- nickdavidhaynes 10y agoThe advantage of Jupyter notebooks over RStudio is having text and code in the same place. Personally, I find that being able to run+modify the code in a textbook is much more informative than simply reading the syntax (for example - https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers https://github.com/CamDavidsonPilon/Probabilistic-Programmin...). Sure, I could just copy and paste from the website into an IDE, but notebooks are a more natural way of communicating code and prose, IMO.
- baldfat 10y agoIn R we also have notebooks that does this just it is slightly different. RMarkdown is how we do this same thing. At first I missed the different code and text blocks but it is just easier to work with when it is all a text file. You can make the RMarkdown for reports and then just run them from the command line and never have to open RStudio or R. Saves me a ton of time. You use back ticks to make your code chunks. For example: Some random Markdown text here is treated as a text block in Juypter ```{r} summary(cars) ``` Then some further text goes here. http://rmarkdown.rstudio.com/index.html http://rmarkdown.rstudio.com/index.html
- glogla 10y agoAre there solutions for the exercises? Lot of the exercises, especially in the exploratory data analysis part are "why is blah?" or "is there a relationship in blah?" I think I know the answers, but it would be nice to be able to check if I see what I'm supposed to se in the data.
- hadley 10y agoNo, but I'll probably crowd source when the book is final.
- DashRattlesnake 10y agoJust curious, but why crowd source? You're the author, I assume you wrote the questions, didn't you solve them when you wrote them?
- geebee 10y agoGreat book, I'm getting a lot out of the site and I'm looking forward to the release. Thanks! I understand there is always one more library or topic that could be included... .. but with that acknowledged, what do you think of sqldf as an alternative to dplyr? You mention that dplyr is a bit easier (within the context of being specialized for data analysis). I'd have trouble weighting in because I don't use R all that much, but I do really like the python "equivalent" pandasql. Also, I've used SQL for a long time, so I'd have trouble at this point really knowing what's "easier" for someone new to both, but I do often find it easier to use SQL than do data frame operations in pandas. dplyr seems to be a closer cousin to standard SQL, so the difference might not be quite as great.
- hadley 10y agoIf you don't already know SQL or dplyr, I think you would find dplyr significantly easier to learn. Some people who do know SQL well have commented that they too find dplyr easier. I think this is because the scope of dplyr is much smaller than SQL and it is designed specifically to facilitate data analysis.
- peatmoss 10y agoI have a related technical question. Why couldn't something highly embeddable like SQLite be the default underlying implementation for a data frame in something like Python or R? It seems like Pandas and R data frames have a great deal redundant functionality. SQLite seems like it has the guts to be the standard libdataframe.c for R, Python, Julia, etc. As a side benefit it already has a super consistent API (a.k.a. SQL).
- hadley 10y agoBecause it's designed to support typically relational db workloads (i.e. Lots of changes) not data analysis workloads. Dataframes in R, pandas etc, are column oriented, which leads to better trade offs for analysis. Also SQL is a substantially inferior API for data analysis. (Not because it's a bad language, but again because that's not what it's designed for)
- Eridrus 10y agoI'm a software engineer who is already quite comfortable with Python and has more of an interest in machine learning than data science (as I understand it), is there any reason for me to learn R?
- mnky9800n 10y agoIf you use M$ products you will find that SQL Server 2016 has R baked in. https://www.r-bloggers.com/demo-r-in-sql-server-2016/ https://www.r-bloggers.com/demo-r-in-sql-server-2016/
- hadley 10y agoProbably not any strong reasons. That said, if you're a software engineer, you shouldn't find it too hard to pick up enough R to be useful. You might enjoy <http://adv-r.had.co.nz> http://adv-r.had.co.nz> which describes R from more of a programming language perspective.
- deleted 10y ago[deleted]
- dthal 10y agoI use both R and python quite a bit. I prefer python as a programming language. Here's my take on 'Why learn R?': (1) R/ggplot is hands-down better for plotting than anything in python. I also think that R is better for EDA generally. (2) Many smart, knowledgable people use R and publish their code. To learn from it, you need to know enough R to read and modify it. (3) R has better package support than python in several common data analysis domains. For example, in forecasting and in graph analysis, the best R packages available are much better than the best python packages.
- xaa 10y agoI'm in bioinformatics. R is huge, Python is a distant second. So I am forced to use both. R is a terrible programming language. It's slow and syntactically inconsistent. For interactive statistical analysis it can be OK, but anything beyond a small program becomes unmanageable quickly. In particular, if you want to manipulate strings or hierarchical data structures quickly in R, good luck. For ML, scikit-learn is almost always sufficient. For statistics, statsmodels is OK but very underdeveloped compared to what is available in R. IMO plotting is equally painful in both Python and R (seaborn is a good Python library to ease the pain if you haven't seen it). Personally, I write everything in Python and call out to R as infrequently as possible using rpy2, usually only for specific statistical routines or bioinformatics-specific libraries.
- Eridrus 10y agoI'm a software engineer who is already quite comfortable with Python and has more of an interest in machine learning than data science (as I understand it), is there any reason for me to learn R?
- deleted 10y ago[deleted]
- nthot 10y agoI've always had a hard time understanding pipes, so it may just be that the concept will take more time for me to grok. I thought that the little bunny foo foo example in section 18.2 was really hard to grasp. I think that doing a similarly in depth example with numerical data, while more boring, may make the concept easier to understand. I've been using r4ds for the past couple weeks. This is the first time I've really understood how everything in R and the tidyverse fits together. I am really enjoying the book. It has already helped me immensely. Seriously, thank you for writing this.
- siddboots 10y agoHey Hadley. Huge fan of your work! Many of the libraries you have authored or co-authored have had a big influence on how I think about building tools. I looks forward to getting a hard copy of the book! I have a bit of a nitpick about chapter 13 on "relational data", in which I believe you are consistently misusing the technical term "relation" to refer to the relationship between two data sets. In the context of relational database theory, "relation" is just another word for "table" (although it connotes more mathematical formalism). I think it is worth respecting the precise technical usage in this case: Consider a student who might read your book and be told that "relations are always defined between a pair of tables," and that "a primary key and the corresponding foreign key in another table form a relation." The same student might also stumble across the wikipedia page for the relational model and learn that "a relation is defined as a set of tuples that have the same attributes," and that the relational model "organizes data into one or more tables (or relations)."
- crdb 10y agoTechnically, the relation (value) is the set of tuples (i.e. the data itself, "the true statements", the rows in the table), the relation variable is what is defined by CREATE TABLE (i.e. how the data is constrained, "what can be true") and what most people are trying to model. The relational data model - the set of relation variables - is thus the "equation that defines what is going on in your company" and what the DBMS puts in - the set of relation values, usually abbreviated to relations - can be seen as "the history of what happened at your company".
- hadley 10y agoThat is technically correct (the best kind of correct ;) but I think for newcomers it gives a better sense of the spirit of relational data.