说明 在前一篇中,我们介绍了 R 语言和 R Studio 的安装,并简单的介绍了一个示例,接下来让我们由浅入深的学习 R 语言的相关知识. 本篇将主要介绍 R 语言的基本操作.变量和几种基本数据类型,好对 R 语言的使用方法有一个基本的概念.通过本篇的学习,你将了解到: R 语言有哪些基本操作 什么是变量,以及如何给变量赋值 R 语言有哪些基本数据类型,如何确定变量的数据类型 R 语言的基本操作 R 语言的默认提示符是 > ,它表示正在等待输入命令,每次输入命令后敲击回车即可执行当前命令. R
R gsub Function gsub() function replaces all matches of a string, if the parameter is a string vector, returns a string vector of the same length and with the same attributes (after possible coercion to character). Elements of string vectors which ar
public class Program { public string str = "spp"; public string spp = "Hello World!"; public static void Main(string[] args) { Program p = new Program(); Console.WriteLine(p.GetType().GetField(p.str).GetValue(p).ToString()); Console.Re
public partial class Form1 : Form { string str = "spp"; public string spp = "very good"; public Form1() { InitializeComponent(); MessageBox.Show(this.GetType().GetField(str).GetValue(this).ToString()); } }
可以实现的方法有: globals(),locals(),eval(),exec() 演示: exce法 In [6]: exec('name="bob"') In [7]: name Out[7]: 'bob' globals用法: In [1]: globals()['name']='bob' In [2]: name Out[2]: 'bob'