Вы находитесь на странице: 1из 2

R version 3.3.

0 (2016-05-03) -- "Supposedly Educational"


Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin13.4.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.


You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors.


Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or


'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

During startup - Warning messages:


1: Setting LC_CTYPE failed, using "C"
2: Setting LC_COLLATE failed, using "C"
3: Setting LC_TIME failed, using "C"
4: Setting LC_MESSAGES failed, using "C"
5: Setting LC_MONETARY failed, using "C"
[R.app GUI 1.68 (7202) x86_64-apple-darwin13.4.0]

WARNING: You're using a non-UTF8 locale, therefore only ASCII characters will work.
Please read R for Mac OS X FAQ (see Help) section 9 and adjust your system
preferences accordingly.
[History restored from /Users/ReynaldoFarera/.Rapp.history]

> c(2,3,5,8,13)
[1] 2 3 5 8 13
> Country = c("Brazil","China","India","Switzerland","USA")
> LifeExpectancy = c(74,76,65,83,79)
> Country
[1] "Brazil" "China" "India" "Switzerland" "USA"
> LifeExpectancy
[1] 74 76 65 83 79
> Country[1]
[1] "Brazil"
> LifeExpectancy[3]
[1] 65
> seq(0,100,2)
[1] 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34
[19] 36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 68 70
[37] 72 74 76 78 80 82 84 86 88 90 92 94 96 98 100
> CountryData = data.frame(Country,LifeExpectancy)
> CountryData
Country LifeExpectancy
1 Brazil 74
2 China 76
3 India 65
4 Switzerland 83
5 USA 79
> CountryData$Population = c(199000,1390000,1240000,7997,318000)
> CountryData
Country LifeExpectancy Population
1 Brazil 74 199000
2 China 76 1390000
3 India 65 1240000
4 Switzerland 83 7997
5 USA 79 318000
> Country = c("Australia","Greece")
> LifeExpectancy = c(82,81)
> Population =c(23050,11125)
> NewCountryData = data.frame(Country,LifeExpectancy,Population)
> NewCountryData
Country LifeExpectancy Population
1 Australia 82 23050
2 Greece 81 11125
> AllCountryData = rbind(CountryData,NewCountryData)
> AllCountryData
Country LifeExpectancy Population
1 Brazil 74 199000
2 China 76 1390000
3 India 65 1240000
4 Switzerland 83 7997
5 USA 79 318000
6 Australia 82 23050
7 Greece 81 11125
>

Вам также может понравиться