more on rstat.getDataFrame()
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2097 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
		
							parent
							
								
									68d20aa1ea
								
							
						
					
					
						commit
						f5429af719
					
				
					 1 changed files with 34 additions and 0 deletions
				
			
		
							
								
								
									
										34
									
								
								pyscript/rstat.txt
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								pyscript/rstat.txt
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,34 @@
 | 
			
		|||
==================================================
 | 
			
		||||
Using the R Statistics Package with Python Scripts
 | 
			
		||||
==================================================
 | 
			
		||||
 | 
			
		||||
  >>> from cybertools.pyscript.tests import Root
 | 
			
		||||
  >>> from cybertools.pyscript.script import PythonScript
 | 
			
		||||
 | 
			
		||||
  >>> pp = PythonScript()
 | 
			
		||||
  >>> pp.__parent__ = Root()
 | 
			
		||||
  >>> pp.__name__ = 'pp'
 | 
			
		||||
  >>> request = None
 | 
			
		||||
 | 
			
		||||
  >>> pp.setSource(u"return 'Hello World'")
 | 
			
		||||
  >>> pp(request)
 | 
			
		||||
  'Hello World'
 | 
			
		||||
 | 
			
		||||
  >>> source = """
 | 
			
		||||
  ... data = [('r1', 'c1', 1),
 | 
			
		||||
  ...         ('r1', 'c2', 1),
 | 
			
		||||
  ...         ('r1', 'c3', 0),
 | 
			
		||||
  ...         ('r2', 'c1', 0),
 | 
			
		||||
  ...         ('r2', 'c2', 1),
 | 
			
		||||
  ...         ('r2', 'c3', 1),
 | 
			
		||||
  ...         ('r3', 'c1', 0),
 | 
			
		||||
  ...         ('r3', 'c2', 1),
 | 
			
		||||
  ... ]
 | 
			
		||||
  ... matrix = rstat.getDataFrame(data)
 | 
			
		||||
  ... #return matrix
 | 
			
		||||
  ... return rstat.intermediateData
 | 
			
		||||
  ... x = rpy.with_mode(rpy.BASIC_CONVERSION, r.descript)(matrix)
 | 
			
		||||
  ... return x
 | 
			
		||||
  ... """
 | 
			
		||||
  >>> pp.setSource(source)
 | 
			
		||||
  >>> pp(request)
 | 
			
		||||
		Loading…
	
	Add table
		
		Reference in a new issue