Lô đề online
R is a free, open-source programming language and software environment for statistical computing, bioinformatics, visualization, and general computing. Please provide minimal and reproducible example(s) along with the desired output. Use `dput()` for data and specify all non-base packages with `library()` calls. Do not embed pictures for data or code, use indented code blocks instead. For statistics related questions, use http://stats.stackexchange.com.

Instead of copy and paste corresponding columns into excel, I want to amend several columns in a consecutive way based on serial ID named addr.
Assume my data sets are like these
df1 <- data.frame(...

I am struggling to create an annual variable in my dataset. I have monthly time series data. Dates are in the format Day-Month-Year. In total, I have five years worth of data, with "id" ...

I am using Mixor package (http://www.rdocumentation.org/packages/mixor/versions/1.0.4/topics/mixor) to analyze influencing factors on individuals' injury severity. I considered individuals involved ...

I have a function which takes a character vector with variable names and an index which determines which of the variables is chosen as input for a dplyr::filter(). I have a very clunky way of ...

asked 24 mins ago

TimTeaFan
3,64722 gold badges55 silver badges2020 bronze badges

I would like to calculate the within-group covariance matrix from a nested list, where the sub-lists represent the groups, and I am having trouble ignoring the non-numeric columns in each sub-list.
...

So essentially, what I want to do is replace every element in a matrix with the maximum of neighboring cells within a window that is determined by the value in that cell.
The window size would be ...

I am a novice programmer, please excuse if I am not clear or missing relevant information. I have a shiny app written that imports a dataframe from another set of code. I would like to update that ...

I am working with time series data (6000 observations, over 7000 days) that is said to be "daily". However, measurements do not necessarily happen everyday. Sometimes, several measurements ...

asked 1 hour ago

stats555
9511 silver badge55 bronze badges

Good evening everyone!
I want to do a comparison between dates in R.
I have 2 datasets, maint.csv and failures.csv:
> str(maint)
'data.frame': 3286 obs. of 3 variables:
$ datetime : POSIXct, ...

I have a data that looks like this:
The sample data can be created by codes:
structure(list(tx = c("Form: Enrollment", " Field Name Data Type Field Label Units Pre-Filled ...

Well, I've been working with Markdown for a year and today, suddenly, next to the headings an a tag has been automatically added.
Someone would know why these anchors have been generated automatically ...

I have a 2x2x10 array of identity matrices, created with
arr = array(diag(2), dim=c(2,2,10))
I'm looking to multiply each 2x2 matrix within that array by a scalar c(1:10)
z = arr[,,1:10] * c(1:10)
...

My question relates to the use of R for the derivation of maximum likelihood estimates of parameters when a probability distributions is expressed in the form of an infinite sum, such as the one below ...

So I am trying to work out the mean for a column on my dataset. When I use the code
mean(dataset$`name of column`)
it returns
'argument is not numeric or logical: returning NA'.
I have tried ...

I am working on a dataset where it has a variable of 3 digit US zip code. I am just wondering is there a CSV table that can indicate which area each 3 digit zip code corresponds to, such as the county ...