Quantcast
Channel: Active questions tagged r - Stack Overflow
Browsing all 206180 articles
Browse latest View live
↧

Could you advise how do we solve this issue in R as i just started some...

a) Import the file Exercise_4.txt into "Tables_4" object. (Exercise_4.txt contains the following information: "Random"&"Variable"&"Constant" 0.342344236375671&1&1...

View Article


Trying to plot word count on a geom_col. Can't seem to figure it out

Trying to plot wordcount in a geom_col.library(dplyr) library(ggplot2) library(tidytext) df <- read_csv("C:/Data/Data.csv") df %>% count(word, sort=TRUE) top_n(df, 15) %>% ggplot(df,mapping =...

View Article


What's the equivalent of this R function in python

I've this variables in R:n <- 112 #Observations p <- 4 # Variables alpha <- 0.05 # Alpha is alpha quant=qt(1-alpha/2,n-p-1) # which is 1.982383 From my researches, qt function from R is...

View Article

R export doesn't recognize the existing dataframe

I have some data frames I created in R and I want to export them to excel, but R doesn't recognize the dataframe already exists and it creates the file with the sheets but no data. So using the code...

View Article

Image may be NSFW.
Clik here to view.

R function not returning corpus

I have created a function to clean the corpus#function to clean corpus clean_corpus <- function(df, dfcol) { wordCorpus <- VCorpus(VectorSource(data.table(df$dfcol))) #create corpus wordCorpus...

View Article


Convert column/variable to row names for multiple lists in R with sapply

I am trying to convert a column to row names for each list of an object using sapply.tibble::column_to_rownames() is not an option because it "always returns a data frame".For a single variable (class...

View Article

One way among different expressions of "subset()" function failed in R

I found in the Help file of subset() that different syntax occur for the "selection" or "inverse selection". Specifically, in "selection" example, the columns's name are surrounded by c(), but in...

View Article

Generating sample using rnorm

Mean = 10, SD = 1Q: Generating sample of 100 patients of the population with triglyceride reduction, estimate mean of sample with confidence interval 99%. rnorm(100, 10, 1). This will work. However, I...

View Article


adding a dashed line to mark the mean in ggplot

I would like to plot the following data frame as a boxplot:df <- structure(list(gender = c("M", "M", "F", "F", "F", "M", "M", "M", "F", "F", "M", "M", "F", "F", "M"), age = c(0.047843262001096,...

View Article


How to plot a bar chart for selected observations in R studio [closed]

I am trying to produce a bar chart for the average number of employees in different companies where the year should be before 2000. I have data on the number of employees for each company between the...

View Article

Resolving "Warning in if (stri_startswith_fixed(body, "{")) { :..." when...

Currently getting this error when I make a POST request in plumber:Warning in if (stri_startswith_fixed(body, "{")) { : the condition has length > 1 and only the first element will be used Warning...

View Article

Image may be NSFW.
Clik here to view.

brms: how do I set prior on categorical variable?

I am building a binomial regression model using 2 categorical variables. This is from an example in the book, Statistical rethinking. In the book, while using the rethinking package, we can set priors...

View Article

Blogdown not rendering numeric lists in the correct order

Say I type the following in a regular markdown file:1. a 1. b 1. c When rendered, it will display:1. a 2. b 3. c For some reason, this doesn't happen in blogdown when using an Rmd file. Any thoughts on...

View Article


Access variable attributes inside dplyr user defined function

I'm trying to create a function to compute weighted averages from survey data, where the variable name is taken from a variable attribute. I have imported a dataset where each variable already has a...

View Article

R for loop: How to compare ith row to every other row (including self) then...

Let's say you have a table like this| Column 1 || a|| b|| c|| d|| e|| f|and in the for loop you want to check each row against itself and everything elselike take in row one (a), and do something that...

View Article


How to access single elements in a table in R

How do I grab elements from a table in R. My Data looks like this: V1 V2 1 12.448 13.919 2 22.242 4.606 3 24.509 0.176 etc...I basically just want to grab elements individually. I'm getting confused...

View Article

apply hpfilter to grouped variables with NAs using dplyr

I am trying to apply the hpfilter to one of the variables in my dataset that has a panel structure (id + year) and then add the filtered series to my dataset. It works perfectly fine as long as I do...

View Article


How to summarise one set of id values in a dataframe grouped by another set...

Having gotten my data into the format: pId fId 1 1 0 2 1 108 3 1 940 4 1 972 5 1 993 6 2 0 7 3 0 8 3 32 9 3 108 10 3 176 My goal is to try and (for a much longer set of data) determine which fIds each...

View Article

Image may be NSFW.
Clik here to view.

R Plotly : Horizontal Bar chart with Y axis on right

I am trying to plot bar chart with Y axis on right.Expectation : However I am unable to shift the y axis to right. I have tried with side = 'right' but it seems to not work.bar_plot_vertical_left <-...

View Article

How to apply Bootstrap estimation with complex sampling technique in R?

I need to compute bootstrap estimation of the standard error of the mean of the main variable in my sample. I would like to use the package "boot". The problem is that the sample was taken with a 2...

View Article
Browsing all 206180 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>