Skip to content

Commit

Permalink
Merge pull request #9237 from Patowhiz/paste_from_clipboard
Browse files Browse the repository at this point in the history
Fixes paste from clipboard bug
  • Loading branch information
N-thony authored Nov 7, 2024
2 parents 9bd2f3f + fd2695a commit 11f4f92
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions instat/static/InstatObject/R/data_object_R6.R
Original file line number Diff line number Diff line change
Expand Up @@ -1263,8 +1263,13 @@ DataSheet$set("public", "paste_from_clipboard", function(col_names, start_row_po
#set the row positions and the values
rows_to_replace <- c(start_row_pos : (start_row_pos + nrow(clip_tbl) - 1 ))
new_values <- clip_tbl[,index]
#replace the old values with new values
self$replace_value_in_data(col_names = col_names[index], rows = rows_to_replace, new_value = new_values)

# Replace the old values with new values
for (i in seq_along(new_values)) {
# Replace each value one by one
self$replace_value_in_data(col_names = col_names[index], rows = rows_to_replace[i], new_value = new_values[i])
}

#rename header if first row of clip data is header.
if(first_clip_row_is_header){
self$rename_column_in_data(curr_col_name = col_names[index], new_col_name = colnames(clip_tbl)[index])
Expand Down

0 comments on commit 11f4f92

Please sign in to comment.