Posts

Showing posts from August, 2020

List and Array in R language

 In this post we will see various method of list and Array. In previous post we Saw about vector and matrix, I hope this will be also easy for you. Let's start. List: We can say list and vector are pretty much similar but the only difference and the important one is that vector consist of same data element where as list consist of different types of data element.  To create a list we use a function called list() Here list take input from vector only but of different type at same time. So, make it clear let's see the example: Name<- c("Adam","Steve","Tom","Robert") Rollno <-  c (1,2,3,4) Mylist<- list(Name, Rollno) print (Mylist) Output:                [1]  "Adam" "Steve" "Tom" "Robert"                [1] 1 2 3 4  So, Over here we tooked different type of data element in list via vector only,  but this functionality is not allowed in vector. Array: Array is collection of data which can be pr

Vector and matrix in R language

 Hello everyone, In the last post We all saw about R language basic concept which was pretty easy right, so today we are going to start with vectors and matrix in R language. So let's start. Vector: vector consist of Data element in of same data type. The data element of a vector are called component.  To create a vector we use a function i.e. c(). Example: 1) a <- c(1,2,3,4,5,6,7)                    Print (a) Output: 1,2,3,4,5,6,7. 2) a<-c(1:10)     print (a) Here colon is used as a range from 1 to 10 Output: 1,2,3,4,5,6,7,8,9,10. To find a length of vector we use a function length (). length (a)    # output will be 10 for second example. To print a particular element in vector we use a square bracket ([]) i.e. a[5]   # This will print the fifth Element of vector. Matrix: Matrix is a collection of data element which are arrange in 2dimensional rectangular layout.   To create a Matrix we use a function matrix().  Syntax: matrix(data, nrow,ncol) - Where data is the input in v

R programming language

 There are millions of programming languages out there. But each one's have different functionality and uses. So, today we gonna talk about R language.  R language was developed by Ross Ihaka and Robert Gentleman in 1993. This language is basically used for statistical analysis and graphical representation of data.  So, as you know all language has different syntax and token's let's see about R language. 1) Comment : Comment are basically a sentence in the program which is not executed it is just use to make program more informative for the person who is reading your program. To use comment we use a symbol hash (#). Ex: #program to print Hello World. 2) Variables: variables are basically a place to store a data. Ex: a=10. Here a is a variable of type numeric. There are certain rules for creating variables which are  1) variable name must start With a letter only.  2) But variable can contain underscore (_) and Dot sign, no special characters are used Ex: Of invalid variable