similar to: Obtaining midpoints of class intervals produced by cut and table

Displaying 20 results from an estimated 3000 matches similar to: "Obtaining midpoints of class intervals produced by cut and table"

2008 Aug 27
5
Integrate a 1-variable function with 1 parameter (Jose L. Romero)
Hey fellas: I would like to integrate the following function: integrand <- function (x,t) { exp(-2*t)*(2*t)^x/(10*factorial(x)) } with respect to the t variable, from 0 to 10. The variable x here works as a parameter: I would like to integrate the said function for each value of x in 0,1,..,44. I have tried Vectorize to no avail. Thanks in advance, jose romero
2009 Dec 01
2
Cut intervals (character) to numeric midpoint; regex problem
Starting with the head of a 499 element matrix whose column names are now the labels trom a cut() operation, I needed to get to a vector of midpoints to serve as the basis for plotting a calibration curve ( exp(linear predictor) vs. : > dput(head(dimnames(mtcal)[2][[1]])) # was starting point testvec <- c("(-8.616,-3.084]", "(-3.084,-2.876]",
2011 Sep 27
1
problem with switch function across R versions 2.10 and 2.13
Hello, The following piece of code works fine in R.2.10 (ubuntu): switch(distr,         normal    = {if (is.infinite(param["desv"]))                      n <- c(n,"La desv. estándar no puede ser Inf.")                    if (param["desv"]<0)                      n <- c(n,"La desv. estándar no puede ser <0.")                    },        
2010 Feb 12
3
summary statistics for grouped data
Hello list: Is there an easy way (preferably through one of the standard R packages) of obtaining summary statistics for grouped data? I could split the data into classes by hist, and then progressively calculate all the "columns" i need to obtain the mean and standard deviation, but i was looking for a single function that could do that with a data vector. Thanks in advance, jose
2008 Aug 15
1
Vectorization of duration of the game in the gambler ruin's problem
Hey fellas: In the context of the gambler's ruin problem, the following R code obtains the mean duration of the game, in turns: # total.capital is a constant, an arbitrary positive integer # initial.capital is a constant, an arbitrary positive integer between, and not including # 0 and total.capital # p is the probability of winning 1$ on each turn # 1-p is the probability of loosing 1$ # N
2009 Nov 25
1
Interpretation of plots in linear regression models (verification of Gauss-Markov hypothesis)
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20091125/3f0e364b/attachment-0001.pl>
2005 Nov 02
1
x/y coordinates of dendrogram branches
Dear R-users, I need some help concerning the plotting of dendrograms for hierarchical agglomerative clustering. The agglomeration niveau of each step should be displayed at the branches of the dendrogram. For this I need the x/y coordinates of the branch-agglomerations of the dendrogram. The y-values are known (the heights of the agglomeration), but how can I get the x-values? > mydata
2007 Mar 20
2
Problem adjusting x-labels with bargraphCI
Hello: I'm having quite a bit of difficulty adjusting the x-labels using bargraphCI. I've tried using text and srt=45 to rotate the labels or mtext for 2 lines to break up the labels. However, using either method, I cannot line up the labels with the midpoints of the bars (they line up with some sort of tick mark that is off the midpoint of the bars). Any suggestions would be greatly
2008 Jan 28
1
Grouping data via an index
Hello r-help, I have a lengthy vector of data (with values anywhere from 1-200), and another index vector of 'groups' representing values 0-2, 3-5, 6-8, ... of length 67. The index vector has the structure (1, 4, 7, ... , 196, 199), where each value is the midpoint of each respective group. I'm trying to convert the data vector such that values falling into each group are changed to
2012 Dec 02
1
Reading PDF files
I need to do text mining on PDF files. I understand there is a readPDF command in tm that can be used. Have read the 2008 posts on converting PDF files to text by Tony Breyal and others. Wondering if the procedure has been standardized in any tutorial or otherwise? Being new to R, I was able to follow only part of the discussion. Any way to get a set of step by step instructions
2010 Mar 19
1
Sweave and " object of type 'closure' is not subsettable" error
Hello folks: I have a data frame which includes two numeric vectors: "Pa1" and "Ingr" (which represents income).  I run the following code on the R console: ingreso <- factor(ifelse(Ingr<=3000,"bajo","alto")) tapply(Pa1,ingreso,summary) boxplot(Pa1~ingreso) and it works fine.  However, when I "Sweave" through an rnw file containing that
2012 May 23
3
applying cbind (or any function) across all components in a list
#If I have two lists as follows a1<- array(1:6, dim=c(2,3)) a2<- array(7:12, dim=c(2,3)) l1<- list(a1,a2) a3<- array(1:4, dim=c(2,2)) a4<- array(5:8, dim=c(2,2)) l2<- list(a3,a4) #how can I create a new list with the mean across all arrays within the list, so all components are included? As an example for [[1]]; cbind((l1[[1]][,1]+l2[[1]][,1])/2,
2010 Jul 23
1
Midpoint between coordinates
Dear R users, I need to find the coordinates for the point (midpoint) located half way between two pairs of coordinates (lon1,lat1 and lon2,lat2) assuming a straight line between them. What would be the best way? I tried to find an answer in the help archives but without success. I would greatly appreciate any help. df<- data.frame(lon1=c(-4.568,-4.3980), lat1=c(59.235,56.369),
1999 Nov 13
1
image()
May I raise the issue of the behaviour of image()? In image() dim(z) is supposed to be c(length(x), length(y)). This suggests that the user is supplying the midpoints of the rectangles. For all but the outer rectangles this is true. The outer rectangles, however, are only displayed in half width. So it is not possible to show correctly an image plot of equally-spaced abscissa. I would hazard
2011 Mar 16
6
Recursos sobre R en la red, Twitter, etc.
Hola, ¿qué tal? Hace unos meses anuncié en esta lista que había creado un agregador de noticias de R. Este agregador rastrea una serie de blogs, filtra aquellas entradas referentes a R, las agrega y: 1) Crea un RSS, que puede consultarse aquí: http://datanalytics.com/r_blogs_mashup.rss 2) Publica las entradas nuevas en Twitter bajo el usuario @noticiasSobreR. Están todas etiquetadas como
1999 Aug 26
1
error bars on barplots
Hello again I'm trying to put error bars onto a barplot. I've tried something that Bill Simpson suggested a while ago, ie: x<-c(1,2,3,4,5) y<-c(1.1, 2.3, 3.0, 3.9, 5.1) ucl<-c(1.3, 2.4, 3.5, 4.1, 5.3) lcl<-c(.9, 1.8, 2.7, 3.8, 5.0) plot(x,y, ylim=range(c(lcl,ucl))) arrows(x,ucl,x,lcl,length=.05,angle=90,code=3) #or segments(x,ucl,x,lcl) but I can't get it to work on a
2009 Jun 26
1
predicted values after fitting gamma2 function
Question: after fitting a gamma function to some data, how do I get predicted values? I'm a SAS programmer, I new R, and am having problems getting my brain to function with the concept of "object as class ...". The following is specifics of what I am doing: I'm trying to determine the pdf from data I have created in a simulation. I have generated frequency counts
2012 Jan 06
0
plots for residual analysis
Hello List: I'm writing in R some code to produce plots for residual analysis and diagnostics in linear regressions.  An example of the plots produced is given for downloading at http://dl.dropbox.com/u/25445316/res_plots.png .  Regarding the example plot, I'd like to point out that: 1) Tendency lines based on lowess estimations are drawn as green continuous curves, 2) "Extra"
2002 Aug 06
1
Questions about lexical scope
Dear R-users, The numerical integration example given in Gentleman and Ihaka (2000), "Lexical Scope and Statistical Computing," JCGS, 9, 491-508, is very interesting and helpful in understanding how lexical scope is about. However, I got some questions that I just can't figure out. First all, allow me to copy the two functions given by the authors: midpoint <- function(f, a,
2005 Aug 22
2
problem building dendrograms to use with heatmap()
Hi, I'm trying to build dendrograms to pass to heatmap(). The dendrograms I build plot properly, but when I pass them to heatmap() I get the error message "row dendrogram ordering gave index of wrong length" (see output log below). I looked in the code of heatmap() and saw that the error was due to a NULL return value from order.dendrogram(), which in turn got a NULL return value