我正在使用Debian 6.04和Python 2.7 
我
在控制台中编译了Python 2.7,(./ configure,make,make install):
>python2.7  
Python 2.7.3 (default, Jul 28 2012, 16:54:06) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gtk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named gtk
如何在Python 2.7中安装gtk?
在Python 2.6中:
tiger@debian:~$ python
Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gtk
>>> import pygtk …可能重复:
R
R中的掩码函数:掩码函数
函数命名冲突
如果我有两个包:A和B.假设有funfun一个在A中命名的函数,也有funfun在B中命名的函数   .当我加载A和B时,如何使用第一个funfun?
require(A)
require(B)
如果我想funfun在A中使用,我该怎么写呢?
在其他语言中,当您将数据写入文件时,必须关闭该文件。我发现在 R 中,将数据写入文件后不需要关闭文件,我是对的吗?如果我写:
require(quantmod)  
getSymbols("GS")  
write(GS,'test')
我想重命名列名data.frame,
> x=data.frame(name=c("n1","n2"),sex=c("F","M"))
> colnames(x[1])="Name"
> x
  name sex
1   n1   F
2   n2   M
> colnames(x)[1]="Name"
> x
  Name sex
1   n1   F
2   n2   M
> 
为什么colnames(x[1]) = "Name"不工作,而colnames(x)[1]="Name"呢?  
是什么原因?他们之间有什么区别?
我无法row.names在函数中指定正确的参数read.table()
这是简单的文字:
 name      sex     age  height  
1 x1        F       18   162  
2 x2        M       19   170  
3 x3        M       21   178  
4 x4        F       22   166  
5 x5        F       23   165  
当我读到:
data1=read.table('test',head=T,sep='',row.names=T)  
invalid 'row.names' specification  
data1=read.table('test',head=T,sep='',row.names=T)  
invalid 'row.names' specification 
其他信息:
> version  
               _                            
platform       i686-pc-linux-gnu             
arch           i686                           
os             linux-gnu                      
system         i686, linux-gnu                
status                                        
major          2                              
minor          15.1                           
year           2012                           
month          06                             
day            22                             
svn rev        59600                         
language       R                              
version.string R version 2.15.1 (2012-06-22)  
nickname       Roasted Marshmallows          
我的文件末尾有四个空白行.
> data=read.fwf("test2",head=F,widths=c(3,1,-3,4,-1,4),blank.lines.skip = TRUE)  
> data  
当我运行此代码时,将忽略blank.lines.skip参数.我的输出中仍然有空行.
该文件是:
x1     F          1890 1962  
x2                1857 1936  
x3                1900 1978  
x4                1902 1994  
x5        F       1878 1939 
最后有四个空白行.
可能重复:
为什么对象是向量?
请看我的代码:
> x=function(z){z+1}  
> y=list(n1=1,n2="qwe",n3=TRUE,n4=x)  
> is.vector(y)
[1] TRUE  
为什么是y矢量?n1是数字,n2是字符,n3是逻辑的,n4是一个函数.    
它们是不同的,为什么是y矢量?当然y只能是一个清单?
> data
name sex age height
1 x1 F 18 162
2 x2 M 19 170
3 x3 M 21 178
4 x4 F 22 166
5 x5 F 23 165
> data[1,]
name sex age height
1 x1 F 18 162
> is.vector(data[1,])
[1] FALSE
我对矢量感到困惑,为什么这里的数据[1,]不能成为一个矢量?
这是我的简单文本(名为test):
  name      sex     age  height  
1 x1        F       18   162
2 x2        M       19   170
3 x3        M       21   178
4 x4        F       22   166
5 x5        F       23   165
>read.table('test', sep='') 
没关系.
>read.table('test', sep=' ')  
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :   
  line 1 did not have 20 elements  
我想知道为什么.
R的read.table中''和''之间有什么区别?请告诉我原因.
有一个data.frame
> x
        date  open  high   low close   volume adjusted  
1 2010-01-04 24.52 24.58 23.68 23.71 24192200    23.71  
2 2010-01-05 23.75 23.90 22.75 23.30 55649900    23.30  
3 2010-01-06 23.25 23.25 22.72 22.90 41214300    22.90  
4 2010-01-07 22.90 23.05 22.40 22.65 35533600    22.65  
5 2010-01-08 22.50 22.75 22.35 22.60 28854300    22.60  
6 2010-01-11 23.50 23.68 22.28 22.60 44284600    22.60
> is.vector(x[,1])
[1] FALSE  
> is.vector(x[,2])
[1] TRUE  
> is.vector(x[,1])
[1] FALSE 
> is.vector(x[,3])
[1] TRUE  
> is.vector(x[,4])
[1] TRUE  
> is.vector(x[,5]) …