similar to: getting the results of tapply into a single matrix

Displaying 20 results from an estimated 10000 matches similar to: "getting the results of tapply into a single matrix"

2009 Mar 30
2
ggplot2-geom_text()
Hi: I need help with geom_text(). I would like to count the number of Locations and put the sum of it right above each bar. x <- "Location Lake_dens Fish Pred Lake1 1.132 1 0.115 Lake1 0.627 1 0.148 Lake1 1.324 1 0.104 Lake1 1.265 1 0.107 Lake2 1.074 0 0.096 Lake2 0.851 0 0.108 Lake2 1.098 0 0.095 Lake2 0.418 0 0.135 Lake2 1.256 1 0.088 Lake2 0.554 1 0.126 Lake2 1.247 1 0.088
2018 May 22
0
Using tryCatch in a for loop
No. If your ouput is a numeric "matrix", it cannot include alpha. Columns in a data frame can be of different classes, but each column must be single class. and finally, of course, see ?cat -- I think you are misusing it. If you simply want to return "somestuff", your function should be: function(w) {"somestuff"} not function(w) {cat("somestuff")} As
2018 May 22
2
Using tryCatch in a for loop
Data and code as promised: #Creating a test dataset Year<- c(2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014) Lake1<- c(2, 4, 5, 2, 1, 1, 2, 3, 4, 5, 6, 2, 3, 1, 2) Lake2<- c(1, 3, -1, 4, -2, 1, 2, 3, 4, 5, 6, 2, 3, 1, 2) Lake3<- c(1, 2, 5, -3, 1, 1, 2, 3, 4, 5, 6, 2, 3, 1, 2) Lake4<- c(1, 1, 1, 1, 1, 1, 1, 250, 240, 240, 240, 240, 240, 239,
2018 May 22
0
Using tryCatch in a for loop
(practically) ALWAYS respond to the list. I have cc'ed them here. Others may (almost always do!) have greater insight/better answers than I. In this case, I have no clue, but presumably your call is wrong, but as I have no experience with the segmented.lm function, I don't care to track down how exactly. Your tryCatch call seems to be fine, however. -- Bert Bert Gunter "The
2018 May 22
0
Using tryCatch in a for loop
Others may have greater insight, but my response is: Exactly what did or didn't happen that makes you say the code didn't work? That is, what did or didn't you get when you ran it compared to your expectations? Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in
2018 May 22
3
Using tryCatch in a for loop
Hello All, I have been trying to use a for loop to run segmented regressions (from?R package segmented)?on many columns of data in a data frame with the end goal of writing a new file with the following columns: column title, breakpoint year, slope, and difference in slope. Unfortunately, when one of the columns doesn't have a breakpoint the code stops and provides?an error or warning. I
2018 May 22
0
Using tryCatch in a for loop
On 5/22/2018 11:32 AM, Bailey Hewitt wrote: > Hi Bert, > > Thank you for the quick response! > > In its current?state?the code?prints three lines that say "warning". What I was expecting is that I would?get?a matrix with 4 columns, 1. column names (from the original data, ex. Lake1) 2. breakpoint year 3. slope 4. slope difference from the first to the?second segment of
2018 May 22
4
Using tryCatch in a for loop
Hi Bert, Thank you for the quick response!? In its current?state?the code?prints three lines that say "warning". What I was expecting is that I would?get?a matrix with 4 columns, 1. column names (from the original data, ex. Lake1) 2. breakpoint year 3. slope 4. slope difference from the first to the?second segment of the segmented regression. Each row in the matrix would be the results
2011 Nov 18
1
cca with repeated measures
Dear all, How can I run a constrained correspondence analysis with the following data: 15 animals were measured repeatedly month-wise (over to 2 years) according to ther diet composition (8 food categories). our data.frame looks like this: food 1 2 ... 8 sex season year animal freq 12 8 ... 1 0 summer 2011 1 freq 0 7 ... 0 1 winter 2011 1 ... freq 0 7 ... 0 1 spring 2011 15 We
2009 Apr 01
0
回复: R-help Digest, Vol 73, Issue 32
Dear sir,    How to do bilinear time series in R?Is there any functions or packages?  thank you! -----Sincerely yours Kuangnan Fang 方匡南 敬上 department of statistics ,Economics school,Xia men University. Fujian Province (361005) China Mobile Phone:15860721915 SKYPE: ruiqwy MSN Messenger: ruiqwy@hotmail.com QQ:39863401 --- 09年3月31日,周二, r-help-request@r-project.org
2005 Feb 03
2
Surprising Behavior of 'tapply'
Dear all, I wanted to make a two-way-table of two variables with a counting variable stored in another column of a dataframe. In version 1.9.1, the behavior is as expected as shown in the simplified example code. > sex <- rep(c("F", "M"), 5) > income <- c(rep("low", 5), rep("high", 5)) > count <- 1:10 > mydf <-
2000 Mar 30
1
How do you go beyond tapply()?
"An Introduction to R" notes that the function tapply() can be used to index a vector by multiple categories. But they don't show how to do this. How does one implement, for example, the example in the text in which tax accountants are indexed by both state and sex? Is there a way to use tapply() to put the vector into bins defined by the levels instead of having to exactly match
2011 Feb 25
1
ANOVA and Pseudoreplication in R
Hi, As part of my dissertation, I'm going to be doing an Anova, comparing the "dead zone" diameters on plates of microbial growth with little paper disks "loaded" with antimicrobial, a clear zone appears where death occurs, the size depending on the strength and succeptibility. So it's basically 4 different treatments, and I'm comparing the diameters (in mm) of
2011 Feb 26
2
[R-sig-ME] Fwd: Re: ANOVA and Pseudoreplication in R
On 25/02/2011 21:22, Ben Ward wrote: > > -------- Original Message -------- > Subject: Re: [R] ANOVA and Pseudoreplication in R > Date: Fri, 25 Feb 2011 12:10:14 -0800 > From: Bert Gunter<gunter.berton at gene.com> > To: Ben Ward<benjamin.ward at bathspa.org> > CC: r-help<r-help at r-project.org> > > > > I can hopefully save bandwidth here by
2006 Dec 12
1
strings as factors
Hi, To be able to match cases with a benchmark I need to have a data.frame with a character id variable. however, I am surprised why this seems to be so hard. In fact I was unable to succeed. Here is what I tried: >test1 <-expand.grid(ID = 1:2, sex = c("male","female")) >is(test1[,2]) [1] "factor" "oldClass" >test2 <-expand.grid(ID =
2012 Dec 27
0
Suggestion: 'method' slot for expand.grid() (incl. diffs)
Dear expeRts, The order in which the variables vary in expand.grid() is often unintuitive. I would like to suggest a 'method' slot for expand.grid() which requires only very little changes (100% backward compatible) and which allows one to control this order. Please find attached diffs against R-devel. Cheers, Marius ### ./src/library/base/R/expand.grid.R
2007 Sep 02
2
NAs in indices
Hi All, I'm fiddling with an program to read a text file containing periods that SAS uses for missing values. I know that if I had the original SAS data set instead of a text file, R would handle this conversion for me. Data frames do not allow missing values in their indices but vectors do. Why is that? A search of the error message points out the problem and solution but not why they
2009 Apr 29
3
2 way ANOVA with possible pseudoreplication
Hi, I have an experiment with 2 independant factors which I have been trying to analyse in R. The problem is that there are several data points recorded on the same animal. However, no combination of treatments is repeated on the same animal. All possible combinations of treatments are done in a random order with as many points as possible being done on 1 animal before moving onto the next. The
2009 Dec 04
0
pseudoreplication - LME
Need some help please I am trying to use this model because I have temporal replication in my data results<-read.table(file=file.choose(),header=T) attach(results) names(results) results<-na.omit(results) library(nlme) library(lattice) results<-groupedData(weight~date|group,outer=~diet,results) plot(results) plot(results,outer=T) model<-lme(weight~diet,random=~date|group,results)
2010 Oct 04
0
glmer or not - glmer model specification
Hello, I'm having some trouble figuring out the correct model specification for my data. The system consists of multiple populations of an organism, which have been genetically sampled for several years. The problem is this: A minority of individuals are found in more than one sample, either they have survived into the next sampling at the same location, or have migrated to another another