package SPVM::R::OP::DataFrame; 1; =head1 Name SPVM::R::OP::DataFrame - Data Frame Operations =head1 Description R::OP::DataFrame class in L has methods for operations for data frame. =head1 Usage use R::DataFrame; use R::OP::DataFrame as DFOP; use R::OP::Int as IOP; use R::OP::Double as DOP; use R::OP::String as STROP; my $data_frame1 = R::DataFrame->new; $data_frame1->set_col("name", STROP->c(["Ken", "Yuki", "Mike"])); $data_frame1->set_col("age", IOP->c([19, 43, 50])); $data_frame1->set_col("weight", DOP->c([(double)50.6, 60.3, 80.5])); my $data_frame2 = R::DataFrame->new; $data_frame1->set_col("name", STROP->c(["Jonh"])); $data_frame1->set_col("age", IOP->c([25])); $data_frame1->set_col("weight", DOP->c([(double)40.6])); my $data_frame3 = DFOP->cbind($data_frame1, $data_frame2); See also L. =head1 Class Methods =head2 cbind C ($x_data_frame : L, $y_data_frame : L);> Creates a new L object, adds all columns of $x_data_frame and all columns of $y_data_frame are added to the new data frame object, and returns the new data frame object. This method calls L method. Exceptions: The data frame $x_data_frame must be defined. Otherwise, an exception is thrown. The data frame $y_data_frame must be defined. Otherwise, an exception is thrown. Exceptions thrown by L method could be thrown. =head2 rbind C ($x_data_frame : L, $y_data_frame : L);> Creates a new L object, adds all rows of $x_data_frame and all rows of $y_data_frame are added to the new data frame object, and returns the new data frame object. Exceptions: The data frame $x_data_frame must be defined. Otherwise, an exception is thrown. The data frame $y_data_frame must be defined. Otherwise, an exception is thrown. The column numbers of the data frame $x_data_frame must be equal to the column numbers of the data frame $y_data_frame. The column name at column index $i of the data frame $x_data_frame must be equal to the column name at column index $i of the data frame $y_data_frame. Otherwise, an exception is thrown. The type of the n-dimensional array at column index $i of the data frame $x_data_frame must be equal to the type of the n-dimensional array at column index $i of the data frame $y_data_frame. Otherwise, an exception is thrown. ($i is a column index) =head2 subset C ($x_data_frame : L, $indexes : L, $options : object[] = undef);> Gets the subset of the data frame $x_data_frame given the indexes $indexes and the options $options, and returns the subset. Same as the following code using L method. $x_data_frame->slice($colnames, [$indexes]); ($colnames is the value of key C : string[] = undef Column names. =back Exceptions: The data frame $x_data_frame must be defined. Otherwise, an exception is thrown. The first column of $x_data_frame must be a vector if columns exists. Otherwise, an exception is thrown. Exceptions thrown by L method could be thrown. =head2 na_omit C ($x_data_frame : L);> Gets the subset of the $x_data_frame which rows does not contains NA data and returns the subset. This method calls L method. Exceptions: The data frame $x_data_frame must be defined. Exceptions thrown by L method could be thrown. =head1 See Also =over 2 =item * L =item * L =item * L =back =head1 Copyright & License Copyright (c) 2024 Yuki Kimoto MIT License