summary

conf.int no longer working in 3.3 using ggplot2, stat_summary

旧巷老猫 提交于 2019-12-12 21:16:49
问题 I am using conf.int for the creation of boxes around a jitterplot. This had worked until upgrading R to 3.3. Is there a known fix for this? stat_sum_df_all <- function(fun, geom="crossbar", ...) { stat_summary(fun.data=fun, geom=geom, ...) } ggplot(dataset, aes(factor(Group), dataset[, y] )) + labs(y=y, x="x") + stat_sum_df_all("median_hilow",conf.int=1, linetype='solid') Returns the following error: Error: Unknown parameters: conf.int 回答1: I have solved this issue by wrapping conf.int=1 with

R - stargazer add reference categories

╄→尐↘猪︶ㄣ 提交于 2019-12-12 18:31:45
问题 I was wondering if someone came with a solution to show up the reference categories of categorical variables using stargazer ? library(stargazer) Let us imagine that gear and carb are categorical variables mtcars$gear = factor(mtcars$gear) mtcars$carb = factor(mtcars$carb) I run an ols with lm1 = lm(disp ~ gear + carb, mtcars) and stargaze the results. stargazer(lm1, single.row = TRUE, omit.table.layout = "sn") I get However, I find myself always going back to the tex file to custom the

Summarise data frame ignoring repetition

橙三吉。 提交于 2019-12-12 12:41:12
问题 I have a data frame in which there are repetitions of entries in one column. I want to summarize the other columns based on the that one column. I wish the summary to consider each unique entry and not the total count when making the summary. For example in the data frame example below, if i want to answer the question on how many people surveyed are young,midage and old? "RefID" 1-1 is taken as a count of 1 in summarising "ageclass"=young and not interpreted as a count of 5. RefID Altitude

remove data points when using stat_summary to generate mean and confidence band

空扰寡人 提交于 2019-12-12 01:26:39
问题 I am using qplot to summarize a dataset and generate a plot for 2 ACL injured athletes that shows the mean EMG and 95% confidence interval band for different phases of a continuous jumping movement. Each athlete performed 20 jumps so this provides a summary of all 20 jumps for each athlete. Is there a straightforward method in qplot to generate a figure that shows only the mean value and the confidence band (i.e. that removes the individual data points)? I think this is a cleaner way of

How to exclude certain observations while generating summary statistics without creating a new data frame in R

旧时模样 提交于 2019-12-11 19:33:22
问题 My problem is: I have a large number of numeric variables for which I need to generate summary statistics. Some of the observations are coded "-99", which means the participant does not know the answer to the survey question. While calculating means for such variables, I want to exclude the "-99" observations. Since I have a lot of variables, it would be quite onerous to use "subset". Does anyone know an easier way? PS: I know that for factors, the >- Summarize(df, exclude ="") command in the

summarize from string matches

最后都变了- 提交于 2019-12-11 18:42:33
问题 I have this df column: df <- data.frame(Strings = c("ñlas onepojasd", "onenañdsl", "ñelrtwofkld", "asdthreeasp", "asdfetwoasd", "fouroqwke","okasdtwo", "acmofour", "porefour", "okstwo")) > df Strings 1 ñlas onepojasd 2 onenañdsl 3 ñelrtwofkld 4 asdthreeasp 5 asdfetwoasd 6 fouroqwke 7 okasdtwo 8 acmofour 9 porefour 10 okstwo I know that each value from df$Strings will match with the words one, two, three or four . And I also know that it will match with just ONE of those words. So to match

How to get sum by groups in Crystal Report

耗尽温柔 提交于 2019-12-11 10:27:16
问题 I want to get the sum by the groups in Crystal Reports. Group OVERALL ----------------- group 1 -------------- 5.00 5.00 10.00 -------------- total group 1 20.00 -------------- group 2 -------------- 10.00 25.00 15.00 -------------- total group 2 50.00 ------------------- Total Group OVERALL 70.00 Using this formula sum({field.amount}, {field.group}) I only get sum for OVERALL but not for group 1 and 2. 回答1: Right Click field which you want to Sum Select Insert -> Summary and select Group On

Calculate metrics for multiple columns based on subsets defined by other columns

谁都会走 提交于 2019-12-11 08:58:39
问题 I would like to calculate simple summary metrics for subsets of certain columns in a data frame, where the subsets are based on information in other columns of the same data frame. Let me illustrate: colA <- c(NA,2,3,NA,NA,3,9,5,6,1) colB <- c(9,3,NA,2,2,4,6,1,9,9) colC <- c(NA,NA,5,7,3,9,8,1,2,3) colAA <- c(NA,NA,6,NA,NA,NA,1,7,9,4) colBB <- c(NA,2,NA,7,8,NA,2,7,9,4) colCC <- c(NA,NA,3,7,5,8,9,9,NA,3) df <- data.frame(colA,colB,colC,colAA,colBB,colCC) > df colA colB colC colAA colBB colCC 1

dplyr summarise Error in str.default(obj, …) dims [product 11] do not match the length of object [3]

微笑、不失礼 提交于 2019-12-11 06:04:45
问题 I am having a very frustrating problem using dplyr group_by and summarise functions. This is my dataset: > cum_ems_totals Source: local data frame [12 x 4] Chamber Total_emmissions Treatment Block <fctr> <dbl> <fctr> <fctr> 1 1 5769.0507 U 1 2 3 7790.1426 IU 1 3 4 5166.8992 AN 1 4 5 7625.7319 AN 2 5 6 1964.0970 IU 2 6 7 5052.1268 U 2 7 9 4207.5324 IU 3 8 10 470.7014 AN 3 9 12 5675.9171 U 3 10 14 5666.1678 U 4 11 15 2134.5002 AN 4 12 16 4093.4687 IU 4 > str(cum_ems_totals) Classes ‘tbl_df’,

R: combine summary of multiple csv files into one data frame

让人想犯罪 __ 提交于 2019-12-11 03:45:14
问题 I have a directory with many csv files. I want to read them into then create a summary of a column into one data frame. getSummary<-function(df){ summary(df$Names) } filenames<-list.files(path, pattern="*.csv", full.names=T) ldf<-lapply(filenames, read.csv, header=T) results<-lapply(ldf, getSummary) It is returning results as follows: print(results) [[1]] a b c d 100 2 3 4 [[2]] a b c d 97 4 2 6 What I want is something like this filename a b c d 1.csv 100 2 3 4 2.csv 97 4 2 6 Can someone