What's the fastest alternative in R to do this string regex processing?
I'm dealing with 75GB XML files i.e. it's therefore impossible to load them in memory and build a DOM XML tree. Therefore I resort to processing chunks of lines (using readr::read_lines_chunked) in...
View ArticleSeparate/Group plain text with Regex and PHP
I can separate data from the plain text below with Regex.Plain text:190.A 42-year-old male patient has been delivered to a hospital in a grave condition with dyspnea, cough with expectoration of...
View Articlematching and filling in blanks of data frame in R
I have data with double entries, that looks like this:+-----+-------+-----------+-----------+--------+ | id | first | last | birthyear | father | +-----+-------+-----------+-----------+--------+ | a12...
View Articleusing group_by with filtered inputs in shiny for map
I have what may be a complicated question. I'm trying to build a filterable map with shiny. I'm using the selectizeGroupUI feature because it allows you to easily filter inputs in a way that links all...
View ArticleApproximating a statistical calculation
First, what on earth is going on inside this code block?run7=c() for (i in 1:1e4) { run1 = sum(runif(14) > 0.7) run7 = c(run7, run1 < 4) } run9 = sum(run7) / length(run7) Second, how do I...
View ArticleHow to filter greatest value for each hour in a data frame? [duplicate]
This question already has an answer here:How to select the row with the maximum value in each group 10 answersGet last row of each group in R [duplicate] 4 answersEssentially, I want to create a bar...
View ArticleClassification - Usage of factor levels
I am currently working on a predictive model for a churn problem. Whenever I try to run the following model, I get this error: At least one of the class levels is not a valid R variable name. This will...
View ArticleRemoving rows of character strings that are subsets of a larger character string
I'm using the below codes to create association rules for a project;RawData_Kicks_Rules <- apriori(RawData_Kicks_ALLKICKS, parameter = list(supp = 0.005, conf = 0.5, minlen=3, maxlen=9))...
View Articleselecting the top n elements from a row and taking their mean
I have a data that represents assets returns. I want to select top N assets from each row and calculate mean of return of that selected assets. In detail,I want to make a function that would select...
View ArticleR install_github: Error: Failed to install 'unknown package'
I'm new to GitHub and I'm stumped. I can't get install_github to work.I followed the helpful instructions here to set up my account: https://kbroman.org/github_tutorial/pages/init.html. I have an...
View ArticleIn HMM, how to extract probability (not delta probability) of observation...
I'm trying to get the probability of the last observation being generated by each state. But the posterior function seems to give "delta probability".With the probability and transition matrix, can I...
View ArticleExpanding the summary table in r
Good day,I've got a table with 15000 rows of data with 5 variable columns. I'm using the summary function in R and I get the following output:enter image description hereWhich is fine, however, I was...
View ArticleApplying a function to each element of a group in R data frame
I am trying to find the first non-NA element of column w in each group and then construct a new variable which starts from the index of that non-NA element and follows this law of motion:...
View ArticleHow to use the R survey package to analyze multiple response questions in a...
I'm relatively new to R. I am wondering how to use the 'survey' package (http://r-survey.r-forge.r-project.org/survey/) to analyze a multiple response question for a weighted sample? The tricky bit is...
View ArticleIs there a way for HTML output from r package flextable to have a vertical...
I am creating HTML output from a dynamic table in R using flextable as follows:output$tbl <- renderUI({ DF %>% flextable() %>% autofit() %>% theme_booktabs() %>% empty_blanks() %>%...
View ArticleIs there a way to put a dataframe in the same order as another one in R
I have two dataframes (with 43 variables and 53 rows) from a survey, both have the same values but the rows are ordered in two random different ways. Also, some rows have the same values as other rows....
View ArticleR: how do you add a red dot line in residual plot for funnel type shape?
I want to add a red dot line in the residual scatterplot in R to look like the one from SPSS.So it is clear for you to say there is a funnel type pattern in the residual plot, then the residual does...
View ArticleSetting up a conditional group_by
I have a set of data that looks as such:+----------+------------+-------+-------+ | step1 | step2 | step3 | step4 | +----------+------------+-------+-------+ | Region 1 | District A | 1A | 571 | |...
View ArticleFetching JIRA data with R
I am able to access the data in json format from a web browser as followshttps://xxxxxxx.atlassian.net/rest/api/2/search?jql=assignee=username but not able to fetch data using curl or httr...
View ArticleTime series analysis: How would I fit a Y_t = a + b*t + Z_t model to data on R?
I want to fit the model $Y_t=a+(b\cdot t)+Z_t$ to my data, where $Z_t$ is white noise on R.Does the function summary(fit <- lm(data)) includes white noise or would I need to add Zt on?How do you get...
View Article