r语言门外汉,想学,请教怎样入门快些?

Python09

r语言门外汉,想学,请教怎样入门快些?,第1张

这是我以前给别人的答案,希望能够帮到你。

首先R是一种专业性很强的统计语言如果想学得快一些的话,基本的统计学知识要懂,不然很多东西会掌握的比较慢。

掌握基本语法和操作,推荐国内的已经翻译的比如《R语言实战》《R语言编程艺术》,这个过程中最好结合一些小例子来做一些分析的东西。其他还有《R语言实例》《R语言核心技术手册》也都是很好的书!如果需要可视化的话,强烈不推荐学习R本身的作图系统,实在是太不友好了.....还是用ggplot2吧。

掌握了上面的,就可以深入一些了,如果是做数据分析和可视化,推荐《ggplot2:数据分析与图形艺术》,这个才是作图的神器啊.....如果是空间分析相关的,推荐《Applied Spatial Data Analysis with R》,这个如果可以的话看英文版,而且要有地学的一些知识背景,中文版翻译的太次了,尽量不要看。数据挖掘机器学习之类的,可以看看比如《数据挖掘与R语言》、《机器学习——实用案例解析》,不过我觉得这几本书没上面的那几本好,但是可以大概看看是咋回事,最好还是看看专门的相关书籍,熟悉各种算法和流程,到时候搜索R的package,照着文档和例子搞定,不是特别难。

最后,强烈推荐统计之都、R-bloggers,统计之都以及谢益辉、肖凯、刘思喆等人的博客(自行Google以及到上面的网站找链接),订阅一下,会很有帮助,RStudio是个很棒的IDE,用起来很爽,功能很强大。

总之,你可以从《R语言实战》开始出发吧!

1.初级入门

《An Introduction to R》,这是官方的入门小册子。其有中文版,由丁国徽翻译,译名为《R导论》。《R4Beginners》,这本小册子有中文版应该叫《R入门》。除此之外,还可以去读刘思喆的《153分钟学会R》。这本书收集了R初学者提问频率最高的153个问题。为什么叫153分钟呢?因为最初作者写了153个问题,阅读一个问题花费1分钟时间,全局下来也就是153分钟了。有了这些基础之后,要去读一些经典书籍比较全面的入门书籍,比如《统计建模与R软件》,国外还有《R Cookbook》和《R in action》,本人没有看过,因此不便评论。

2.高级入门

读了上述书籍之后,你就可以去高级入门阶段了。这时候要读的书有两本很经典的。《Statistics with R》和《The R book》。之所以说这两本书高级,是因为这两本书已经不再限于R基础了,而是结合了数据分析的各种常见方法来写就的,比较系统的介绍了R在线性回归、方差分析、多元统计、R绘图、时间序列分析、数据挖掘等各方面的内容,看完之后你会发现,哇,原来R能做的事情这么多,而且做起来是那么简洁。读到这里已经差不多了,剩下的估计就是你要专门攻读的某个方面内容了。

3、推介你看下这位大咖的CSDN博客,里面有很多有关R语言入门类文章,一定能get到新知识,希望对你有帮助。

博主博客地址:

Data+Science+Insight的博客_CSDN博客-R语言从入门到机器学习,数据科学从0到1,机器学习面试+横扫千军领域博主

博客内容包括:数据科学从0到1、R语言从入门到机器学习、机器学习面试+横扫千军、Python编程技巧高效复用等系列

我的亲师弟最近也开始学习R语言了,然后师弟每天“师姐,师姐...",“我这个怎么弄...”,“我怎么又报错了...”,“师姐师姐...”...我快被他搞疯了,于是有了这篇文章。

新手在学习R语言的过程中一定会出现各种各种问题,问题多到令人抓耳挠腮。

但其实不要觉得害怕或有打退堂鼓的心里,R的使用,就是不断报错不断找问题的过程。但是出现问题,第一反应一定要是上网搜索,找答案,不要第一时间就问身边的人,错失了思考的过程。生信的学习,其实就是一个漫长的自学过程。

