- 博客(8)
- 收藏
- 关注
原创 [R] adding a title to a histogram
Based on what was told in class, there should be two ways:Option 1: Adding the title by itself as a single statement, for example, a new line of code:title("Heart Attack 30-day Death Rate")
2013-10-17 07:39:44 504
原创 [PYthon] reverse letters in a string
x = 'abc'x[:: -1} will produce "cba"Alternatively in a while loop:def reverse (s): result ='' i = len(s)-1 while i>=0: result =result + s[i] i=i-1 retur
2013-10-11 06:41:11 497
原创 [R] Mean of columns in a data file
Take iris from R Base from example:library(datasets)data(iris)?irisThe following four command will generate the same results: the means of the first four columns in the document.colMean
2013-10-08 08:14:19 546
原创 [R] complete.cases
To find out the first 6 cases without any missing data from "airquality". Option 1: to define a logical vector first, for example "good":good airquality [good, ][1:6, ]Option 2:
2013-09-30 11:42:10 2586
原创 [R] subset a list
> x## x[1], x ["foo"] will produce the same result - a list 1, 2, 3, 4.## x[[1]], x[["foo"]], x$foo will produce the same result - a sequence of 1 to 4.
2013-09-30 10:33:16 741 2
原创 [R] creating matrices from vectors by adding a dimension attribute
Suppose w At this time, you can make the vector to be a matrix by adding its dimension attribute by using dim function.dim(w) OR dim(w)
2013-09-30 03:39:06 616 2
原创 [Python]这次的Python作业
Python的官网上说:list.index(x):Return the index in the list of the first item whose value is x. It is anerror if there is no such item.下面还有一个例子。看了例子,感觉说是这个x之前还有多少位的意思。自己写了两句话,发现确实就是这样:>>> x="abcd
2013-09-17 13:38:13 750 2
原创 [C++] num++ v.s. ++num in C++
最近和一个朋友去混他们的计算机研究生基础课C++。老师讲课的时候讲了个:num++ equal to num = num +1++num equal to num = num +1;num =1;n= num++ *3; // 3n = ++num * 3; //6老师一两句就带过去了,我想了半天都没有想清楚,后来google 了一下,
2013-09-14 03:09:53 778
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人