From 162574f0b6d9cfa4a54bf44a46afe8871c1f4108 Mon Sep 17 00:00:00 2001 From: Chandra Prakash Date: Tue, 23 Oct 2018 21:35:38 +0530 Subject: [PATCH] R: Rearrange reference section and code (#19826) --- guide/english/r/data-types/index.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/guide/english/r/data-types/index.md b/guide/english/r/data-types/index.md index 17a22b2ea4..9e71c96e91 100644 --- a/guide/english/r/data-types/index.md +++ b/guide/english/r/data-types/index.md @@ -5,7 +5,7 @@ title: Data Types in R Scalar refers to an atomic quantity that can hold only one value at a time. Scalars are the most basic data types. Some common types of scalars : 1. Number - +```r > x <- 5 > y <- 5.5 > class(x) @@ -14,9 +14,10 @@ title: Data Types in R [1] "numeric" > class(x+y) [1] "numeric" +``` 2. Logical value - +```r > m <- x > y # Used to check, Is x larger than y? > n <- x < y # Used to check, Is x smaller than y? > m @@ -27,9 +28,10 @@ title: Data Types in R [1] "logical" > class(NA) # NA is another logical value: 'Not Available'/Missing Values [1] "logical" +``` 3. Character(string) - +```r > a <- "1"; b <- "2.5" > a;b [1] "1" @@ -42,7 +44,7 @@ title: Data Types in R [1] "numeric" > class(as.character(x)) [1] "character" - +``` ## Vector It is a sequence of data elements of the same basic type. For example: @@ -97,5 +99,5 @@ title: Data Types in R ## Reference: -Official Docs -Data Types in R by r-bloggers \ No newline at end of file + * [Official Docs](https://cran.r-project.org/manuals.html) + * [Data Types in R by r-bloggers](https://www.r-bloggers.com/classes-and-objects-in-r/)