Introducing string variables in Python

We provide effective and economically affordable training courses for R and Python, click here for more details and course registration ! String variables in Python are data objects encapsulated in double or single quotes. For example we can create a string variable ‘msg’ and print it out in the following code. The basic function working on strings are print string with upper case, lower case, or title form. Several strings can be concatenated using plus Read more…

Introduction of S3 class in R programming

We provide effective and economically affordable training courses for R and Python, click here for more details and course registration ! S3 class system is the most used R object oriented programming mechanism. The calling of ‘S3’ comes from the third version of S, which is the ancestor of R programming language. You may not notice S3 when using R for data analysis, but actually It exists everywhere. For example, when a data frame is Read more…

Create, index and modify lists in R

We provide effective and economically affordable training courses for R and Python, click here for more details and course registration ! List is a type of data objects in R. It can store different types of data objects into one object. You can combine scalars, vectors, matrices, data frames, and even lists into a single list object. A list can be created using list() function in R. The code below shows a simple example to Read more…

How to create, index and modify data frames in R

We provide effective and economically affordable training courses for R and Python, click here for more details and course registration ! Data frame is the most widely used data object in R programming, due to the fact that a data frame can store different type of data contents (numeric, character, etc) into a tabular form. Creating a data frame is more than just simple. You can concretely combine several vectors into a data frame, as Read more…

Some useful functions for working with objects in R

We provide effective and economically affordable training courses for R and Python, click here for more details and course registration ! In this post, we will introduce and provide several useful and important functions in R. Most of them are fairly basic, and frequently used in data analysis with R programming. length() – get the length of an object dim() – to show the dimension of an object str() – to show structure of a Read more…

Using with() function to simplify your work in R

We provide effective and economically affordable training courses for R and Python, click here for more details and course registration ! with() function in R provides an alternative and often easier way to deal with data management and analysis. Say we have a data frame ‘grade’, and want to calculate the summary statistics of variable ‘Math’ and correlation between variables ‘Math’ and ‘Physics’. In the normal way, we can write the code as follows: If Read more…

Variable type and conversion in R

We provide effective and economically affordable training courses for R and Python, click here for more details and course registration ! In R programming, variable type can be numeric or character. Categorical variables are usually called factors. R provides a series of functions working with specific type test and type conversion. In the following code example, a data frame is loaded from a csv file, then specific variables are check if they are numeric or Read more…

Calculate mean, median and mode using Python

We provide effective and economically affordable training courses for R and Python, click here for more details and course registration ! Mean, median and mode are three statistics that measure the central tendency of numerical data. Mean is the average of sample, and median the mid point of the sample with value sorting from the lowest to the highest, and mode is the value that occur most frequently in the sample. In Python there are Read more…

Environment system in R programming

We provide effective and economically affordable training courses for R and Python, click here for more details and course registration ! R’s environment system behaves as a hierarchical folder system where objects in an R session are located. So when a R session is started, and with several objects created, the environment hierarchy in R session can be shown with function parenvs(). For exmple, in the following code, we create several objects, and then create Read more…

Sorting a list in Python

We provide effective and economically affordable training courses for R and Python, Click here for more details and course registration ! When a list is created in Python, the order of its element contained can be sorted in alphabetical order later. There are mainly two functions for sorting a list in Python. sort() function will sort a list’s elements permanently. If you just want to sort a list temporarily, you can use sorted() function. The Read more…