[R] how to customize the CV function in Boosting?

2009-06-22 Thread Michael
Hi all, Is there a way to write my own error criteria function in the cross-validation part of the Boosting algorithm? I am talking about the GBM package. Of course, if you know other good Boosting implementation in R, please give me some pointers! I am looking for a good classifier (not neccessa

Re: [R] rbind

2009-06-22 Thread Patrick Burns
I'm guessing that your 'data' and 'data1' are just vectors so your 'rbind' command returns a 2 by 3 matrix. Jim showed you already that: rbind(as.matrix(data), as.matrix(data1)) will probably get you what you are looking for. However, I'm suspicious that just: c(data, data1) will serve you j

Re: [R] Error when using step

2009-06-22 Thread Dieter Menne
Chris Friedl gmail.com> writes: > I have two questions about the built-in function step. Ultimately I want to > apply a lm fitting and subsequent step procedure to thousands of data sets > groups by a factor defined as a unique ID. > > Q1. The code below creates a data.frame comprising three mar

Re: [R] rbind

2009-06-22 Thread Patrick Burns
Now that I've actually read the question, I'm in a better position to answer it. I have no idea how you are getting the results that you show, but you can use 'rownames' to set whatever row names you like. As in: rownames(result) <- 1:6 Pat Patrick Burns wrote: I'm guessing that your 'data'

[R] Convert NA to '.'

2009-06-22 Thread David_D
Dear R-users, For reporting purpose (using Sweave and LaTeX), I am creating complex tables with the cat function such as > x<-c("A", "B", "C", NA) > cat(x, '\n') A B C NA For convenience, I would like to change all my NA value to something else like '.' (as in SAS for example). Is there a globa

Re: [R] help with installation of local gzip-ped packages

2009-06-22 Thread Uwe Ligges
mau...@alice.it wrote: I was suggested to install two tar-red and gzip-ped packages that are not part of CRAN or BioConductors yet. I read the R manual about Administration and could only find a good description of how to install packages not canonically included in CRAN repository, on UNIX s

[R] coloring agnes plots

2009-06-22 Thread Raymond Wan
Hi all, I am creating dendrograms using agnes and was wondering if it is possible to add color to the leaves (and just the leaves). For example, in the documentation, they have an example using the "votes.repub" data set. If I wanted to make the word "Washington" green (and only Washington

Re: [R] filtering number of values in a data frame

2009-06-22 Thread René Schönemann
This does exactly what is needed. Thanks guys! -Original Message- From: markle...@verizon.net [mailto:markle...@verizon.net] Sent: Thursday, June 18, 2009 5:30 PM To: rene.schoenem...@tu-berlin.de Subject: Re: [R] filtering number of values in a data frame do.call(rbind,lapply(un

Re: [R] Need help to optimize a piece of code involving zoo objects

2009-06-22 Thread Sergey Goriatchev
Hi, everybody OK, I got it working with "recursive". Don't know why this argument slipped my mind, as I use filter() so often! Now it is 44 times faster, which is good enough for me. :-) Thank you, Gabor and Jim. Best, Sergey On Fri, Jun 19, 2009 at 15:23, jim holtman wrote: > check out 'filter

Re: [R] png() resolution problem {was "Silhouette ..."}

2009-06-22 Thread Uwe Ligges
Martin Maechler wrote: Hallo Sebastian, "SP" == Sebastian Pölsterl on Sun, 14 Jun 2009 14:04:52 +0200 writes: SP> Hello Martin, SP> I plotting the silhouette of a clustering and storing it as png. When I SP> try to store the image as png the bars are missing. The bars are

[R] Help using substitute and expression functions

2009-06-22 Thread Patrick Connolly
I'm stopped at a browser in a loop where the following objects look like this: Browse[1]> jk [1] 1 Browse[1]> leg.ab[jk] [1] "Snails Rep1" Browse[1]> top.k [1] "LT95=7.5; LT99=8.8" I can join them and a few other characters together like this easily enough: Browse[1]> paste(jk, ": ", leg.ab[jk],

[R] Help on creating a sequence of vectors

2009-06-22 Thread megh
I want to create a number of vectors like : vec1 <- rnorm(1) vec2 <- rnorm(2) vec3 <- rnorm(3) and so on... Here I tried following : for (i in 1:10) paste("vec", i, sep="") <- rnorm(i) However obviously that is not working. Here vectors I need to be seperated i.e I do not want to cre

Re: [R] Help on creating a sequence of vectors

2009-06-22 Thread Nikos Alexandris
megh: > I want to create a number of vectors like : > > vec1 <- rnorm(1) > vec2 <- rnorm(2) > vec3 <- rnorm(3) > > and so on... Maybe try the assign() function. Something like: for (i in 1:10) assign ( paste ( "vec" , i , sep = "" ) , rnorm(i) ) Kind regards, Nikos

Re: [R] Customize axis labels in xyplot

2009-06-22 Thread nmset
I have attached 2 files sample.csv and sample.r to illustrate the problem. Thank you for considering. -- View this message in context: http://www.nabble.com/Customize-axis-labels-in-xyplot-tp24126788p24143742.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] xyplot: subscripts, groups and subset

2009-06-22 Thread Auty, Dave
Hi, I'm running the following code to produce lattice plots of microfibril angle versus ring number in Scots pine. There are 12 trees and 5 sample positions ("Position") in each tree: xyplot(MFA ~ RN | Tree, data = MFA.data, groups = Position, subscripts=TRUE, auto.key=list

[R] New line operator in mtext

2009-06-22 Thread Steve Murray
Dear R Users, I'm finding that when I execute the following bit of code, that the new line argument is actually displayed as text in the graphics device. How do I avoid this happening? mtext(side=2, line=5.5, expression(paste("Monthly Summed Runoff (mm/month)", "/n", "and Summed Monthly Preci

[R] QQplots of probability vector data

2009-06-22 Thread bioinformatics_guy
I'm trying to determine if a set of data is normal from a qq plot but seem to be having a bit of difficulty. I have a file of the following form 9 36 3 37 6 38 7 39 . where the left column is the frequency of the number in the right column. I've found the prob

Re: [R] New line operator in mtext

2009-06-22 Thread Uwe Ligges
Steve Murray wrote: Dear R Users, I'm finding that when I execute the following bit of code, that the new line argument is actually displayed as text in the graphics device. How do I avoid this happening? mtext(side=2, line=5.5, expression(paste("Monthly Summed Runoff (mm/month)", "/n", "an

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-22 Thread Petr PIKAL
Hi jim holtman napsal dne 19.06.2009 15:06:55: > I have wondered about this way of testing for equality: > > > x <- c(1,0,3,0) > > x[1] * length(x) == sum(x) > [1] TRUE > > x <- rep(1,4) > > x[1] * length(x) == sum(x) > [1] TRUE > This would seem to indicate that both vectors contain the same

Re: [R] New line operator in mtext

2009-06-22 Thread Steve Murray
Thanks for the response, however, whilst this eliminates the 'new line' character from appearing, it doesn't actually cause a new line to be printed! Instead, I have the last few characters of the first character string overlapping with the first few characters of the next. How best should I c

Re: [R] Help on creating a sequence of vectors

2009-06-22 Thread jim holtman
Consider the use of a 'list' so you don't clutter up the global enviroment with a lot of objects that you might forget about: > vec <- lapply(1:10, rnorm) > vec [[1]] [1] -0.6264538 [[2]] [1] 0.1836433 -0.8356286 [[3]] [1] 1.5952808 0.3295078 -0.8204684 [[4]] [1] 0.4874291 0.7383247 0.575781

Re: [R] Roxygen vs Sweave for S4 documentation

2009-06-22 Thread Martin Maechler
> "TobiasV" == Tobias Verbeke > on Sun, 21 Jun 2009 08:25:07 +0200 writes: TobiasV> Hi Ken, >> I have been using R for a while. Recently, I have begun converting my >> package into S4 classes. I was previously using Rdoc for documentation. >> Now, I am looking to us

Re: [R] Roxygen vs Sweave for S4 documentation

2009-06-22 Thread Douglas Bates
On Mon, Jun 22, 2009 at 7:12 AM, Martin Maechler wrote: >> "TobiasV" == Tobias Verbeke >>     on Sun, 21 Jun 2009 08:25:07 +0200 writes: > >    TobiasV> Hi Ken, >    >> I have been using R for a while.  Recently, I have begun converting my >    >> package into S4 classes.  I was previously

[R] What has happened to the R-Help Google Groups Archive? Alternative?

2009-06-22 Thread Tony Breyal
Greetings, I usually read this mailing list through google groups (http://groups.google.com/group/r-help-archive), but when I opened the webpage this morning it said: "The group named r-help-archive has been removed because it violated Google's Terms Of Service." Is there an alternative website w

Re: [R] New line operator in mtext

2009-06-22 Thread Duncan Murdoch
On 6/22/2009 7:58 AM, Steve Murray wrote: Thanks for the response, however, whilst this eliminates the 'new line' character from appearing, it doesn't actually cause a new line to be printed! Instead, I have the last few characters of the first character string overlapping with the first few c

Re: [R] What has happened to the R-Help Google Groups Archive? Alternative?

2009-06-22 Thread Duncan Murdoch
On 6/22/2009 7:23 AM, Tony Breyal wrote: Greetings, I usually read this mailing list through google groups (http://groups.google.com/group/r-help-archive), but when I opened the webpage this morning it said: "The group named r-help-archive has been removed because it violated Google's Terms Of S

Re: [R] Convert NA to '.'

2009-06-22 Thread Jorge Ivan Velez
Dear David, Try this: x <- c("A", "B", "C", NA) x[is.na(x)] <- "." x HTH, Jorge On Mon, Jun 22, 2009 at 2:11 AM, David_D wrote: > > Dear R-users, > > For reporting purpose (using Sweave and LaTeX), I am creating complex > tables > with the cat function such as > > > x<-c("A", "B", "C", NA) >

[R] How to make try to catch warnings in logistic glm

2009-06-22 Thread Fredrik Nilsson
Dear list, >From an earlier post I got the impression that one could promote warnings from a glm to errors (presumably by putting options(warn=1)?), then try() would flag them as errors. I’ve spent half the day trying to do this, but no luck. Do you have an explicit solution? My problems is that

Re: [R] xyplot: subscripts, groups and subset

2009-06-22 Thread Dieter Menne
Auty, Dave forestry.gsi.gov.uk> writes: > > I'm running the following code to produce lattice plots of microfibril > angle versus ring number in Scots pine. There are 12 trees and 5 sample > positions ("Position") in each tree: > > xyplot(MFA ~ RN | Tree, data = MFA.data, > >groups =

Re: [R] Roxygen vs Sweave for S4 documentation

2009-06-22 Thread Tobias Verbeke
On Mon, Jun 22, 2009 at 2:18 PM, Douglas Bates wrote: > On Mon, Jun 22, 2009 at 7:12 AM, Martin > Maechler wrote: >>> "TobiasV" == Tobias Verbeke >>>     on Sun, 21 Jun 2009 08:25:07 +0200 writes: >> >>    TobiasV> Hi Ken, >>    >> I have been using R for a while.  Recently, I have begun c

Re: [R] How to make try to catch warnings in logistic glm

2009-06-22 Thread Dieter Menne
Fredrik Nilsson-5 wrote: > >>From an earlier post I got the impression that one could promote > warnings from a glm to errors (presumably by putting > options(warn=1)?), then try() would flag them as errors. I’ve spent > half the day trying to do this, but no luck. Do you have an explicit > sol

[R] Lattice group colors?

2009-06-22 Thread Fredrik Karlsson
Dear list, I have been struggling to find how I would go about changing the bakground colors of groups in a lattice barchart in a way so that the auto.key generated also does the right thing and pick it up for the key. I have used the "col" argument (which I guess is sent to par()) in a way so tha

Re: [R] Lattice group colors?

2009-06-22 Thread Sundar Dorai-Raj
Look at show.settings() and str(trellis.par.get()). This will show you what the default settings are. The group colors are set by the superpose.* elements (e.g. superpose.line is for group lines). To set them, I usually create a list and pass it to par.settings. For example, my.theme <- list(super

[R] The gradient of a multivariate normal density with respect to its parameters

2009-06-22 Thread Karl Ove Hufthammer
Does anybody know of a function that implements the derivative (gradient) of the multivariate normal density with respect to the *parameters*? It’s easy enough to implement myself, but I’d like to avoid reinventing the wheel (with some bugs) if possible. Here’s a simple example of the result I’

[R] Eigen value calculation

2009-06-22 Thread RON70
Hi all, Eigen vectors obtained from the function eigen() are ortho-normal? I see the documentation however there is no formal mention on that. If no, then is there any direct function to do the same? -- View this message in context: http://www.nabble.com/Eigen-value-calculation-tp24147807p241478

Re: [R] problem with checking wether file is present or not

2009-06-22 Thread Don MacQueen
What error is it giving? Please include the exact error. What happens if you do this: if (file.exists(findings)) cat('File',findings,'exists\n') else cat('File',findings,not found\n') Your description suggests that you are using 'if' expression inside a loop. If that is the case, try i

Re: [R] New line operator in mtext

2009-06-22 Thread Steve Murray
Thanks again for a very useful comment. That seems to have separated the text and put it onto separate lines. However, whilst this results in the text being centralised in relation to the axis, it means that the lower line is left-justified in relation to the upper line, rather than being cent

Re: [R] The gradient of a multivariate normal density with respect to its parameters

2009-06-22 Thread Ravi Varadhan
Hi Karl, I am not aware of any. May I ask what your purpose is? You don't really need this if you are going to use it in optimization, since most optimizers use a simple finite-difference approximation if you don't provide the gradient. Using the numerical approximation from "numDeriv" will be

Re: [R] Error when using step

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 4:08 AM, Dieter Menne wrote: Chris Friedl gmail.com> writes: I have two questions about the built-in function step. Ultimately I want to apply a lm fitting and subsequent step procedure to thousands of data sets groups by a factor defined as a unique ID. Q1. The code

Re: [R] New line operator in mtext

2009-06-22 Thread Duncan Murdoch
On 6/22/2009 10:30 AM, Steve Murray wrote: Thanks again for a very useful comment. That seems to have separated the text and put it onto separate lines. However, whilst this results in the text being centralised in relation to the axis, it means that the lower line is left-justified in relatio

[R] GAM function with interaction

2009-06-22 Thread Paul Simonin
Hello R Users, I have a question regarding fitting a model with GAM{mgcv}. I have data from several predictor (X) variables I wish to use to develop a model to predict one Y variable. I am working with ecological data, so have data collected many times (about 20) over the course of two years. P

[R] what's the R command to make the following?

2009-06-22 Thread Jack Luo
Hi, I have a simple question, suppose I have the date "05/16/2008", what would be the command to get the month, day and year? Thanks, -Jack [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

Re: [R] what's the R command to make the following?

2009-06-22 Thread jim holtman
Couple of choices depending on what you want to do with the data: > x <- as.POSIXct("05/16/2008", format="%m/%d/%Y") # if you want to use the date > format(x, "%d") # day [1] "16" > format(x, "%m") # month [1] "05" > format(x, "%Y") # year [1] "2008" > # or > y <- strsplit("05/16/2008", '/') # t

[R] standard error and p-value for the estimated parameter in AR model

2009-06-22 Thread FMH
Dear All, I used an  AR(1) model to explain the process of the stationary residual and have used an 'ar' command in R. From the results, i tried to extract the standard error and p-value for the estimated parameter, but unfortunately, i never find any way to extract  it from the output. What

[R] Fwd: question about using _apply and/or aggregate functions

2009-06-22 Thread Clifford Long
Resending, as am not sure about the original "To:" address. Sorry for any redundancy. - Cliff -- Forwarded message -- From: Clifford Long Date: Mon, Jun 22, 2009 at 11:04 AM Subject: question about using _apply and/or aggregate functions To: r-h...@lists.r-project.org Hi R-lis

Re: [R] question about using _apply and/or aggregate functions

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 12:04 PM, Clifford Long wrote: Hi R-list, I'll apologize in advance for (1) the wordiness of my note (not sure how to avoid it) and (2) any deficiencies on my part that lead to my difficulties. I have an application with several stages that is meant to simulate and explore

Re: [R] Roxygen vs Sweave for S4 documentation

2009-06-22 Thread Duncan Murdoch
On 6/22/2009 9:23 AM, Tobias Verbeke wrote: On Mon, Jun 22, 2009 at 2:18 PM, Douglas Bates wrote: On Mon, Jun 22, 2009 at 7:12 AM, Martin Maechler wrote: "TobiasV" == Tobias Verbeke on Sun, 21 Jun 2009 08:25:07 +0200 writes: TobiasV> Hi Ken, >> I have been using R for a while. Rec

Re: [R] Convert NA to '.'

2009-06-22 Thread David_D
Jorge, Thanks a lot for your reply. It's indeed working in this case. However, with data frames mixing numeric and character is not working anymore. Morever I am working with many variables and I don't want to modify them. What I would really appreciate is a global option (in the Rprofile?) that

Re: [R] The gradient of a multivariate normal density with respect to its parameters

2009-06-22 Thread Karl Ove Hufthammer
Ravi Varadhan skreiv: I am not aware of any. May I ask what your purpose is? You don't really need this if you are going to use it in optimization, since most optimizers use a simple finite-difference approximation if you don't provide the gradient. Using the numerical approximation from "numD

[R] Help needed: Fraction for Histogram > 1 ???

2009-06-22 Thread charles78
I have been trying to draw histogram for my manscript and found some strange things that I could not figure out why. Using the same code listed below I have successfully draw histograms for a few figures with fraction labeled on Y axis less than 1 (acturally between 0 to 0.1). But one dataset gi

Re: [R] Roxygen vs Sweave for S4 documentation

2009-06-22 Thread Martin Maechler
> "DM" == Duncan Murdoch > on Mon, 22 Jun 2009 09:41:12 -0400 writes: DM> On 6/22/2009 9:23 AM, Tobias Verbeke wrote: >> On Mon, Jun 22, 2009 at 2:18 PM, Douglas Bates wrote: >>> On Mon, Jun 22, 2009 at 7:12 AM, Martin >>> Maechler wrote: > "TobiasV" == To

Re: [R] what's the R command to make the following?

2009-06-22 Thread Gabor Grothendieck
There are many ways to do this in R. See R News 4/1 for info on dates. Here is one method: > library(chron) > mdy <- month.day.year("05/16/2008") > mdy $month [1] 5 $day [1] 16 $year [1] 2008 > mdy$month [1] 5 On Mon, Jun 22, 2009 at 11:36 AM, Jack Luo wrote: > Hi, > > I have a simple questi

Re: [R] The gradient of a multivariate normal density with respect toits parameters

2009-06-22 Thread Ravi Varadhan
Karl, You may want to look at the paper by Dwyer on "Some applications of matrix derivatives in multivariate analysis" (JASA 1967), especially the Table 2 on p. 617. Ravi. --- Ravi Varadhan, Ph.D. Assistant Profe

[R] Problems trying to run R2jags on a Linux Cluster

2009-06-22 Thread Luwis Tapiwa Diya
Dear R users, I am having problems in trying to run R2jags on a Linux Cluster. When I tried to run the model given in the R2jags manual I get the following error error message: Error in FUN(X[[3L]], ...) : object 'J' not found Can any one help me with this problem? Looking to hear from you all.

[R] User defined GLM?

2009-06-22 Thread francogrex
Hello, I have this generalized linear formula: log(x[i]/n[i])=log(sum(x)/sum(n)) + beta[i] where the the x[i] and the n[i] are known. Is there a way to program the GLM procedure to input the formula above and get the beta[i] estimates? If not the GLM is there another procedure to do that? The aim

Re: [R] Help needed: Fraction for Histogram > 1 ???

2009-06-22 Thread Greg Snow
When freq=FALSE then the y axis is not the proportion in each group (what I am assuming you mean by fraction), but rather is scaled so that the total area of the histogram is 1 (making comparing to theoretical densities easier). If all the data values are between 0 and 1, then the height of at

Re: [R] Convert NA to '.'

2009-06-22 Thread Jorge Ivan Velez
Hi David, It works for me when handling data frames mixing characters and numeric by using either print() or a function called "foo": # Some data x <- c("A", "B", "C", 3.5, 1, 0, NA, "a character",NA, "another character") mydata <- data.frame(x = x, y = sample(x)) mydata # Option 1: print()ing pr

Re: [R] Convert NA to '.'

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 1:21 PM, Jorge Ivan Velez wrote: Hi David, It works for me when handling data frames mixing characters and numeric by using either print() or a function called "foo": # Some data x <- c("A", "B", "C", 3.5, 1, 0, NA, "a character",NA, "another character") mydata <- dat

Re: [R] User defined GLM?

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 12:35 PM, francogrex wrote: Hello, I have this generalized linear formula: log(x[i]/n[i])=log(sum(x)/sum(n)) + beta[i] where the the x[i] and the n[i] are known. Is there a way to program the GLM procedure to input the formula above and get the beta[i] estimates? If not t

[R] SAS-like method of recoding variables?

2009-06-22 Thread Mark Na
Dear R-helpers, I am helping a SAS user run some analyses in R that she cannot do in SAS and she is complaining about R's peculiar (to her!) way of recoding variables. In particular, she is wondering if there is an R package that allows this kind of SAS recoding: IF TYPE='TRUCK' and count=12 THEN

[R] Problem with storing a sequence of lmer() model fit into a list

2009-06-22 Thread Sean Zhang
Dear R-helpers: May I ask a question related to storing a number of lmer model fit into a list. Basically, I have a for-loop (see towards the bottom of this email) in the loop, I am very sure that the i-th model fit (i.e.,fit_i) is successfully generated and the character string (i.e., tmp_i) is c

Re: [R] SAS-like method of recoding variables?

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 2:27 PM, Mark Na wrote: Dear R-helpers, I am helping a SAS user run some analyses in R that she cannot do in SAS and she is complaining about R's peculiar (to her!) way of recoding variables. In particular, she is wondering if there is an R package that allows this kind of

Re: [R] SAS-like method of recoding variables?

2009-06-22 Thread Chuck Cleland
On 6/22/2009 2:27 PM, Mark Na wrote: > Dear R-helpers, > > I am helping a SAS user run some analyses in R that she cannot do in > SAS and she is complaining about R's peculiar (to her!) way of > recoding variables. In particular, she is wondering if there is an R > package that allows this kind of

Re: [R] SAS-like method of recoding variables?

2009-06-22 Thread Peter Dalgaard
Mark Na wrote: Dear R-helpers, I am helping a SAS user run some analyses in R that she cannot do in SAS and she is complaining about R's peculiar (to her!) way of recoding variables. In particular, she is wondering if there is an R package that allows this kind of SAS recoding: IF TYPE='TRUCK'

Re: [R] User defined GLM?

2009-06-22 Thread Emmanuel Charpentier
Le lundi 22 juin 2009 à 09:35 -0700, francogrex a écrit : > Hello, I have this generalized linear formula: > log(x[i]/n[i])=log(sum(x)/sum(n)) + beta[i] I do not understand the problem as stated. if x[i] and n[i] are known, and unless sum(n)=0, your dataset reduces to a set of nrow(dataset) indepe

Re: [R] What has happened to the R-Help Google Groups Archive? Alternative?

2009-06-22 Thread David M Smith
Gmane has already been mentioned, and you might also want to consider Nabble -- judging from my referrer logs many people use it to read r-help. If you use Gmail, you might also want to consider subscribing to the list and using a simple filter. Details and links at blog.revolution-computing.com, h

[R] Shapiro.test on data frame

2009-06-22 Thread Gonzalo Quiroga
Hi, I need help to perform a Shapiro.test on a data frame, I know that this test works only with vector but I guess there most be a way to permor it on a data frame instead of vactor by vector (i.e. I've got 40 variables to analyze and its kinda annoying to do it one by one) Thanks to anyone that

[R] maps maptools

2009-06-22 Thread John Lipkins
Hey, A basic question. Is there anyone that knows a good text on using the R packages map and maptools for R? I have read the references for both but having trouble getting started. What I want to do is to load a map (.shp file) and display statistics on this maps using colours. Thanks in advanc

Re: [R] User defined GLM?

2009-06-22 Thread francogrex
Emmanuel Charpentier wrote: > > I do not understand the problem as stated. if x[i] and n[i] are known, > and unless sum(n)=0, your dataset reduces to a set of nrow(dataset) > independent linear equations with nrow(dataset) unknowns (the beta[i]), > whose solution is trivially beta[i]=log(x[i]/n[

Re: [R] Help needed: Fraction for Histogram > 1 ???

2009-06-22 Thread charles78
It is not the case as you described. In any case, the total area should be 1 and labeled fraction on y axis should be far less than 1, since I have more than 1 data points. I also test differerent bin size by change the break. I draw the graph using only 1 group, the same result was obtaine

Re: [R] Shapiro.test on data frame

2009-06-22 Thread Henrique Dallazuanna
Try this: x <- data.frame(A = runif(10), B = rnorm(10)) lapply(x, shapiro.test) On Mon, Jun 22, 2009 at 3:15 PM, Gonzalo Quiroga wrote: > Hi, I need help to perform a Shapiro.test on a data frame, I know that > this test works only with vector but I guess there most be a way to > permor it on a

Re: [R] Problem with storing a sequence of lmer() model fit into a list

2009-06-22 Thread Rolf Turner
(a) Your code is unnecessarily convoluted. (b) The example of things *not* working is not reproducible. (Read the posting guide!!!) (c) Nonetheless the phenomenon you describe is weird/interesting. On my system, the following runs without error: fit.list <- NULL a <- factor(rep(1:10,each=

Re: [R] Shapiro.test on data frame

2009-06-22 Thread Dylan Beaudette
On Monday 22 June 2009, Gonzalo Quiroga wrote: > Hi, I need help to perform a Shapiro.test on a data frame, I know that > this test works only with vector but I guess there most be a way to > permor it on a data frame instead of vactor by vector (i.e. I've got 40 > variables to analyze and its kind

Re: [R] Help needed: Fraction for Histogram > 1 ???

2009-06-22 Thread Thomas Lumley
On Mon, 22 Jun 2009, charles78 wrote: It is not the case as you described. In any case, the total area should be 1 and labeled fraction on y axis should be far less than 1, since I have more than 1 data points. I also test differerent bin size by change the break. Try reading Greg's res

[R] nls vs nlme: parameter constraints

2009-06-22 Thread Manuel Morales
Hello list, I'm trying to fit a model like beta[trt]/(1+alpha*x) where the data include some grouping factor. The problem is that the estimate for alpha is undefined for some of the treatments - any value greater than 20 is equally good and a step function would suffice. Ignoring the grouping stru

Re: [R] maps maptools

2009-06-22 Thread Kingsford Jones
Hi John, The SIDS examples in the spatial graphics gallery may be helpful: http://r-spatial.sourceforge.net/gallery/ For a general reference, see Applied Spatial Data Analysis with R. Note that the book's webpage includes figures with code http://www.asdar-book.org/ There's also the spatial Ta

[R] question about using _apply and/or aggregate functions

2009-06-22 Thread Clifford Long
Hi R-list, I'll apologize in advance for (1) the wordiness of my note (not sure how to avoid it) and (2) any deficiencies on my part that lead to my difficulties. I have an application with several stages that is meant to simulate and explore different scenarios with respect to product sales (in

Re: [R] question about using _apply and/or aggregate functions

2009-06-22 Thread Clifford Long
Hi David, I appreciate the advice. I had coerced 'list4' to as.list, but forgot to specify "list=()" in the call to aggregate. I made the correction, and now get the following: > slope.mult = simarray[,1] > adj.slope.value = simarray[,2] > adj.slope.level = simarray[,2] > qc.run.violation = sim

[R] Calculating "row standard deviations"

2009-06-22 Thread Mark Na
Hi R-helpers, I have been struggling with calculating row and column statistics, e.g. standard deviation. I know that > datac$Mean<-rowMeans(datac,na.rm=TRUE) will give me row means. I have tried to replicate those row means with the apply function: > datac$Mean2<-apply(datac,2,mean) so that I

Re: [R] lattice logaritmic scale (basis "e" ), rewriting labels using xscale.component

2009-06-22 Thread Katharina May
thanks Deepayan, that works great! 2009/6/19 Deepayan Sarkar : > On 6/18/09, Katharina May wrote: >> Hi there, >> >>  sorry for troubling everybody once again, I've got a problem rewriting >>  Sarkar's function for >>  rewriting the tick locations in a logaritmic way (s. >>  http://lmdvr.r-forge

Re: [R] Calculating "row standard deviations"

2009-06-22 Thread Peter Alspach
Tena koe Mark I think you might want apply(datac, 1, mean) i.e., apply the function to the first dimension (rows) rather than the second (columns). HTH ... Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Ma

Re: [R] Calculating "row standard deviations"

2009-06-22 Thread Peter Dalgaard
Mark Na wrote: Hi R-helpers, I have been struggling with calculating row and column statistics, e.g. standard deviation. I know that datac$Mean<-rowMeans(datac,na.rm=TRUE) will give me row means. I have tried to replicate those row means with the apply function: datac$Mean2<-apply(datac,2,m

[R] easiest way to extend and recompile a package?

2009-06-22 Thread Michael
Hi all, I am thinking of extending a package by directly adding stuff to its C++ code. And then I have to recompile the package. Do I have to download the whole R source repository, in order to do the recompilation? What is the minimal setup requirement for such a recompilation? I am using MSVC

Re: [R] Recursive partitioning algorithms in R vs. alia

2009-06-22 Thread jude.ryan
I have used all 3 packages for decision trees (SAS/EM, CART and R). As another user on the list commented, the algorithms CART uses are proprietary. I also know that since the algorithms are proprietary, the decision tree that you get from SAS is based on a "slightly different" algorithm so as to n

[R] reading data in rjags

2009-06-22 Thread David Cross
I am trying to run jags.model and need the data read in a suitable format. The package (rjags) documentation describes "read.data", while the "classic-bugs" examples use "read.jagsdata". I am running R (R 2.8.1) on a PowerBook G4 (Mac OS X 10.5.7), and my installation recognizes neither read

[R] Convert "ragged" list to matrix

2009-06-22 Thread Kenneth Takagi
Hi, I have a list made up of character strings with each item a different length (each item is between 1and 6 strings long). Is there a way to convert a "ragged" list to a matrix such that each item is its own row? Here is a simple example: a=list(); a[[1]] = c("a", "b", "c"); a[[2]] = c

Re: [R] Convert "ragged" list to matrix

2009-06-22 Thread jim holtman
try this: > a [[1]] [1] "a" "b" "c" [[2]] [1] "d" "e" [[3]] [1] "f" "g" "h" "i" > # find max row length > rowMax <- max(sapply(a, length)) > # now create output matrix by lengthening rows > do.call(rbind, lapply(a, function(x){ + length(x) <- rowMax + x + })) [,1] [,2] [,3] [,4] [1,]

Re: [R] Convert "ragged" list to matrix

2009-06-22 Thread Henrique Dallazuanna
Try this: matrix(unlist(lapply(a, '[', 1:max(sapply(a, length, ncol = 4, byrow = TRUE) or do.call(rbind, lapply(a, '[', 1:max(sapply(a, length On Mon, Jun 22, 2009 at 8:15 PM, Kenneth Takagi wrote: > Hi, > > > > I have a list made up of character strings with each item a different >

Re: [R] Convert "ragged" list to matrix

2009-06-22 Thread Kenneth Takagi
Thanks for all the feedback; I found a previous post covering this question: https://stat.ethz.ch/pipermail/r-help/2009-February/189232.html Problem solved! Kenneth Takagi kat...@psu.edu From: jim holtman [mailto:jholt...@gmail.com] Sent: Monda

Re: [R] Convert "ragged" list to matrix

2009-06-22 Thread Gabor Grothendieck
Try this: > unname(t(do.call(cbind, lapply(a, ts [,1] [,2] [,3] [,4] [1,] "a" "b" "c" NA [2,] "d" "e" NA NA [3,] "f" "g" "h" "i" On Mon, Jun 22, 2009 at 7:15 PM, Kenneth Takagi wrote: > Hi, > > > > I have a list made up of character strings with each item a different > length

Re: [R] question about using _apply and/or aggregate functions

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 6:16 PM, Clifford Long wrote: Hi David, I appreciate the advice. I had coerced 'list4' to as.list, but forgot to specify "list=()" in the call to aggregate. I made the correction, and now get the following: slope.mult = simarray[,1] adj.slope.value = simarray[,2] adj.sl

Re: [R] Calculating "row standard deviations"

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 6:19 PM, Mark Na wrote: Hi R-helpers, I have been struggling with calculating row and column statistics, e.g. standard deviation. I know that datac$Mean<-rowMeans(datac,na.rm=TRUE) will give me row means. I have tried to replicate those row means with the apply function

[R] Automatically Adding Categories

2009-06-22 Thread Jeffrey Edgington
Greetings, I have two files which contain responses to a series of multiple choice questions. One file contains responses before an "intervention" and the other contains the responses afterward. There were three possible responses to each question: D, F, T (for Don't Know, False, and Tru

Re: [R] question about using _apply and/or aggregate functions

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 7:55 PM, David Winsemius wrote: On Jun 22, 2009, at 6:16 PM, Clifford Long wrote: Hi David, I appreciate the advice. I had coerced 'list4' to as.list, but forgot to specify "list=()" in the call to aggregate. I made the correction, and now get the following: slo

Re: [R] Automatically Adding Categories

2009-06-22 Thread Henrique Dallazuanna
Try this: table(factor(pre, levels = c("D", "F", "T")), factor(post, levels = c("D", "F", "T"))) On Mon, Jun 22, 2009 at 8:56 PM, Jeffrey Edgington wrote: > Greetings, > > I have two files which contain responses to a series of multiple choice > questions. One > file contains responses

Re: [R] Automatically Adding Categories

2009-06-22 Thread David Winsemius
On Jun 22, 2009, at 7:56 PM, Jeffrey Edgington wrote: Greetings, I have two files which contain responses to a series of multiple choice questions. One file contains responses before an "intervention" and the other contains the responses afterward. There were three possible responses to

Re: [R] easiest way to extend and recompile a package?

2009-06-22 Thread Duncan Murdoch
On 22/06/2009 6:52 PM, Michael wrote: Hi all, I am thinking of extending a package by directly adding stuff to its C++ code. And then I have to recompile the package. Do I have to download the whole R source repository, in order to do the recompilation? What is the minimal setup requirement for

[R] subset POSIXct

2009-06-22 Thread Keith Jones
Hi, I have a data frame with two columns: dt and tf. The dt column is datetime and the tf column is a temperature. dt tf 1 2009-06-20 00:53:00 73 2 2009-06-20 01:08:00 73 3 2009-06-20 01:44:00 72 4 2009-06-20 01:53:00 71 5 2009-06-20 02:07:00 72 ... I need a

[R] p-values for ARIMA coefficients

2009-06-22 Thread m . gharbi
Hi, I'm a beginner using R and I'm modeling a time series with ARIMA. I'm looking for a way to determine the p-values of the coefficients of my model. Does ARIMA function return these values? or is there a way to determine them easily? Thanks for your answer Myriam

Re: [R] subset POSIXct

2009-06-22 Thread Henrique Dallazuanna
Convert dt to POSIXct class: wtd$dt <- as.POSIXct(wtd$dt) subset(wtd, format(dt, '%M') == 53) On Mon, Jun 22, 2009 at 9:58 PM, Keith Jones wrote: > Hi, > > I have a data frame with two columns: dt and tf. The dt column is datetime > and the tf column is a temperature. > >

  1   2   >