background preloader

R by example

R by example
Basics Reading files Graphs Probability and statistics Regression Time-series analysis All these examples in one tarfile. Outright non-working code is unlikely, though occasionally my fingers fumble or code-rot occurs. Other useful materials Suggestions for learning R The R project is at : In particular, see the `other docs' there. Over and above the strong set of functions that you get in `off the shelf' R, there is a concept like CPAN (of the perl world) or CTAN (of the tex world), where there is a large, well-organised collection of 3rd party software, written by people all over the world. The dynamism of R and of the surrounding 3rd party packages has thrown up the need for a newsletter, R News. library(help=boot) library(boot) ? But you will learn a lot more by reading the article Resampling Methods in R: The boot package by Angelo J. Ajay Shah, 2005

Python Tutorials for Kids 8+ CRAN: Manuals edited by the R Development Core Team. The following manuals for R were created on Debian Linux and may differ from the manuals for Mac or Windows on platform-specific pages, but most parts will be identical for all platforms. The correct version of the manuals for each platform are part of the respective R installations. The manuals change with R, hence we provide versions for the most recent released R version (R-release), a very current version for the patched release version (R-patched) and finally a version for the forthcoming R version that is still in development (R-devel). Here they can be downloaded as PDF files, EPUB files, or directly browsed as HTML: Translations of manuals into other languages than English are available from the contributed documentation section (only a few translations are available). The LaTeX or Texinfo sources of the latest version of these documents are contained in every R source distribution (in the subdirectory doc/manual of the extracted archive).

How to Think Like a Computer Scientist Learning with Python by Allen Downey, Jeff Elkner and Chris Meyers. This book is now available for sale at Lulu.com. Hardcopies are no longer available from Green Tea Press. How to Think... is an introduction to programming using Python, one of the best languages for beginners. How to Think... is a Free Book available under the GNU Free Documentation License. Please send suggestions, corrections and comments about the book to feedback{at}thinkpython{dot}com. Download The book is available in a variety of electronic formats: Precompiled copies of the book are available in PDF and Postscript . Translations Here are some translations of the book into other (natural) languages: Spanish translation by Gregorio Inda. Other Free Books by Allen Downey are available from Green Tea Press. If you are using this book and would like to make a contribution to support my work, please consider making a donation toward my web hosting bill by clicking on the icon below.

Starting data analysis/wrangling with R: Things I wish I'd been told October 14, 2014, [MD] R is a very powerful open source environment for data analysis, statistics and graphing, with thousands of packages available. After my previous blog post about likert-scales and metadata in R, a few of my colleagues mentioned that they were learning R through a Coursera course on data analysis. I have been working quite intensively with R for the last half year, and thought I'd try to document and share a few tricks, and things I wish I'd have known when I started out. I don't pretend to be a statistics whiz – I don't have a strong background in math, and much of my training in statistics was of the social science "click here, then here in SPSS" kind, using flowcharts to divine which tests to run, given the kinds of variables you wanted to compare. So here are some of my suggestions and "lessons learnt", in no particular order. RStudio is an great open source integrated development environment for R. There are lot's of R textbooks and documentation out there.

Bruce Eckel's MindView, Inc: Thinking in Python You can download the current version of Thinking in Python here. This includes the BackTalk comment collection system that I built in Zope. The page describing this project is here. The current version of the book is 0.1. The source code is in the download package. This is not an introductory Python book. However, Learning Python is not exactly a beginning programmer's book, either (although it's possible if you're dedicated). Revision History Revision 0.1.2, December 31 2001.

Cookbook for R Python for Fun This collection is a presentation of several small Python programs. They are aimed at intermediate programmers; people who have studied Python and are fairly comfortable with basic recursion and object oriented techniques. Each program is very short, never more than a couple of pages and accompanied with a write-up. I have found Python to be an excellent language to express algorithms clearly. From many years of programming these are some of my favorite programs. Many thanks to Paul Carduner and Jeff Elkner for their work on this page, especially for Paul's graphic of Psyltherin (apologies to Harry Potter) and to the teams behind reStructured text and Sphinx to which the web pages in this collection have been adapted. Chris Meyers

