TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Learn R Through Examples (2020)

140 点作者 diplodocusaur将近 4 年前

12 条评论

baron_harkonnen将近 4 年前
Lot&#x27;s of negative comments in here about learning R from experienced programmers. I&#x27;ve found this is largely because experienced programmers have this unjustified bias that R is some toy language that should be easy to learn and has nothing to teach them. If you approached a language like Rust in the same way you would likely be just as frustrated with it.<p>Certainly R has its quirks, but most of this comes from being one of the oldest continuing existing programming languages there is. It derives from S which was written 46 years ago. Because of this it has multiple object&#x2F;class systems reflecting the changing standards for OOP. It&#x27;s most dominant one, S3, predates Java and therefore uses the Generic Function paradigm of OOP similar to Common Lisp&#x27;s ClOS. If you&#x27;re experienced but have never worked with non-Java style OOP you&#x27;re going to be a bit confused.<p>R&#x27;s most important feature, which is well worth studying and mastering for any serious programmer, is that it is a completely vectorized programming language. It borrows this style from APL (though is a million times more readable). Every value in R is a vector and for the vast majority of operations the best approach to solve your problem is by thinking in vector operations. This makes simple things like string formatting with `paste` seem like a confusing nightmare, but there is a real logic there. Functions like `ifelse` can seem strange, and writing C-style code in R, while possible will result in horrible performance.<p>Once you do learn to think in vectors you realize that R isn&#x27;t just popular in the stats world because most statisticians haven&#x27;t seen a &quot;real&quot; programming language, but because you can very rapidly iterate on models. Translating mathematical notation into R, for the experience R programmer, is easier than any other language I&#x27;ve worked with by a long shot.<p>My advice to any experienced programmer approaching R is to have some respect for the language. Most of the frustrations you&#x27;ll have aren&#x27;t because R is a bad language, but because you have less experience than you think and learning R well can expand your programming views in a similar way to Haskell.
评论 #27405252 未加载
评论 #27405269 未加载
评论 #27405361 未加载
评论 #27406463 未加载
评论 #27405967 未加载
评论 #27407673 未加载
评论 #27405324 未加载
评论 #27407560 未加载
评论 #27406339 未加载
qntty将近 4 年前
If you already know another dynamic language and want to understand R, I would recommend skipping all the intros to R based around data analysis and start with Advanced R by Hadley Wickham. It will explain all the weirdness you&#x27;ll encounter right up front before it confuses you. Then you can read the data analysis tutorials and focus on the content rather than the R weirdness.
评论 #27405308 未加载
评论 #27406822 未加载
评论 #27404904 未加载
AuthorizedCust将近 4 年前
R <i>plus the tidyverse</i> is what makes it a great language. Some tidyverse concepts are being baked into base R, like the pipe, but base R by itself feels hollow.<p>R’s future is inseparable from the tidyverse. We need to just lump them together in any serious discussion of R.<p>I teach a graduate level R course mainly for economics and statistics majors. (My educational background and career are computer science and technical; while that may stereotype me into Python, I just love R.) I spend the first three weeks on base R, to convey language-essential concepts, like vectorized objects, then the rest of the course is tidyverse-centric.
评论 #27407419 未加载
评论 #27405557 未加载
评论 #27405722 未加载
评论 #27405611 未加载
civilized将近 4 年前
Here is my take on R as a guy who does stats as well as some software engineering in more mainstream languages like Python.<p>R is a fantastic DSL for data manipulation and statistical analysis, with both traditional and modern tools, on datasets up to the gigabyte scale. It has great, easy-to-use data structures and unparalleled APIs in the tidyverse. It is not the thing for the latest deep learning implementation on petascale data, but most data science work doesn&#x27;t need or benefit from that. Surprisingly, some machine learning methods have their nicest APIs in R, because that&#x27;s where the users of those methods are.<p>It has its warts, but so do JavaScript and SQL, and I think few people dispute that these are very powerful DSLs. Statistical analysis is just as legitimate a computing task as building webpages or querying databases. It is not the same as general-purpose programming, and it needs a good DSL.
评论 #27407736 未加载
评论 #27406712 未加载
noctilux将近 4 年前
Coming from writing OOP-style code in Python and C++, I initially disliked R quite a lot. My code is becoming more functional-style by the year and I&#x27;m now finding myself enjoying R more and more.<p>There are issues with R: lots of weird quirks; many different ways of doing things, often just supported for legacy reasons; poor error messages; to name just a few. But on the positive side, it really encourages functional-style programming through the use of apply functions and many of the new tidyverse packages. The resulting code can be very neat and less error-prone than equivalent python code.<p>The S3 system of OOP initially struck me as very weird, but now I see it as essentially just single dispatch, not really much of OOP at all. It works quite well and is extremely simple.<p>I guess my thoughts are: approach R as a functional language, and I think you&#x27;ll find much to like. Try to write C++ or python-style OOP in it, and you&#x27;ll just find it very strange.
montmorencie将近 4 年前
I am currently a data scientist. Educational background in cs, few hobby web projects and currently updating my skills in java&#x2F; kotlin with the idea to go in mobile dev.<p>I use only Python in my work. I learnt R and honestly, it&#x27;s the same thing as using Python scientific packages. It&#x27;s mostly vectorized operations, spaghetti functional, if people know how to write functions, code just to get it done. To make graphs, web dashboard(no, we are not doing web dev, it&#x27;s dark magic frameworks), build machine learning and eventually some reports. Stuff like that.<p>I do some software engineering but that s optional and I do it because I can. Most data scientists&#x2F; ml engineers can&#x27;t. So you guys are not fair. R and Python in these environments are not even being used for building stuff. This language is not build for that. Hence it&#x27;s not good from the perspective you look at it from(software engineers).<p>Unlike Python , R is solely for statistics, data science and probably some basic ml( I haven&#x27;t tried tho). Also Shiny for building web dashboards. But don&#x27;t look at the code for dashboards, it&#x27;s bad, with &#x27;get it done and forget&#x27; approach.<p>That being said. Good luck scrapping, mining, cleaning data with something not called R&#x2F;Python. Good luck with data engineering. Exploring and visualizing trends. Creating dashboards even. Machine learning. Monitoring and reporting in scientific manner.<p>Try This type of work with your favorite languages. Then see how quickly and easily it&#x27;s done with R&#x2F;Python . Come back and say it&#x27;s bad language.<p>It&#x27;s the same thing as embedded dev complaining about how bad js is for his job. You just totally ignore the context.
specproc将近 4 年前
R is such a horrible language to learn. I gave up entirely and now just use rpy2 for the few things it can do that Python can&#x27;t.
评论 #27405584 未加载
nojito将近 4 年前
R&#x27;s such a fantastic language and is leagues ahead of all others for data work.<p>I do however recommend picking up data.table along the way because that is easily one of the best reasons to continue using R today.
AndyPatterson将近 4 年前
I work using R almost everyday and I think many of the problems that are unique to R could be solved by having a couple of experienced SWE in the core team to point R in the right direction. As it stands, I think R will be left behind until it fixes things like performance and scalability (e.g. intuitive byref semantics and a faster runtime) and a consistent scoping model and OOP.<p>Apart from that, I think there&#x27;s a bigger challenge which still needs to be addressed is that analysis&#x2F;modelling projects tend to be worked on by individuals and&#x2F;or thrown away after the initial value is pulled out of them.<p>Going forward, I think we need to start identifying design methodologies that would make collaborating on this sort of work pain-free and more agile. Doing so should give us more value and sooner and for longer.
temp8964将近 4 年前
I recently tried to migrate my R code to Julia. Even though I already knew R data.table is faster than DataFrames.jl, I was totally blown away by how slow Julia is. So I quickly gave up. I think I will have to write unavoidable hard loop in cpp, which I really don&#x27;t want to do...
评论 #27407475 未加载
评论 #27405231 未加载
评论 #27404960 未加载
评论 #27405359 未加载
评论 #27406119 未加载
auto将近 4 年前
I consider myself a pretty experienced developer&#x2F;software engineer&#x2F;whatever. Decade into my career, started in iOS in Obj-C, learned Swift along the way, eventually migrated to the backend with Java&#x2F;SQL, and finally found myself where I really wanted to be, embedded doing C&#x2F;C++ work for a household name.<p>That said, about halfway through my master&#x27;s about two years ago, I found myself in an intro to data mining course that was sold as an &quot;we will teach you R&quot;. I had heard non-programmer math friends talk about what they had accomplished in R, and was excited to dive in.<p>Now, it didn&#x27;t help that the class ended up being <i>heavy</i> on the statistics side (which despite a math&#x2F;cs double major, stats was never my thing), but the actually learning R part was 99% left as an exercise to us alongside of the classwork required.<p>I can say without a doubt, learning R is the worst programming experience I&#x27;ve ever had. Our assignments would give some high level direction on which libraries to use, but getting the right libraries setup and in the environment was just an absolute nightmare. All I remember from that class is hours every week googling unreadable python pukes from R studio (because apparently everything data mining&#x2F;ML related in R is actually just python), and then spending an hour or less actually doing the statistics work.<p>I feel bad because I feel like I was setup to not be able to give it a fair chance, but if that&#x27;s what non-programmer math types are subjected to when told &quot;you need to do some programming for your job&quot;, I can understand the apprehension.
评论 #27404832 未加载
评论 #27405392 未加载
评论 #27404841 未加载
评论 #27404979 未加载
评论 #27405875 未加载
评论 #27404884 未加载
Closi将近 4 年前
I currently do lots of data analysis in excel and know basic Python. I would be interested to get opinions on if R is better suited to data analysis than python if that’s all I was doing.
评论 #27406060 未加载
评论 #27405700 未加载