推荐 搜索引擎:必应,必应,必应 !不要再用某度啦拜托!当然如果你能想办法用Google,那当然再好不过了。

搜索能解决百分之九十以上的问题 ,就算解决不了,如果解决不了,可能是因为你的搜索能力还不够高。在这个搜索、尝试解决以及思考的过程,对新学者来说也是一大收获。本身搜索能力的提升就是一个巨大收获。

如果自己尝试了好久,最终实在解决不了,那。。。就再去请教有经验的前辈吧~

其实这种搜索并独立解决问题的思维,我还是在同济大学, 生信大牛刘小乐教授 课题组学到的。刘小乐教授课题组每年都有为期一个月的生信培训,本人有幸学习过一段时间。她们会给很多生信相关的题目给到学员,然后附上一些教学视频,培训的大部分时间,其实就是写作业,自己想方设法找到解决方案的过程。那些大牛师兄师姐们虽然一直在陪伴我们,但是并不会直接告诉我们答案,而是引导我们自己思考,自己去解决。当时真的很崩溃,因为真的啥也不会,怎么搞。一天下来有可能一个问题都答不上来。

但是现在回头想想,我真的获益良多。因为我慢慢学会了独立思考,现在遇到R相关的问题,配合上搜索功能,基本上已经完全能自己驾驭了。

这可能就是“ 授人以鱼不如授人以渔 ”的道理吧。

R语言很简单,只要你想学,就一定能学会。

以下附上同济大学刘小乐课题组在培训时针对初学者第一周的初级练习题。希望对大家有所帮助。

首先你需要先安装几个最常用的数据处理软件

You can use the mean() function to compute the mean of a vector like

so:

However, this does not work if the vector contains NAs:

Please use R documentation to find the mean after excluding NA's (hint: ?mean )

In this question, we will practice data manipulation using a dataset

collected by Francis Galton in 1886 on the heights of parents and their

children. This is a very famous dataset, and Galton used it to come up

with regression and correlation.

The data is available as GaltonFamilies in the HistData package.

Here, we load the data and show the first few rows. To find out more

information about the dataset, use ?GaltonFamilies .

a. Please report the height of the 10th child in the dataset.

b. What is the breakdown of male and female children in the dataset?

c. How many observations are in Galton's dataset? Please answer this

question without consulting the R help.

d. What is the mean height for the 1st child in each family?

e. Create a table showing the mean height for male and female children.

f. What was the average number of children each family had?

g. Convert the children's heights from inches to centimeters and store

it in a column called childHeight_cm in the GaltonFamilies dataset.

Show the first few rows of this dataset.

In the code above, we generate r ngroups groups of r N observations

each. In each group, we have X and Y, where X and Y are independent

normally distributed data and have 0 correlation.

a. Find the correlation between X and Y for each group, and display

the highest correlations.

Hint: since the data is quite large and your code might take a few

moments to run, you can test your code on a subset of the data first

(e.g. you can take the first 100 groups like so):

In general, this is good practice whenever you have a large dataset:

If you are writing new code and it takes a while to run on the whole

dataset, get it to work on a subset first. By running on a subset, you

can iterate faster.

However, please do run your final code on the whole dataset.

b. The highest correlation is around 0.8. Can you explain why we see

such a high correlation when X and Y are supposed to be independent and

thus uncorrelated?

Show a plot of the data for the group that had the highest correlation

you found in Problem 4.

We generate some sample data below. The data is numeric, and has 3

columns: X, Y, Z.

a. Compute the overall correlation between X and Y.

b. Make a plot showing the relationship between X and Y. Comment on

the correlation that you see.

c. Compute the correlations between X and Y for each level of Z.

d. Make a plot showing the relationship between X and Y, but this

time, color the points using the value of Z. Comment on the result,

especially any differences between this plot and the previous plot.