Code Like a Pythonista: Idiomatic Python In this interactive tutorial, we'll cover many essential Python idioms and techniques in depth, adding immediately useful tools to your belt. There are 3 versions of this presentation: ©2006-2008, licensed under a Creative Commons Attribution/Share-Alike (BY-SA) license. My credentials: I am a resident of Montreal,father of two great kids, husband of one special woman,a full-time Python programmer,author of the Docutils project and reStructuredText,an editor of the Python Enhancement Proposals (or PEPs),an organizer of PyCon 2007, and chair of PyCon 2008,a member of the Python Software Foundation,a Director of the Foundation for the past year, and its Secretary. In the tutorial I presented at PyCon 2006 (called Text & Data Processing), I was surprised at the reaction to some techniques I used that I had thought were common knowledge. Many of you will have seen some of these techniques and idioms before. These are the guiding principles of Python, but are open to interpretation. import this

Hands-On Python A Tutorial Introduction for Beginners Hands-On Python A Tutorial Introduction for Beginners Contents Chapter 1 Beginning With Python 1.1. You have probably used computers to do all sorts of useful and interesting things. 1.1.1. First let us place Python programming in the context of the computer hardware. z = x+y is an instruction in many high-level languages that means something like: Access the value stored at a location labeled x Calculate the sum of this value and the value stored at a location labeled y Store the result in a location labeled z. No computer understands the high-level instruction directly; it is not in machine language. Obviously high-level languages were a great advance in clarity! If you follow a broad introduction to computing, you will learn more about the layers that connect low-level digital computer circuits to high-level languages. 1.1.2. There are many high-level languages. 1.1.3. If you are not sure whether your computer already has Python, continue to Section 1.2.2 , and give it a try. Windows Linux 1.2.

使用python抓取网页(以人人网新鲜事和团购网信息为例) 前一段时间写的小东西,一直没工夫把他系统写出来,今天眼睛疼,就写写吧~~(原来博主不蛋疼时也会更新博客的哈~) python抓取网页基础 python自己带有很多网络应用相关的模块,如:ftplib用于FTP相关操作,smtplib和poplib用于收发电子邮件等等,利用这些 模块自己写一个FTP软件或是邮件客户端类软件完全是可能的,我就简单的试过完全用python脚本收发邮件和操作自己的FTP服务器。当然,这都不是今 天的主角,我们今天要用到的几个模块是:urllib,urllib2,cookielib,BeautifulSoup,我们先来简单介绍下。 urllib和urllib2自然都是处理URL相关的操作,urllib可以从指定的URL下载文件,或是对一些字符串进行编码解码以使他们成为特定的 URL串,而urllib2则比urllib更2一点,哦不对,是更牛逼一点。 我们先来看看最简单的网页抓取,其实网页抓取就是将所要的网页源代码文件下载下来,然后对其分析以提取对自己有用的信息。 import urllibhtml_src = urllib.urlopen(' 这样就会打印出百度首页的HTML源码了,还是很easy的。 from BeautifulSoup import BeautifulSoupparser = BeautifulSoup(html_src) 这样,后续处理HTML源码的工作交给parser变量来负责就好,我们可以简单的调用parser的prettify函数来相对美观的显示源码, 可以看到这样就能看到中文字符了,因为BeautifulSoup能自动处理字符问题,并将返回结果都转化为Unicode编码格式。 抓取人人网的新鲜事 前面讲的是最简单的抓取情形了,但通常我们需要面对更复杂的情形,拿人人网来说,需要登录自己的账号才能显示新鲜事,这样我们就只能求助于更2一点 的urllib2模块了。 首先import我们需要的所有模块,然后使用urllib2模块的HTTPCookieProcessor搭建一个处理cookie的 Handler,传入cookielib模块的CookieJar函数作为参数,这个这个函数处理HTTP的cookie,简单地说,它从HTTP请求中 提取cookie,然后将其返回给HTTP响应。

Eric Walstad's crew quarters on the Starship Hello World! I'm busilly tuning the hyper drive right now. Please have a seat and enjoy my spartan quarters or have a look at my business site: or the Django Critter that helps me write code at the speed of light. links I've found useful over the years of Python programmingPythonDive Into PythonCode Like a Pythonista: Idiomatic PythonBitManipulation - PythonInfo WikiCharming Python: Using state machinesCSV module ExamplesDebugging python c extensionsEpydocGnuplot.pyPython bindings to the Xapian search enginePython SidebarPython Standard LoggingSending email with PythonSingleton Mixin - singletonmixin.py The Borg patternThe Epytext Markup LanguageUsing Mix-ins with Python | Linux JournalXapian: DocumentationLearning to programByte of Python:Main Page - Text

LIBSVM Tools This page provides some miscellaneous tools based on LIBSVM (and LIBLINEAR). Roughly they include Disclaimer: We do not take any responsibility on damage or other problems caused by using these software and data sets. Please download the zip file. Please download the zip file. Please download the zip file. T. You can use either MATLAB or Python.

Related: