[R] nlm behaviour and error

2008-06-03 Thread Redding, Matthew
Hi R-Gurus, I've been cutting along quite nicely with nlm, until I threw in the following condition in the function that nlm is minimising: if (((term*bexp) 0.0001)) { #warning(term*bexp, =term*bexp,psi,=psi) theta-2000 } Now when I run this function anywhere

Re: [R] 'asymmetric span' for 2D loess?

2008-06-03 Thread Prof Brian Ripley
On Mon, 2 Jun 2008, Tokuyasu, Taku wrote: Hello, I am interested in performing a 2D loess smooth on microarray data, i.e. log2 ratios on a 2D grid, using different spans in the horizontal and vertical directions (the immediate reason being that replicate spots are laid out in the horizontal

Re: [R] Error/Crash on start up of R (Ubuntu and Wine within Ubuntu)

2008-06-03 Thread Prof Brian Ripley
Either you have a corrupt .RData file in the directory you are starting R in or the file is being read incorrectly (e.g. because of a corrupted file system or hardware issues). Reinstalling etc will not remove the .RData file, and you need to do so yourself. Starting R with --vanilla is

Re: [R] nlm behaviour and error

2008-06-03 Thread Prof Brian Ripley
It says the value is *missing* (NA), not that the length is wrong. My quess is that term*bexp is NaN, but you have given us no context to go on. On Tue, 3 Jun 2008, Redding, Matthew wrote: Hi R-Gurus, I've been cutting along quite nicely with nlm, until I threw in the following condition

Re: [R] probleme with R CMD check

2008-06-03 Thread Martin Maechler
c == cgenolin [EMAIL PROTECTED] on Tue, 03 Jun 2008 00:32:13 +0200 writes: c Hi the list. c I got a probleme with R CMD check. I run a package.skeleton on a very c simple code (four toy function, no probleme with the R CMD build). But c on the R CMD check packClassique, I

Re: [R] probleme with R CMD check

2008-06-03 Thread cgenolin
provide commented, minimal, self-contained, reproducible code. Please do -- both -- Sorry... Usualy, I do... --- 8 userA - function(x)x+1 privateA - function(x)x+2 .userB - function(x)x+10 .privateB - function(x)x+20 userC- function(x)userA(privateA(x)) privateC -

[R] regsubsets - package(leaps)

2008-06-03 Thread Maura E Monville
Please, can someone suggest me where to find a description for the attributes of the summary of regsubsets, that is: which rsqrssadjr2 cp bicoutmat obj ?? Thank you so much. -- Maura E.M [[alternative HTML version deleted]]

[R] discrete parameter

2008-06-03 Thread nona husainy
hello dear sir, Inbsp;wonder whether ifnbsp;anybody try to constructnbsp;acontinous parameternbsp;AR(P) from the discrete parameter AR(P) execuse me for my bad english lang. and thank you for your helpful.

Re: [R] Need advise in grab the line number of sorted list in R

2008-06-03 Thread Philipp Pagel
On Tue, Jun 03, 2008 at 10:37:33AM +1000, Jason Lee wrote: Hi, If there are more than one item having the same value, how can i use R to take the average of the position. E.g:- X Y Z 131 22.2 3.4 4.4 132 20.0 3.4 4.4==Position 2 if queried 150 20.0 12.2 4.5 =Position

Re: [R] exit function in R?

2008-06-03 Thread Federico Abascal
Thank everybody for the answers! The stop and quit functions are what I need (it is a script, not a function what needs to be terminated. I was talking about an exit function, what can be confusing). Best, Federico Gregory. R. Warnes wrote: Since Frederico indeicated he was running a script,

Re: [R] Odp: Aggregation and the meaning of class

2008-06-03 Thread Petr PIKAL
Hi Chip Maybe some more experienced users can direct you to proper source of information but in case of programming there are several books which can be of some use (I do not have any of them so its only my guess from their names). See items 1, 3 and 5 from CRAN Books page. Regards Petr

Re: [R] probleme with R CMD check

2008-06-03 Thread Martin Maechler
c == cgenolin [EMAIL PROTECTED] on Tue, 03 Jun 2008 09:55:15 +0200 writes: provide commented, minimal, self-contained, reproducible code. Please do -- both -- c Sorry... Usualy, I do... c --- 8 c userA - function(x)x+1 c privateA -

[R] Rpart and case weights: working with functions

2008-06-03 Thread Xavier Robin
I can't get rpart accept case weights defined inside a function. It keeps using the copy defined in the global environment (if they exists) instead of the function-defined ones. Here is what I do: test.function - function (formula, data) { weights - rep(.1, 100) rpart(formula, data,

[R] mtable and plm

2008-06-03 Thread Emili Tortosa-Ausina
Dear all, I'm trying to generate latex-formatted tables for panel data regressions using the mtable function of the memisc package, which is quite good. I use the plm package for panel data regression. Unfortunately, it seems that mtable works very well when using either lm or glm, but it

[R] matlab eigs function in R

2008-06-03 Thread kayteck_master
Hello Does anybody know how one can compute d largest eigenvalues/eigenvectors in R, like in MATLAB eigs function ? eigen function computes all eigenvectors/eigenvalues, and they are slightly different than those generated by matlab eigs. Thanks in advance -- View this message in context:

[R] Problems using jri0.4-1 y R 2.7.0

2008-06-03 Thread Borja Soto Varela
Hello, this is the first time I send a mail to r-help mailing list. I'm developing a program in java with calls in R and I can`t use jri 0.4-1 with R 2.7 or 2.6 .but it runs with 2.4. The problem that I get when using the latest version of R is as follows: Cannot find JRI native library! Please

Re: [R] Rpart and case weights: working with functions

2008-06-03 Thread Prof Brian Ripley
'weights' should be a column in your 'data': that is the standard way to specify weights to a model-fitting function. On Tue, 3 Jun 2008, Xavier Robin wrote: I can't get rpart accept case weights defined inside a function. It keeps using the copy defined in the global environment (if they

Re: [R] wildcard symbol or character

2008-06-03 Thread Michael Dewey
At 03:07 03/06/2008, john.polo wrote: hello all, i want to split a list into smaller lists. the list looks like this: CW-W730 CW-W720 CW-W710 CW-W700 CW-W690 CW-W680 CW-W670 CW-W660 CE-W997 CE-W987 CE-W977 CE-W967 CE-W956 CE-W944 CE-W934 CE-W924 7W-W760 7W-W750 7W-967W-941

Re: [R] Rpart and case weights: working with functions

2008-06-03 Thread S Ellison
A bit of fiddling suggests that the problem is less to do with rpart (which will quite happily acept weights defined inside a function) and more to do with the formula argument to the test function. This is probably because defining the formula in the global environment (as you implicitly do by

[R] predict arfima

2008-06-03 Thread A.N.
I noticed that both in the fArma and fracdiff packages it is not possible to predict an object fitted with an ARFIMA model. Moreover, the ox link is no more available. However, is it possible to find the coefficient d of differentiation of a time series, and then predict the time series by

[R] Cluster analysis with numeric and categorical variables

2008-06-03 Thread Miha Staut
Dear all, I would like to perform a clustering analysis on a data frame with two coordinate variables (X and Y) and a categorical variable where only a != b can be established. As far as I understood classification analyses, they are not an option as they partition the training set only in k

Re: [R] Swap variables in data.frame

2008-06-03 Thread Rogers, James A [PGRD Groton]
Birgit Lemcke wrote: I have a dataframe and two of my variables are in the wrong position and I would like to swap those variables. In addition to the other solutions posted, if you prefer to reference the columns by name rather than by index, you could use subset() dat - data.frame(a =

Re: [R] regsubsets - package(leaps)

2008-06-03 Thread Dieter Menne
Maura E Monville maura.monville at gmail.com writes: Please, can someone suggest me where to find a description for the attributes of the summary of regsubsets, that is: which rsqrssadjr2 cp bicoutmat obj ?? The docs say: An object of class regsubsets containing no

Re: [R] matlab eigs function in R

2008-06-03 Thread Jorge Ivan Velez
Dear kayteck, Function eigen (see ?eigen) will do what you want. HTH, Jorge On Tue, Jun 3, 2008 at 5:42 AM, kayteck_master [EMAIL PROTECTED] wrote: Hello Does anybody know how one can compute d largest eigenvalues/eigenvectors in R, like in MATLAB eigs function ? eigen function computes

Re: [R] transforming output of grid.locator() to coordinates of a leaf viewport

2008-06-03 Thread Wittner, Ben, Ph.D.
Paul, Thanks very much! Your example code below shows exactly how to do what I wanted. -Ben p.s., For the record, transRight - current.transform() after the second call to pushViewport() seems to have gotten deleted from you example code below, but that was obvious. -Original Message-

Re: [R] Cluster analysis with numeric and categorical variables

2008-06-03 Thread Christian Hennig
Dear Miha, a general way to do this is as follows: Define a distance measure by aggregating the Euclidean distance on the (X,Y)-space and the trivial 0-1 distance (0 if category is the same) on the categorial variable. Perform cluster analysis (whichever you want) on the resulting distance

[R] JGR / linux

2008-06-03 Thread g-h-d
Hi all, i'm trying to install JGR on linux (see bottom), but it runs into errors. The bottom of the sequence below shows JavaJD could not be found Any suggestion, please? $ sudo apt-get install sun-java6-jdk $ sudo update-alternatives --config java There are 5 alternatives which provide

Re: [R] matlab eigs function in R

2008-06-03 Thread David Winsemius
Jorge Ivan Velez [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: Dear kayteck, Function eigen (see ?eigen) will do what you want. HTH, He had looked, but since eigen returns both eigenvalues and eigenvectors, and does so in a list, perhaps he needs advice about how to extract his

Re: [R] Rpart and case weights: working with functions

2008-06-03 Thread Xavier Robin
S Ellison a écrit : As a work-round, try something lik test.function - function (formula.str, data) { weights - rep(.1, 8) rpart(as.formula(formula.str), data, weights) } which works if formula.str is a string instead of a formula object. Ok, I think I got the point. The only problem

Re: [R] Swap variables in data.frame

2008-06-03 Thread Birgitle
Thanks might be easier in my case because I have so many variables. Could have found this solution on my own. Birgit Rogers, James A [PGRD Groton] wrote: Birgit Lemcke wrote: I have a dataframe and two of my variables are in the wrong position and I would like to swap those

Re: [R] JGR / linux

2008-06-03 Thread Prof Brian Ripley
Your R is way too old: please follow the advice in the posting guide. I suspect the current JavaJD requires R = 2.7.0 from the errors you are getting below. On Tue, 3 Jun 2008, g-h-d wrote: Hi all, i'm trying to install JGR on linux (see bottom), but it runs into errors. The bottom of the

[R] surprising predicting capabilities

2008-06-03 Thread chaogai
Hi, I noticed the following fortune in R 2.7 and 2.6.2: fortune('Spreads') If anything, there should be a Law: Thou Shalt Not Even Think Of Producing A Graph That Looks Like Anything From A Spreadsheet. -- Ted Harding (in a discussion about producing graphics) R-help (August 2008)

Re: [R] JGR / linux

2008-06-03 Thread g-h-d
Thanks. I basically followed the steps in http://lib.stat.cmu.edu/R/CRAN/, and those below for JGR and it worked. ...but there are problems with help files e.g. ?matrix generates the following message: /tmp/RtmpvxsnQa/.R/doc/html/packages.html (No such file or directory) g-h-d wrote: Hi

Re: [R] 'asymmetric span' for 2D loess?

2008-06-03 Thread Tokuyasu, Taku
Dear Prof Ripley, Hello, I am interested in performing a 2D loess smooth on microarray data, i.e. log2 ratios on a 2D grid, using different spans in the horizontal and vertical directions (the immediate reason being that replicate spots are laid out in the horizontal direction). Is

Re: [R] surprising predicting capabilities

2008-06-03 Thread Greg Snow
That is actually from August 2007 (typo in the fortunes package). If you do RSiteSearch('Thou Shalt Not Even Think Graph Spreadsheet') Then it will bring up the actual post and you can read it in context (along with the posts that lead to it and those that followed). Basically, Ted was

[R] gam and prior

2008-06-03 Thread Paul Baverel
Hi. I am running a gam for covariate forward inclusions/ backward exclusions, using the weight options as follow. library(gam) gam.object1-gam(ET~1, data=nonp.dat, weights=PROBA) summary(gam.object1) step.object1-step.gam(gam.object1, direction=both , trace=T,

[R] request: An array declarion problem

2008-06-03 Thread Muhammad Azam
Dear R users I tried a lot to solve the following problem but could not. I have two arrays having same order i.e 1 by 150. j=10; ss=150; r=array(0 , c( j , ss )); rr=array(0 , c( j , ss )); r1=array(0 , c( j-1 , ss )); r2=array(0 , c( j-1 , ss )); r3=array(0 , c( 2 , ss )) for(i in 1:j-1){

Re: [R] wildcard symbol or character

2008-06-03 Thread john.polo
Michael Dewey wrote: split() where the f variable = c(1E-*,1W-*,2E-*,2W-*,5E-*,5W-*,7E-*,7W-*,CE-*,CW-*), but * doesn't work as a wildcard as i had hoped. can someone tell me the appropriate wildcard character/symbol to use, please Did you really use split()? yes, i did. the output looked

Re: [R] matlab eigs function in R

2008-06-03 Thread Thomas Lumley
Presumably the original poster was looking for a function that would compute just the largest five eigenvalues and associated vectors, because that is enormously more efficient for a large matrix than computing all of them. eigen() computes all of them. One way to compute just a few is to use

Re: [R] wildcard symbol or character

2008-06-03 Thread john.polo
Jorge Ivan Velez wrote: Dear John, Assuming that your information is in the list x, does substr(x,1,2) work for you? HTH, Jorge thanks for your reply Jorge. i will try substr(). john __ R-help@r-project.org mailing list

[R] R-2.7.0 rJava installation failure on x86_64

2008-06-03 Thread Nathan Coulter
attempting to install rJava on R-2.7.0, x86_64 platform, config.log shows the following error: configure:3880: checking whether JNI programs can be compiled configure:3898: gcc -m64 -std=gnu99 -o conftest -g -O2 -I/path/to/x86-64-linux/jdk-1.6.0_06/jre/../include

[R] problems on plotting adjacent bars with barplot. Help request, please

2008-06-03 Thread Giacomo Prodi
hi ladyes and gentlemans of the R comunity. i have the following graphical issue: # say y is a matrix or a dataframe with dim(51,nrow=17),hence 3 columns; l-51 # now the 3 colums represents 3 different aspects of my continuous variable (3 factors),plotted against a categorical one;

[R] splitting data frame based on a criteria

2008-06-03 Thread Marvin Lists
Hi, I have a data frame that I want to split into two based on the values of a variable in it. The variable Y has numeric values ranging between 0 through 70. I want to plot the frequencies of another variable X in two different cases: - When Y = 0 and - When Y 0 How does one go about doing

Re: [R] JGR / linux

2008-06-03 Thread Dirk Eddelbuettel
On 3 June 2008 at 08:42, g-h-d wrote: | I basically followed the steps in http://lib.stat.cmu.edu/R/CRAN/, and those | below for JGR and it worked. | | ...but there are problems with help files e.g. ?matrix generates the | following message: | | /tmp/RtmpvxsnQa/.R/doc/html/packages.html (No

[R] adding column and pulling data from table

2008-06-03 Thread Paul Adams
Hello to everyone, I have a general question about how to add a column to a table.I have a table that has 62 columns and 2000 rows.I am wanting to add a column on the left most row.I am wanting to label the rows g1 to g2000 I have the code of (g,c(1:nrow(dat)),sep=) for the right side of the

Re: [R] splitting data frame based on a criteria

2008-06-03 Thread Ingmar Visser
?by may be helpful here eg if dat is your data.frame and yf is a factor (created using ifelse) use by(dat,yf,mean) to compute the means for each level of yf hth, Ingmar On Jun 3, 2008, at 8:37 PM, Marvin Lists wrote: Hi, I have a data frame that I want to split into two based on the values

Re: [R] robust mlm in R?

2008-06-03 Thread John Fox
Dear Michael, I don't think that anyone else has suggested a fix, so here's one: snip --- # Mahalanobis Dsq for a matrix of variables dsq - function(x, Sigma) { if (missing(Sigma)) Sigma - cov(x, use=complete.obs) dev - scale(x, scale=FALSE) # DSQ - dev %*% solve(Sigma)

Re: [R] matlab eigs function in R

2008-06-03 Thread kayteck_master
Dear Thomas Yes, you're right. But I'm looking for this not only for computational cost reasons. eigen function from R has identical behavior to matlab function eig, but not to eigs. Even in matlab you can check that those function are not giving identical results. Here you have a short example

Re: [R] adding column and pulling data from table

2008-06-03 Thread Peter Alspach
Paul It is not entirely clear to me what you want to do. However, if you are wanting to add row names then try row.names(dat) - paste('g', 1:nrow(dat), sep='') First twenty rows of columns 1:3 are obtained by dat[1:20,1:3] Regarding putting all the points in a column onto a scatterplot. One

[R] How to solve a non-linear system of equations using R

2008-06-03 Thread Jorge Ivan Velez
Dear R-list members, I've had a hard time trying to solve a non-linear system (nls) of equations which structure for the equation i, i=1,...,4, is as follows: f_i(d_1,d_2,d_3,d_4)-k_i(l,m,s) = 0(1) In the expression above, both f_i and k_i are known functions and l, m and

Re: [R] How to solve a non-linear system of equations using R

2008-06-03 Thread ctu
Hi Jorge, Have you tried to use systemfit package. In this package, this is a function call nlsystemfit . This might help. Chunhao Quoting Jorge Ivan Velez [EMAIL PROTECTED]: Dear R-list members, I've had a hard time trying to solve a non-linear system (nls) of equations which

[R] A question about environments

2008-06-03 Thread David Vavra
I have been using separate environments to partition my data and functions into logical groups but I have been having an odd (to me) problem. To load and manipulate the data environments, I wrote a couple of small functions (see below). The problem seems to be that when I initially try to load

[R] using function from specific packages

2008-06-03 Thread jiho.han
hello, useRs- i have a function that i wrote myself, for example, lag(x). however, when i load 'zoo' packages and try to lag 'zoo' object, it gave me error. (R try to pass 'zoo' object into my function.) i typed 'lag.zoo' in R, but it can't find it. how can i access 'lag.zoo' function? and in

[R] R-2.7.0 make check failure

2008-06-03 Thread Gregory Ruchti
Hello, I am fairly new to using R and am trying to install it on my Linux machine, running Scientific Linux. I get through running 'configure' and 'make' OK, but when I run 'make check', I get the following error: make check make[1]: Entering directory

Re: [R] JGR / linux

2008-06-03 Thread g-h-d
Dirk Eddelbuettel wrote: On 3 June 2008 at 08:42, g-h-d wrote: | I basically followed the steps in http://lib.stat.cmu.edu/R/CRAN/, and those | below for JGR and it worked. | | ...but there are problems with help files e.g. ?matrix generates the | following message: | |

[R] Summarizing dummy coefficients in sem package

2008-06-03 Thread Gus Jespersen
Greetings, I am working in the sem package on a model with 3 exogenous variables (2 are nominal-categorical), and 4 endogenous, continuous variables. To use sem with the nominal variables, I created dummy variables. Now, in my sem output I have estimates for path coefficients for the

Re: [R] using function from specific packages

2008-06-03 Thread Gabor Grothendieck
zoo has a namespace and lag.zoo is not exported so zoo:::lag.zoo is how to access it directly. See help(:::) On Tue, Jun 3, 2008 at 4:31 PM, jiho.han [EMAIL PROTECTED] wrote: hello, useRs- i have a function that i wrote myself, for example, lag(x). however, when i load 'zoo' packages and

Re: [R] probleme with R CMD check

2008-06-03 Thread cgenolin
I find the problem: the name of my base directory (the one that contain R, man and test) was not the same than the name of the package... I thaught this was allowed, I guess I was wrong. Christophe c == cgenolin [EMAIL PROTECTED] on Tue, 03 Jun 2008 09:55:15 +0200 writes: provide

Re: [R] R-2.7.0 rJava installation failure on x86_64

2008-06-03 Thread Nathan Coulter
From: Nathan Coulter It looks like the command above could use /lib64/libc.so.6, but running R CMD javareconf shows that JNI linker flags don't contain any entry similar to '-L/lib64': It turns out that /usr/lib64/libc.so is what is needed. I was able to install rJava after adding

Re: [R] probleme with R CMD check

2008-06-03 Thread Martin Maechler
c == cgenolin [EMAIL PROTECTED] on Wed, 04 Jun 2008 00:30:08 +0200 writes: c I find the problem: the name of my base directory (the c one that contain R, man and test) was not the same than c the name of the package... Aha! c I thaught this was allowed, I guess I was

Re: [R] merging two data sets with no column header

2008-06-03 Thread kayj
Thanks for your reply. In your last step If I create a duplicate ( two similar records ) # create a duplicate vv[8,1] - 7 vv[8,2]-'g' and then I merge vv with vv2 ,both duplicates are merged. Is there a way to tell R to merge only the unique records. Thanks and appreciate your help. --

[R] IBM-AIX 5.2 (GCC 4.2.4 installed) - Error while executing 'make'

2008-06-03 Thread Senthilkumaran
Hi, The following error occurs while executing 'make' after the successful configuration (./configure) on IBM-AIX 5.2 (GCC 4.2.4 installed): gcc -std=gnu99 -I../../src/extra/zlib -I../../src/extra/bzip2 -I../../src/extra/pcre -I. -I../../src/include -I../../src/include

Re: [R] JGR / linux

2008-06-03 Thread g-h-d
Dirk Eddelbuettel wrote: On 3 June 2008 at 13:44, g-h-d wrote: | | $ sudo apt-get install sun-java6-jdk | | | | $ sudo update-alternatives --config java | | | | There are 5 alternatives which provide `java'. | | | | Selection Alternative | |

Re: [R] splitting data frame based on a criteria

2008-06-03 Thread Moshe Olshansky
Also check ?aggregate --- On Wed, 4/6/08, Ingmar Visser [EMAIL PROTECTED] wrote: From: Ingmar Visser [EMAIL PROTECTED] Subject: Re: [R] splitting data frame based on a criteria To: Marvin Lists [EMAIL PROTECTED] Cc: r-help@r-project.org Received: Wednesday, 4 June, 2008, 5:11 AM ?by may

[R] Stacked barplot of timeseries data

2008-06-03 Thread Demetri S. Mouratis
Hi, I'm trying to plot time-series data where each sample breaks down the percentage of CPU time spent in each of four states (usr, nice, sys, idle) 19:08:15 %usr %nice %sys %idle 19:08:165 0 10 86 19:08:17 17 0 14 69 19:08:185 0 8

Re: [R] Stacked barplot of timeseries data

2008-06-03 Thread Achim Zeileis
On Tue, 3 Jun 2008, Demetri S. Mouratis wrote: Hi, I'm trying to plot time-series data where each sample breaks down the percentage of CPU time spent in each of four states (usr, nice, sys, idle) 19:08:15 %usr %nice %sys %idle 19:08:165 0 10 86 19:08:17 17 0

Re: [R] How to solve a non-linear system of equations using R

2008-06-03 Thread Moshe Olshansky
Since k_i(l,m,s) are known constants, you actually have a system of four non-linear equations with 4 unknowns. One possibility is to use optim (check ?optim). Another one is to use the very recently released package - look at

Re: [R] 1501-511 Compilation failed for file ch2inv.f - R on AIX 5.2.

2008-06-03 Thread Senthilkumaran
Hi, Installed GCC 4.2.4 on IBM-AIX 5.2 and configured 'R' successfully. Although the below error was resolved after installing GCC 4.2.4, the 'make' failed in another step (related msg posted on June 03). Senthilkumaran wrote: Hi, Thanks for the response.  We do have a IBM XL Fortran

[R] unable to get plot in R

2008-06-03 Thread Chin-Cheng Su
Hi everyone, I use R to plot my data set (x,y) in Windows XP, but keep getting error message like follows, ... plot(x, y) Error in windows() : unable to start device devWindows How can I solve this problem? Thanks for any suggestion or help. CC

Re: [R] IBM-AIX 5.2 (GCC 4.2.4 installed) - Error while executing 'make'

2008-06-03 Thread Senthilkumaran
Hi, Added -Wl,-bnoquiet in Makeconf and executed 'make'. The following error occured: gcc -std=gnu99 -I. -I../../../src/include -I../../../src/include -I/usr/local/include -DHAVE_CONFIG_H -mno-fp-in-toc -g -O2 -c Lapack.c -o Lapack.o gcc -std=gnu99 -Wl,-brtl -Wl,-G

[R] merge two data sets

2008-06-03 Thread kayj
I would like to merge “data1 “that contains 100 unique ID’s with another data set “data 2” with 150 ID’s and the age of those individuals ( the ID in data1 is a subset of the ID in data 2) I would like to merge these data1 with data2 and have the result of the merge to have the ID ordered as in

[R] Model simplification using anova()

2008-06-03 Thread ChCh
Hello all, I've become confused by the output produced by a call to anova(model1,model2). First a brief background. My model used to predict final tree height is summarised here: Df Sum Sq Mean Sq F valuePr(F) Treatment 2 748.35 374.17

Re: [R] Stacked barplot of timeseries data

2008-06-03 Thread Gabor Grothendieck
Here is a variation of the example below which uses your data. Paste this into an R session: Lines - 19:08:15 %usr %nice %sys %idle 19:08:165 0 10 86 19:08:17 17 0 14 69 19:08:185 0 8 87 19:08:19 10 0 10 81 19:08:203

Re: [R] unable to get plot in R

2008-06-03 Thread Duncan Murdoch
On 03/06/2008 6:53 PM, Chin-Cheng Su wrote: Hi everyone, I use R to plot my data set (x,y) in Windows XP, but keep getting error message like follows, ... plot(x, y) Error in windows() : unable to start device devWindows How can I solve this problem? Thanks for any suggestion or help.

[R] Question about subsetting data

2008-06-03 Thread William Pepe
I have a data set(Bill) of with 1 variable (var1), with 100 obs that are in ascending order. I want to sample every 10 observations and save them in 10 different groups such as Group1 is obs 1-10 Group 2 is obs-11-20 and so on. First step is to subset them into the 10 groups, then

Re: [R] How to add space between main title to leave space for legend?

2008-06-03 Thread Paul Johnson
On Sat, May 31, 2008 at 2:45 PM, Peter Dalgaard [EMAIL PROTECTED] wrote: Paul Johnson wrote: Hell (1) par(xpd=TRUE) allows you to write outside the plotting region O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B As usual, PD right on the money. Here's a working demo

[R] Minimizing the negative log likelihood function...

2008-06-03 Thread François Aucoin
Hey, The following is a function I wrote which generates random variables from a Kappa (2-parameter) distribution. rkappa - function(n,beta,alpha){ if(alpha = 0) stop(alpha must be greater than zero!) if(beta = 0) stop(beta must be greater than zero!) Vec -

Re: [R] merge two data sets

2008-06-03 Thread Moshe Olshansky
Where do you want to place ID's which are in data2 but NOT in data1? --- On Wed, 4/6/08, kayj [EMAIL PROTECTED] wrote: From: kayj [EMAIL PROTECTED] Subject: [R] merge two data sets To: r-help@r-project.org Received: Wednesday, 4 June, 2008, 9:45 AM I would like to merge “data1 “that

Re: [R] Question about subsetting data

2008-06-03 Thread Moshe Olshansky
One possibility is: x - ceiling((1:100)/10) aggregate(var1,by=list(x),mean) --- On Wed, 4/6/08, William Pepe [EMAIL PROTECTED] wrote: From: William Pepe [EMAIL PROTECTED] Subject: [R] Question about subsetting data To: r-help@r-project.org Received: Wednesday, 4 June, 2008, 10:35 AM I

Re: [R] Question about subsetting data

2008-06-03 Thread jim holtman
Will this do it for you: Bill - 1:100 # test data # partition Bill.p - split(Bill, rep(1:10, each=10)) Bill.p $`1` [1] 1 2 3 4 5 6 7 8 9 10 $`2` [1] 11 12 13 14 15 16 17 18 19 20 $`3` [1] 21 22 23 24 25 26 27 28 29 30 $`4` [1] 31 32 33 34 35 36 37 38 39 40 $`5` [1] 41 42 43 44

[R] help understanding why #function(x, y) (if((x-y)=0) {2^(x-y)} else{-(2^abs(x-y))})# doesn't work like I think it should

2008-06-03 Thread ALAN SMITH
Hello R users and developers, I am trying to write several functions (fairly new at this) in order to avoid using loops on large data frames (because they are slow). I wrote the function below and it seems to get hung on the first part of the if statement and then applies that condition to rest

[R] column and row

2008-06-03 Thread Manli Yan
-fit1$coefficients y.control y.lowy.high (Intercept)19.628713 21.883999 20.023814 log(1 + (age - 45)/10) -7.383725 -6.017342 -5.084431 here is my outcome,I need one vector say b1=first row without the intercept ,like:(19.628713, 21.883999, 20.023814) and

Re: [R] (re-titled) help with if.

2008-06-03 Thread Rolf Turner
This is an FAQ (although it doesn't seem to be listed in the official FAQs. The ``if'' command compares scalars (only, in effect). See ?if You need to use the ifelse() function: folds - function(x,y) ifelse(x-y=0,2^(x-y),-2^(y-x)) This if for illustrative purposes only. The foregoing

Re: [R] help understanding why #function(x, y) (if((x-y)=0) {2^(x-y)} else{-(2^abs(x-y))})# doesn't work like I think it should

2008-06-03 Thread Simon Blomberg
Use ifelse() rather than if () {} else {}. It's vectorized and very useful for applying to elements along vectors. The latter idiom is much better for control of flow in programs and functions. folds - function (x, y) ifelse(x-y = 0, 2^(x-y), -(2^abs(x-y))) z - folds(x, y) z [1] 161

Re: [R] help understanding why #function(x, y) (if((x-y)=0) {2^(x-y)} else{-(2^abs(x-y))})# doesn't work like I think it should

2008-06-03 Thread Erik Iverson
Alan - ALAN SMITH wrote: Hello R users and developers, I am trying to write several functions (fairly new at this) in order to avoid using loops on large data frames (because they are slow). I wrote the function below and it seems to get hung on the first part of the if statement and then

Re: [R] help understanding why #function(x, y) (if((x-y)=0) {2^(x-y)} else{-(2^abs(x-y))})# doesn't work likeI think it should

2008-06-03 Thread Steven McKinney
Hi Alan, -Original Message- From: [EMAIL PROTECTED] on behalf of ALAN SMITH Sent: Tue 6/3/2008 6:47 PM To: r-help@r-project.org Subject: [R] help understanding why #function(x,y) (if((x-y)=0) {2^(x-y)} else{-(2^abs(x-y))})# doesn't work likeI think it should Hello R users and

[R] Similar question about subsetting data

2008-06-03 Thread William Pepe
This is just a slight modification of a question I asked earlier. Thanks to all the responders. I have a data set(Bill) of with 1 variable (var1), with 100 obs that are in ascending order. I want to sample every 10 observations and save them in 10 different groups such as Group1 is obs

Re: [R] help understanding why #function(x, y) (if((x-y)=0) {2^(x-y)} else{-(2^abs(x-y))})# doesn't work like I think it should

2008-06-03 Thread Gabor Grothendieck
Try this: data.frame(x, y, folds = (x == y) + sign(x - y) * 2 ^ abs(x - y)) or replace data.frame with cbind if you prefer a matrix result. On Tue, Jun 3, 2008 at 9:47 PM, ALAN SMITH [EMAIL PROTECTED] wrote: Hello R users and developers, I am trying to write several functions (fairly new at

[R] how to extract a specific group of data from a table?

2008-06-03 Thread Manli Yan
a table with three varialbe:treatment (low,high),size(large,small),response y I want all response y with treatment=low and size=large, I try to write as : treatment-c(low,low,high,high) size-c(small,large,small,large) y-c(1,2,4,5) table1-data.frame(treatment,size,y)

Re: [R] how to extract a specific group of data from a table?

2008-06-03 Thread Jorge Ivan Velez
Dear Manli, Try this: table1[table1$treatment==low table1$size==large,] HTH, Jorge On Tue, Jun 3, 2008 at 11:19 PM, Manli Yan [EMAIL PROTECTED] wrote: a table with three varialbe:treatment (low,high),size(large,small),response y I want all response y with treatment=low and

Re: [R] Similar question about subsetting data

2008-06-03 Thread Jorge Ivan Velez
Dear William, Following Jim Holtman's solution to your previous post, you can do something similar to Bill - 1:100 # test data Bill.p - split(Bill, rep(1:10, each=10)) sapply(Bill.p, function(x) mean(x)/0.8) 1 2 3 4 5 6 7 8 9 10 6.875

[R] code for automating the sem package

2008-06-03 Thread Gus Jespersen
Greetings, I am wondering if anyone has written programs to automate model fitting with the sem package, where one could specify a 'saturated' model and sequentially fit models with different combinations of parameters removed, while outputting fit data/parameters involved for each model.

[R] for loop or by group in EF function

2008-06-03 Thread Ingrid Tohver
Hello, I would like to apply the EF function (a goodness of fit test between predicted (ts2) and observed (Tw) values in the qualV package) to each of the Sites in my data frame. However, when I try the following script, R gives an error message that lists unused arguments, which include

Re: [R] unable to get plot in R

2008-06-03 Thread Chin-Cheng Su
Please look at what I tried, attach(my.data) options(device=windows) plot(x,y) Error in windows() : unable to start device devWindows However, as i tried something else, it went like options(device=devWindows) plot(x,y) Error in plot.new() : no active or default device Any idea?

[R] linear model in the repeated data type~

2008-06-03 Thread Manli Yan
here is the data: y-c(5,2,3,7,9,0,1,4,5) id-c(1,1,6,6,7,8,15,15,19) t-c(50,56,50,56,50,50,50,60,50) table1-data.frame(y,id,t)//longitudinal data what I want to do is to use the linear model for each id ,then get the estimate value,like: fit1-lm(y~t,data=table1,subset=(id==1)) but ,you can

Re: [R] splitting data frame based on a criteria

2008-06-03 Thread ctu
Or ?gsummary Quoting Moshe Olshansky [EMAIL PROTECTED]: Also check ?aggregate --- On Wed, 4/6/08, Ingmar Visser [EMAIL PROTECTED] wrote: From: Ingmar Visser [EMAIL PROTECTED] Subject: Re: [R] splitting data frame based on a criteria To: Marvin Lists [EMAIL PROTECTED] Cc:

Re: [R] linear model in the repeated data type~

2008-06-03 Thread Austin, Matt
How about library(nlme) allFits - lmList(y ~ t|id, data=table1, pool=FALSE) or allFits - by(table1, table1$id, function(x) lm(y ~ t, data=x)) Both ways store the results as a list, so you can access individual results using list extraction. --Matt -Original Message- From: [EMAIL

Re: [R] linear model in the repeated data type~

2008-06-03 Thread Moshe Olshansky
Try something like this: fits - list(500) for (i in 1:500) { if (sum(table1$id == i) == 0) fits[[i]] - NA else fits[[i]] - lm(y~t,data=table1,subset=(id==i)) } --- On Wed, 4/6/08, Manli Yan [EMAIL PROTECTED] wrote: From: Manli Yan [EMAIL PROTECTED] Subject: [R] linear model in the repeated

[R] how to automatically create objects with names from a string list?

2008-06-03 Thread Mark Farnell
Suppose I have a string of objects names: name - c(foo, bar, baz) and I would like to use a for loop to automatically create three objects called foo, bar and baz accordingly. Then how can this be done (so that in the workspace, foo = 1, bar = 2 and baz=3) for (i in name) { . }

Re: [R] how to automatically create objects with names from a string list?

2008-06-03 Thread Moshe Olshansky
You can use either assign or eval. Something like name - c(foo, bar, baz) for (i in 1:length(name)) assign(name[i],i) --- On Wed, 4/6/08, Mark Farnell [EMAIL PROTECTED] wrote: From: Mark Farnell [EMAIL PROTECTED] Subject: [R] how to automatically create objects with names from a string

  1   2   >