Questions tagged as 'r'

2
answers

How to calculate the average of a column in R?

I have an Excel file in the format .csv (comma-separated values) and I want to read what's in a column, add and calculate its mean. How to open the file I already know, but I do not know how to add the values to calculate the average....
asked by 13.12.2014 / 20:20
3
answers

How to include columns in a data.frame?

Consider the following data.frame : df <- data.frame(x=c("a","b"), y=c(1,2)) How to include a new column, say z = c(1,2) ?     
asked by 14.09.2014 / 17:02
3
answers

geom_text by positioning the labels individually

I am making a chart similar to this example, where I position the labels by group: I'musingthecode:set.seed(1000)ano=factor(rep(1996:2016,2))cod=c(rep("K1",21),rep("O1.3",21)) valor=round(c(cumsum(rnorm(21)),cumsum(cumsum(rnorm(21)))),1) dat=d...
asked by 30.11.2018 / 16:23
3
answers

count of TRUE and FALSE

I have a vector with just TRUE and FALSE and would like to know how I can count how many TRUE and FALSE I have in this vector?     
asked by 03.05.2018 / 22:54
2
answers

Decrease the standard error in fitting (Std Error) R

I was trying to fit a theoretical function to a point distribution through the function nls2 . However, the adjustment errors are very large, ie if a parameter should be between 2 and 3, the adjustment finds 2 error of plus or minus 16,...
asked by 04.05.2017 / 22:43
2
answers

Matrix of Expression

I have the following array in the R: FC12h FC10d FC6w -8.44770875 -0.37171750 0 -56.72384575 2.64778150 2.94636550 -3.00214850 2.64778150 -1.57755700 I need some function that causes numbers greater than zero to...
asked by 09.10.2018 / 18:50
3
answers

Split a date frame and save to separate directories

I have a data frame composed of 100 rows and two columns (name and quantity). The quantity column is an integer ranging from 1 to 4. How can I split my original date frame into four date frames following column 2 (quantity)? In other words, I...
asked by 07.07.2017 / 21:36
2
answers

Transform positive values into negatives in a data.frame based on a condition in another column (R)

I have the following data.frame :: df <- data.frame(Qtd=c(100,200,300,400,500), op=c('V','C','C','V','V'), stringsAsFactors=F) How can I turn the values in the Qtd column to negative if the value of the column op is V ??...
asked by 22.04.2016 / 18:15
2
answers

Overlap chart in R

How can I superimpose two or more graphs without the axis limits also overlapping in the figure? a = rnorm(1000) b = runif(1000) plot(a, type = "l") par(new = T) plot(b, type = "l", col = "blue", xlab = "", ylab = "") #os eixos de y ficam sobr...
asked by 08.09.2015 / 18:27
1
answer

Boxplot in the default of R

I want to connect a line connecting several boxplots in R . I've already tried using the abline and lines functions, but I did not succeed. How can I solve my problem?     
asked by 25.05.2018 / 16:12