Quantcast
Channel: Active questions tagged r - Stack Overflow
↧

Relative frequencies of multiple variables in R [duplicate]

apologise for the very basic question but I am trying to calculate relative frequencies (%) of variables within a column grouped by another column. Example data:df <- data.frame(Case =...

View Article


Open a file in notepad++ via a powershell function with the r function...

I have a powershell script OpenFile.ps1# path to notepad++$notepadPlusPlusPath = "C:\Program Files\Notepad++\notepad++.exe"# Because the path contains whitespaces "`"$filePath`""$filePath =...

View Article


R shiny - Return json from server.R to POST request

I'm trying to use shiny to mimic an API.I've got a shiny app that reads parameters in the url (with parseQueryString(session$clientData$url_search)), computes a map based on those parameters, and...

View Article

Start a PowerShell script in R via system2()

My line of code in the R console is like this:system2("powershell", args=c("-File", "C:\\Path To File\\PowerShellScript.ps1"))And the PowerShell script itself is very simple. It just should start...

View Article

How to match 1 variable in dataframe with potential values in many other...

I have a dataframe with columns for State, state abbreviation, age, year, and years 2012-2015 (indicated by columns Y2012, Y2013, Y2014, Y2015. There is a law that came into effect in 2013 in Alabama...

View Article


Image may be NSFW.
Clik here to view.

Assigning different sets of colours to two different data frame columns using...

I have a dataset of 49 rows, that I have first arranged in ascending order (by CTaa_beta), and then split it into two data frames.#datatopclones<- structure(list(CTaa_beta = c("CASSEGTSGGASTQYF",...

View Article

Updated tlmgr as requested by tinytex, and now knitting the markdown file to...

I followed all of Yihui's debugging steps here: https://yihui.org/tinytex/r/#debugging. I am knitting a Rmarkdown file from within an R script (as I have some variables that change value every time I...

View Article

'/bin/sh: Getting: command not found' in R Studio

I'm trying various ways to analyse data from Excel in R and have previously done it with no problem. Today, I exported the file fine and attempted to assign it to an object, only for the same error to...

View Article


New to R: How to resolve this error so that I can knit this .rmd file to a pdf?

This is the R markdown file I'm trying to knit, it is basically the auto generated template from the APA 6th template from the papaja package:---title : "The title"shorttitle : "Title"author: - name :...

View Article


Does GLMMTMB Automatically Convert Character Columns to Factors? [closed]

I am running a model in glmmTMB and the outputs are dramatically different if I change the columns from characters to factors. I am assuming that the package would auto convert to factors or would give...

View Article

Image may be NSFW.
Clik here to view.

R ggplot2 legend inside the figure

So, I have the following data.frame, and I want to generate two plots in one graph for yval vs. xval, for each zval and type tp. The lef> df xval yval se zval cond1 1.0 1.831564e-02 1.831564e-03 0...

View Article

R Predict function returning fitted values only

in R I am trying to predict a single value. However, I return all the fitted values when I run the code.I have copied the code directly from my course materials and I get the same result.Am I missing...

View Article

Logistical Regression [closed]

I have 4 variables:Dependent Variable: Is the claim rejected or not? (Yes / No)Independent Variable 1: Age Group of Claimaint (1-19 / 20-29 / 30-39 / 40-49 / 50-59)Independent Variable 2: Salary Range...

View Article


Error in readRDS(file) : unknown input format

I am trying to install custom packages in my Rprofile.site file. I want to install packages in the site file because I have to install these packages on several users' computers. However, I am getting...

View Article

Warning in parsing with lubridate

I try to parse a dataset with multiple issues in the date format. Here is a small example:tibble( date = c("31.12.", "30.01.", "30.02.")) I do some clean-up and end up with an warning I don't...

View Article


Order dataframe conditionally [duplicate]

I have the following dataframe:df <- structure(list(car1 = c("B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B", "B",...

View Article

aggregate means and keep N

I'm trying to aggregate a dataset, but I want to also keep the number of observations. So what I have is similar to this:aggregate(iris$Sepal.Length, by=list(iris$Species), FUN=mean)But that returns an...

View Article


How to use query_wikidata() (function available in WikidataR package for R)...

I am trying to make a wikidata query using WikidataR package for R. My query shoud have the following results :for each item of a list of wikidata elements (such as Q124988842, Q125696676, Q130644039)...

View Article

Image may be NSFW.
Clik here to view.

Display a Gamma distribution in a bar plot in ggplot2 [closed]

I would like to display in this plot the curve of the gamma distribution of the data. I am not finding the most clear approach on how to do it. Does anyone have any suggestions?p2 <-...

View Article

Image may be NSFW.
Clik here to view.

How can I make a graf that is like a table with colors? [closed]

Ok, I know it was not a really good question, but I dont know how to describe it better. What I want is something like that in the picture, but where the size represent how many of that bacteria are in...

View Article

PDF URL opens in a browser, but I can't get it with httr [closed]

When I open this URL in the...

View Article


trying to download "omp" package [closed]

I don't know how and where to download the omp package for the Omilog analyses.I followed the instructions reported, but it looks like the package is not available at the indicated URL (I've tried...

View Article


multiple output regression: getting "system is computationally singular"...

I am trying to run a multiple output multivariate regression where my dependent variables (Ys) are proportions in the range (0-1) and are somewhat related to each others.When using the function...

View Article

Image may be NSFW.
Clik here to view.

.Rprofile not accessible while using renv

I am using renv for this project and everything was working fine. I think the .Rprofile created by renv got corrupted. Now I can't open or delete that .Rprofile.I tried accessing the file but the file...

View Article

Extracting model coefficients for formula terms

If I fit an lm or glm with factors as explanatory variables, I get a model with estimates and SEs for each level of the factor (minus the baseline level). How can I reliably extract that info for...

View Article


How to save wd inside a function and move up two levels

How can I move two levels up from my current working directory to display a pdf that I am generating with an rmd file inside a function? for instance, my working directory is: C:/Users/Desktop/IBT but...

View Article

How to calculate power for quasi-poisson regression [closed]

I ran a quasi-poisson regression (due to overdispersion), now I'm wondering if there is a tool or R package that can be used to calculate the power of my test (and the sample sizes needed if I wanted...

View Article

Image may be NSFW.
Clik here to view.

how to fixed axis_nested in a facet plot?

I'm drawing a plot with annotation of y-axis labels using ggplot2 and ggh4x in R.how to fixed the position of axis_nested in a facet plot with scales="free_y"Here is the data:ggd = data.frame(...

View Article

Image may be NSFW.
Clik here to view.

how to polt Horizontal bar chart and p-value outside the x-axis in R [duplicate]

this's my datamicrobial_data <- data.frame( Taxonomy = c("Nocardioidaceae", "Nocardioidaceae", "Nocardioidaceae","Odoribacteraceae", "Odoribacteraceae", "Odoribacteraceae","Rikenellaceae",...

View Article



Azure Machine Learning - using CLI to run R code

I'm attempting to run a Azure ML job to train and save a model using R. It seems as if my pipeline runs, but it doesn't save the output. I'm using a very script first of all as a proof before I move...

View Article


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