R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

convMeter<- function(val, to= "inch"){
  mult<-
    switch(to, inch=39.3701, foot=3.8084, yard
           =1.09361,mile=0.000621371,CM = 100,NA)
  if (is.na(mult))print("Unkown target unit of length,")else return(val*mult)
}
convMeter(23,"foot")
## [1] 87.5932
Inches= convMeter (40,"inch")
sprintf("40 metters are equilvalent to %f inches", Inches)
## [1] "40 metters are equilvalent to 1574.804000 inches"
convMeter(40)
## [1] 1574.804
convMeter(5,"CM")
## [1] 500
convMeter(2.4,"km")
## [1] "Unkown target unit of length,"
set.seed(30)
x<- rnorm(50)
x
##  [1] -1.28851820 -0.34768941 -0.52162885  1.27347316  1.82452060 -1.51130794
##  [7]  0.11050805 -0.76079623 -0.66989702  0.27451969 -1.02327202 -1.81939791
## [13] -0.66778981 -0.05929799  0.88016591  0.26851292 -0.01957938 -0.52494697
## [19] -1.40933143 -1.83398921 -0.15831429  0.75442657 -0.91212962  0.79993114
## [25]  1.49055300 -1.09640199 -0.53422069 -1.42120303 -1.24273830  0.23193618
## [31] -1.72520250  0.61486070  0.72687514 -0.04219020  0.21600180  1.76973639
## [37]  0.22035091  0.53147867  2.16970096 -2.93441824 -0.99556463  1.16955322
## [43] -0.48003984 -1.66886763  1.13399719 -0.31759583  0.17585799 -0.62550955
## [49] -1.63952782 -0.67148442
y= mean(x)
y
## [1] -0.2457178
x2<-rnorm(50, mean=50, sd=,1)
x2
##  [1] 49.15103 50.12322 49.38032 48.28628 50.71583 49.08447 52.59840 49.48839
##  [9] 49.13365 50.38722 50.97406 50.39918 50.34825 49.70951 51.57662 50.84628
## [17] 49.08064 50.40055 50.35437 51.65777 51.11479 49.25938 52.01088 49.97439
## [25] 49.91478 50.50159 49.27480 51.10537 49.36743 49.80280 50.85154 49.43385
## [33] 49.84777 49.57109 52.21870 47.96642 48.93405 51.57212 49.26955 50.45052
## [41] 50.56442 49.77822 49.53069 50.57269 48.70679 50.26133 50.10017 50.26956
## [49] 50.21192 48.61629

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.