python (65.2k questions)
javascript (44.3k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (13k questions)
Simultaneously remove the first and last rows of a data frame until reaching a row that does not have an NA
I have a dataframe that contains NA values, and I want to remove some rows that have an NA (i.e., not complete cases). However, I only want to remove rows at the beginning and ending of the dataframe....

AndrewGB
Votes: 0
Answers: 7
Using dplyr and data.table with get() for reusibility and shiny - good practices in R
Main question:
What's the best way to pass variables to dplyr and data.table - when variables are not hard-coded but are acquired from user at run-time, as when entered from Shiny?
Example 1:
df <...

IVIM
Votes: 0
Answers: 0
Calculate mean difference values
I have the following data.table:-
set.seed(1234332)
kks <- data.table(name = c("a", "a", "b", "b", "b", "d", "d", "d"...
Shawn Brar
Votes: 0
Answers: 1
Is there a way to specify the current row in R data.table
The code below creates a minimal data.table, shows the approach I am using with a for loop, and prints the desired output.
library(data.table)
# example data.table where "ID" corresponds to...

3RK
Votes: 0
Answers: 2