Langsung ke konten utama

Postingan

Menampilkan postingan dari Januari, 2024

How to Create Some Functions [func()] using R?

Creating some functions using R Hello everyone, in this section, I want to share with you how to create some functions in the R language. In some cases, maybe we face a problem that is ineffective when finished using traditional calculations or manual processes. So, we need a function that may work effectively and efficiently in solving our problems. In this post, we want to practice how to make some simple functions which may finish some cases. I will provide examples below based on my daily work experiences. Some of these examples may be new to you, but the important thing is that I hope you could catch the point of making functions. In the certain stage of practice, we will use special package like dplyr. Like pandas in python, dplyr has some functions that we need for data manipulation. Furthermore, we want to practice how to build a function using one or more parameters that we used to solve our problem. At the end of this post, we will try to solve some quadratic equations using ...

How to Import Data, Manipulate It, and Making Automatically Split Data by Unique ID using R?

Import Data, Data Manipulation, and Save Split Data by Unique ID Hello readers, I'm so happy to say that I can share on this blog again. Now, I'll show you about how to manipulate data which imported from computer. The main package that so powerful in data manipulation is dplyr. This package is like pandas used in Python. In this section, we import the data first and then we manipulate the digit of id and code (kd_kab, kd_kec, and kd_desa) with same variable's name. It realized using mutate() function that available in the package. However, the data that used just dummy data I prepared in xlsx format (excel). After changing the digits, we run the code to make a new variable named "splitbase". This variable will be the base of splitting data in unique id. It may be a rare case in our daily data preprocessing, but I certain that this case would be found in real data, especially administration data. The final stage of this section is how to save split data automatica...