R: Naming matrix rows/columns in a for-loop works in console, but not when...
I am attempting to use a for loop to rename the rows and columns of a matrix via the following code:Z = matrix(c(1:120), 15, 8)for (i in 1:15) { rownames(Z)[i] = paste0("[", format((-1)*(4-(i/10)),...
View ArticleHDF format variable extraction
I have a folder with hdf files and trying to extract variable (column amount of NO2) from a list of variables. After extracting the variable, stack all the files containing that particular variable and...
View Articlenon-NA cases=0 error in RM ANOVA (is my data not suitable for RM ANOVA?)
Hi I am new to statistics and analyzing my first data. I am having trouble with Repeated measures AnovaTo summarize my data, my study is a 3X2 Anova.Every subject visited 3 days and one of the three...
View ArticleHow do I collect Twitter lists_memberships from several users in R?
I would like to get the names of the lists a Twitter user is a member of. I can do this one by one:nytimes <- lists_memberships("nytimes", n = 1000, cursor = "-1", filter_to_owned_lists = FALSE,...
View ArticleR Shiny--Error in as.POSIXlt.default: do not know how to convert 'x' to class...
Here I want to write an app to calculate bond schedule and show it in a table. But the following problems always appear in error and I don't know how to solve them.Error Message:Warning: Error in...
View ArticleGetting the range of a data frame including zero
Here is a simple question. I have a data frame with values ranging from 0 to 3 and I want to get the number of elements of the dataset, which should be 4 in this case. Here is an example of the...
View ArticleValidation in jupyter notebook with "The source of the following cell has...
So I edited a locked cell, and then I validate the notebook I get this error:The source of the following cell has changed, but it should not have!Any input on how to fix this error?
View ArticleHow to use an abbreviated vector to match a vector with a full name
tableA$area = c("太原市尖草坪区","安庆市宜秀区","北京市大兴区")tableB$locate = c("尖草坪区", "宜秀区", "大兴区")I need to combine tableA and tableB by c("area" = "locate"). How can I realize it?
View ArticleOdd's Ratio Plot Produced by the plot_model() function in the sjPlot package...
Problem:I have produced an odds ratio plot (below) from the data frame called FID (below) using the plot_model() function in the sjPlot package, but the figure is too large for the plotting window.I...
View ArticleExtracting names from a VarCorr object in lme4 and pasting it as column names
Below I was wondering if there might be a way to extract the columns Name and Groups from vc1 and vc2 and respectively paste them as the column names for objects AA, BB.For example, for MODEL 1...
View ArticleHow to add a strata variable in the crr function?
I am trying to test out a Fine and Gray regression and to validate if both the "crr" package and the "survival" package produce the same results. I will then be putting these results into Latex.The...
View ArticleHow to index coordinate data according to a grid in R?
I have coordinate data (x-coordinates and y-coordinates) on a scale between:Xpos: 27-1367nm, Ypos: 67-1014nm. A data set consists of about 2500-3500 data points.Here is the header of such a data set:...
View ArticleHow do I split a matrix with different column sizes?
n <- c(12,24)mu<-c(6.573,6.5)sigma<-sqrt(0.25)Diseased.Data<-round(rnorm(n[1], mu[1], sigma), 4)Healthy.Data<-round(rnorm(n[2], mu[2], sigma), 4)g <- c(2,3,4)for(i in 1:3){...
View ArticleHow to fit a multivariate normal distribution in R?
I need to fit a multivaraite normal distribution to each specie in the Iris dataset in R. I saw the mvtnormpackage might be useful; however, i want to use the maximum likelihood estimation and not sure...
View Articleis there any way to Build up Heroku For R code like Python
I have Made a mL model to complete an end to end project. I know how to run heroku for python. I can not find any way to do with R code for Heroku. can Any one help me with this. I want to deploy the R...
View ArticleHow can I compare the values of different columns for each row?
So say I have a dataframe with a column for "play" and two columns with values:df <- data.frame(Play = c("Comedy", "Midsummer", "Hamlet"), he = c(105, 20, 210), she = c(100, 23, 212)) I would like...
View ArticlePredict with a VECM with exogen variables
After having estimated a VECM model with stationary exogen variables, I would like to compute a prediction with the predict function and the newdata argument. I'm using the Dynts library that offers...
View ArticleHow to download package "markovchain" for R version less than 3.6
I have R version of 3.4.4 loaded on my laptop but I want to download package "markovchain" in my R.THE CODE I USED WASinstall.packages("markovchain", dependencies=TRUE,...
View Articlecategorizing a new variable based on two conditions overwriting
I am trying to recode a race/ethnicity variable derived from a Hispanic variable and a 6 other race variables.I've tried some of these methods. I can't quite figure out how to keep all my different...
View Articleemmeans error: In Ops.factor(r, 2) : ‘^’ not meaningful for factors
I am misunderstanding something about my data structure for an analysis with emmeans. I'd like to see the pairwise comparisons, like a TukeyHSD test.Here is my data frame:dat...
View Article