Time Complexity of dplyr functions

  • Thread starter Thread starter Trollfaz
  • Start date Start date
Click For Summary
The time complexity of basic dplyr functions like filter(), select(), mutate(), rename(), summarize(), count(), separate(), unite(), spread(), and gather() is generally considered O(N), where N is the number of rows in the data frame. Assuming mutate operates in O(1), this holds true for single data frames. For operations involving two data frames, such as inner_join, left_join, and outer_join, the time complexity is O(N + M), where N and M are the row counts of the respective data frames. This reflects the need to process both data frames during the join operations. Understanding these complexities is crucial for optimizing data manipulation tasks in R using dplyr.
Trollfaz
Messages
143
Reaction score
14
TL;DR
R
For R's dplyr package this is my query.
Suppose I have a data frame/tibble of n observations or n rows. Let's call it df1. Is the time complexity for dplyr's basic manipulation functions O(N)
filter()
select()
mutate() assuming mutate is O(1)
rename()
summarize()
count()
separate()
unite()
spread()
gather()
If I have another data frame/tibble df2 of m rows, then are the following functions of time complexity O(N+M)
inner_join(df1,df2)
right/left_join(df1,df2)
outer_join(df1,df2)
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
25
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 7 ·
Replies
7
Views
8K
  • · Replies 14 ·
Replies
14
Views
4K