[R] Creating Vignettes

2008-10-29 Thread Shreyasee
Hi, I want to create a new vignette and include it in an already existing package. That package has already many vignettes which are related to the chapters from the book on which the package is built. It would be a great help if anyone could help to understand how to create vignette for a statist

Re: [R] tklistbox selection

2008-10-29 Thread Sundar Dorai-Raj
I solved this problem by adding "exportselection = 0" to the call to tklistbox. I.e. tb1 <- tklistbox(tt, listvariable = tcl1, exportselection = 0, selectmode = "multiple") Thanks, --sundar Sundar Dorai-Raj said the following on 10/29/2008 5:56 PM: Hi, I'm

Re: [R] Arrays of Trellis plots

2008-10-29 Thread Felix Andrews
2008/10/30 erwann rogard <[EMAIL PROTECTED]>: > hi, > > xyplot(y~x2|x1+which,data= >> >> make.groups(dataframe1, dataframe2)) >> >> > i'd like to replace the labels for dataframe1 and dataframe2 say with > c("A","B"). is there a way? I guess you mean make.groups(A = dataframe1, B = dataframe2) see

Re: [R] Arrays of Trellis plots

2008-10-29 Thread erwann rogard
hi, xyplot(y~x2|x1+which,data= > > make.groups(dataframe1, dataframe2)) > > i'd like to replace the labels for dataframe1 and dataframe2 say with c("A","B"). is there a way? thanks! On Mon, Oct 27, 2008 at 2:23 PM, Deepayan Sarkar <[EMAIL PROTECTED]>wrote: > On 10/27/08, erwann rogard <[EMAIL P

Re: [R] Trying to "expand" some data - Newbie needs help

2008-10-29 Thread Farley, Robert
Each row of my dataframe has these data items: Stuff1 Stuff2 TripID StopID moreStuff1 moreStuff2 ... I might have 2 entries for TripID=9011890 and StopID=Reseda, while I know the "Universe" for that combination was 7. I'd like to set a new variable (Call it X1) with a value of 3.5 for the two

Re: [R] Reconstruct the Q matrix from the QR object

2008-10-29 Thread Richard M. Heiberger
x <- matrix(rnorm(1:20), 5, 4) x.qr <- qr(x) Q <- qr.Q(x.qr) R <- qr.R(x.qr) X <- qr.X(x.qr) Q R X Q %*% R qr.Q(x.qr, complete=TRUE) ## orthogonal completion __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] How to get the duplicated elements from a vector?

2008-10-29 Thread Leon Yee
Erik Iverson wrote: ## BEGIN R CODE ## guarantees there is at least one level with exactly three elements, ## which your problem seems to require t1 <- data.frame(a = rnorm(10), b = c("D", "D", "D", sample(LETTERS[1:3], 7, replace = TRUE))) ## find which names have exactly three elements t2 <-

[R] Reconstruct the Q matrix from the QR object

2008-10-29 Thread cruz
Hi, Is it possible to construct a Q from qr() that some of the rows could be specified (to be fixed values)? Thanks, cruz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-pr

[R] Trying to "expand" some data - Newbie needs help

2008-10-29 Thread Farley, Robert
I want to calculate "expansion factors" for elements in my dataframe based on a 2-d cross classification. Since I'll have "missing values" (many combinations will have no record) I'll need a second "expansion factor" for each "row". I've included my "work to date" below, but I'm not very close t

Re: [R] Regression versus functional/structural relationship?

2008-10-29 Thread Leif Peterson
The two test outcomes will have correlated results, so you will need to look at either bivariate probit regression or seemingly unrelated regression. For either of these two methods, you will need to constrain all independent variable coefficients to be equal, or you will have difficulty making s

[R] tklistbox selection

2008-10-29 Thread Sundar Dorai-Raj
Hi, I'm posting yet another question about tcltk since I'm still struggling with the package. I'm trying to create a tklistbox and a ttkcombobox on the same parent and am having a problem. Here's an example: library(tcltk) tt <- tktoplevel() tcl1 <- tclVar() tcl2 <- tclVar() tclObj(tcl1) <- l

[R] Q: rbind problem in my code

2008-10-29 Thread Andy Zhu
I have a large matrix which is divided into several pieces, manipulated individually, and saved into RData in disc. After each pieces are done with operation, I load them into memory and use rbind to stack them back into matrix. however, the rbind is only give me the last two pieces. The followi

Re: [R] Functional pattern-matching in R

2008-10-29 Thread Gabor Grothendieck
Using the list function defined here: http://tolstoy.newcastle.edu.au/R/help/04/06/1430.html list[m, n] <- as.list(dim(iris)) mylist <- as.list(1:5) list[Head, Tail] <- list(mylist[[1]], mylist[-1]) On Wed, Oct 29, 2008 at 4:39 PM, Alexy Khrabrov <[EMAIL PROTECTED]> wrote: > I found there's a v

Re: [R] substring/strsplit question

2008-10-29 Thread Gabor Grothendieck
Assuming that by elements you mean characters ("2E" is the first element of x but "E" is the last character in x[1]) then this will create a character matrix of dimensions: length(x) by 2 such that each row corresponds to one component of x and the second column in that row holds its last character

Re: [R] License Question

2008-10-29 Thread Chi Chan
Just remember that the Linux kernel is also licensed under GPL v2. I am not sure if you pay for your Linux distribution. But for many gov sites and for my copy of Linux, they just use Linux as a completely free product -- in the sense that no money needs to be paid to a company or anyone. However,

Re: [R] how can I access parts of yags output

2008-10-29 Thread Rolf Turner
On 30/10/2008, at 11:48 AM, Juliet Hannah wrote: Here is an example given from ?yags library(methods) data(stackloss) Y1 <- yags(stack.loss~Air.Flow,id=1:21, data=stackloss) How can I access parts of the output. I tried: str(Y1) Formal class 'yagsResult' [package "yags"] with 25 slots

[R] Regression versus functional/structural relationship?

2008-10-29 Thread Ravi Varadhan
Hi, I am dealing with the following problem. There are two biochemical assays, say A and B, available for analyzing blood samples. Half the samples have been analyzed with A. Now, for some insurmountable logistic reasons, we have to use B to analyze the remaining samples. However, we can do a

Re: [R] Plotting iregular time series

2008-10-29 Thread stephen sefick
why not look at the zoo package it can deal with time irregular time series. I have used it and I have been very happy. On Wed, Oct 29, 2008 at 5:52 PM, Levy,Ilan [Ontario] <[EMAIL PROTECTED]> wrote: > Hi, > > I have several time series that I need to plot on the same plot. > There are 3 problems

[R] Plotting iregular time series

2008-10-29 Thread Levy,Ilan [Ontario]
Hi, I have several time series that I need to plot on the same plot. There are 3 problems with these series: 1. they do not start or end at the same times 2. they have different time intervals (seconds, minutes or hours) 3. they all have random missing time steps of a few step to longer periods o

[R] how can I access parts of yags output

2008-10-29 Thread Juliet Hannah
Here is an example given from ?yags library(methods) data(stackloss) Y1 <- yags(stack.loss~Air.Flow,id=1:21, data=stackloss) How can I access parts of the output. I tried: > str(Y1) Formal class 'yagsResult' [package "yags"] with 25 slots ..@ coefficients : num [1:2] -44.13 1.02 ..@

Re: [R] Macro stuff to work on up through august 2007

2008-10-29 Thread stephen sefick
sorry guys. I have a cold and I am not thinking very clearly On Wed, Oct 29, 2008 at 5:50 PM, stephen sefick <[EMAIL PROTECTED]> wrote: > Title says it all remember cast() with sum as the aggregation function > > -- > Stephen Sefick > Research Scientist > Southeastern Natural Sciences Academy > >

Re: [R] linux batch question

2008-10-29 Thread markleeds
thanks Rolf. Yes, I meant temp.R. I was going to use test.R but then I realized that I already had a program named that. I think the R gods are really hating me !!! it's a very odd thing. I'll grep the file because maybe the output is in there somewhere and i'm missing it ? On Wed, Oct

[R] FW: Re: linux batch question

2008-10-29 Thread markleeds
Hi Phil: That's EXACTLY what it is. Thanks so much. It's nice to know that the R Gods don't hate me. I hope it's okay that I'm going to cc r-help in case this thread comes up in the future and also so that other people who might want to help know that it's solved. Thanks again. On Wed, Oc

Re: [R] Functional pattern-matching in R

2008-10-29 Thread Duncan Murdoch
On 29/10/2008 4:39 PM, Alexy Khrabrov wrote: I found there's a very good functional set of operations in R, such as apply family, Hadley Wickham's lovely plyr, etc. There's even a Reduce (a.k.a. fold). Now I wonder how can we do pattern-matching? E.g., now I split dimensions like this:

Re: [R] how to restrict a parameter in optim()

2008-10-29 Thread Ben Bolker
Luis SAGAON TEYSSIER etumel.univmed.fr> writes: > > Dear all, > > I'm trying to estimate some parameters with the optim() function but I > need to restrict one parameter and I have not found how to do it. > Could you help me please? Thought someone else would answer by now. use the arg

Re: [R] problem with "simtest"

2008-10-29 Thread Henric Nilsson (Public)
Susana Zuloaga wrote: Hello all I am working with the package multcomp but I have problems with the function simtest; the program say that can not find this function, nevertheless I doesn't have any problem with the function glht that it is in the same package. Someone knows what could be t

Re: [R] linux batch question

2008-10-29 Thread Rolf Turner
On 30/10/2008, at 10:46 AM, [EMAIL PROTECTED] wrote: I usually just run my R programs at the R command prompt but for my latest one I want to save any output that gets written to the screen so I am trying to use R CMD BATCH and send the output to an output file. I realize I could use sink at

[R] Macro stuff to work on up through august 2007

2008-10-29 Thread stephen sefick
Title says it all remember cast() with sum as the aggregation function -- Stephen Sefick Research Scientist Southeastern Natural Sciences Academy Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us f

[R] linux batch question

2008-10-29 Thread markleeds
I usually just run my R programs at the R command prompt but for my latest one I want to save any output that gets written to the screen so I am trying to use R CMD BATCH and send the output to an output file. I realize I could use sink at the prompt but I'd rather try to do it this way becaus

Re: [R] call works with gee and yags, but not geepack

2008-10-29 Thread Rolf Turner
On 30/10/2008, at 9:08 AM, Juliet Hannah wrote: I have included data at the bottom of this email. It can be read in by highlighting the data and then using this command: dat <- read.table("clipboard", header = TRUE,sep="\t") I can obtain solutions with both of these: library(gee) fit.gee<-gee

Re: [R] substring/strsplit question

2008-10-29 Thread Marc Schwartz
on 10/29/2008 03:57 PM Erin Hodgess wrote: > Dear R People: > > Here is a toy example: > >> x <- c("2E","5W","12H") >> substr(x,2,2) > [1] "E" "W" "2" > > Sometimes x has 3 elements, sometimes 2. I want to extract the last > element, and then extract the other 1 or 2 elements. > > How can I do

Re: [R] substring/strsplit question

2008-10-29 Thread davidr
How about > x <- c("2E","5W","12H") > substr(x, nchar(x), nchar(x)) [1] "E" "W" "H" > > substr(x, 1, nchar(x)-1) [1] "2" "5" "12" -- David -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Erin Hodgess Sent: Wednesday, October 29, 2008 3:58 PM To: [EMA

Re: [R] substring/strsplit question

2008-10-29 Thread Henrique Dallazuanna
Try this: library(gsubfn) ## The last character strapply(x, "(.)$", simplify = TRUE) ## The last two character strapply(x, "(..)$", simplify = TRUE) On Wed, Oct 29, 2008 at 6:57 PM, Erin Hodgess <[EMAIL PROTECTED]>wrote: > Dear R People: > > Here is a toy example: > > > x <- c("2E","5W","12H"

Re: [R] substring/strsplit question

2008-10-29 Thread Erik Iverson
Upon re-reading your question, I did not provide what you wanted. In your example, 'x' is a character vector that has three elements. Each element of 'x' has two or three characters. Now I think I see what you want: ## untested, for the last character: substr(x, nchar(x), nchar(x)) ## untes

Re: [R] substring/strsplit question

2008-10-29 Thread Erik Iverson
## untested last <- tail(x, n = 1) first <- head(x, n = length(x) - 1) Erin Hodgess wrote: Dear R People: Here is a toy example: x <- c("2E","5W","12H") substr(x,2,2) [1] "E" "W" "2" Sometimes x has 3 elements, sometimes 2. I want to extract the last element, and then extract the other 1

[R] substring/strsplit question

2008-10-29 Thread Erin Hodgess
Dear R People: Here is a toy example: > x <- c("2E","5W","12H") > substr(x,2,2) [1] "E" "W" "2" > Sometimes x has 3 elements, sometimes 2. I want to extract the last element, and then extract the other 1 or 2 elements. How can I do this, please? TIA, Sincerely, Erin -- Erin Hodgess Associa

[R] Functional pattern-matching in R

2008-10-29 Thread Alexy Khrabrov
I found there's a very good functional set of operations in R, such as apply family, Hadley Wickham's lovely plyr, etc. There's even a Reduce (a.k.a. fold). Now I wonder how can we do pattern-matching? E.g., now I split dimensions like this: m <- dim(V)[1] # R n <- dim(V)[2

Re: [R] call works with gee and yags, but not geepack

2008-10-29 Thread Juliet Hannah
Sorry. I did not output the NAs correctly. dat <- read.table("clipboard", header = TRUE) id treat time1 time2 time3 time4 chem1 chem2 chem3 chem4 time score chem 1 1 20 18 15 15 1000 1100 1200 1300 0 20 1000 1 1 20 18 15 15 1000 1100 1200 1300 2 18 1100 1 1 20 18 15 15 1000 1100 1200 1300 3 15 12

Re: [R] Subsetting data in a loop

2008-10-29 Thread hadley wickham
?split. Hadley On Wed, Oct 29, 2008 at 3:22 PM, t c <[EMAIL PROTECTED]> wrote: > I need some help with sub-setting my data. I am trying to divide a data > frame into multiple data frames based on the year collected, and stored in a > list with each new data frame labeled with "year X" where X

[R] Subsetting data in a loop

2008-10-29 Thread t c
I need some help with sub-setting my data.  I am trying to divide a data frame into multiple data frames based on the year collected, and stored in a list with each new data frame labeled with "year X" where X is the year the data was collected.  When I run my current code I get nine error messa

[R] call works with gee and yags, but not geepack

2008-10-29 Thread Juliet Hannah
I have included data at the bottom of this email. It can be read in by highlighting the data and then using this command: dat <- read.table("clipboard", header = TRUE,sep="\t") I can obtain solutions with both of these: library(gee) fit.gee<-gee(score ~ chem + time, id=id, family=gaussian,corstr=

Re: [R] Help with Plots

2008-10-29 Thread stephen sefick
#How about this? x1=6*(sin((0:100)*2*pi/100))+4 y1=6*(cos((0:100)*2*pi/100))+4 plot(x1,y1) x2=c(1,9,3,4,8,4,2,0) y2=c(3,6,8,2,4,1,9,6) lines(x2,y2,type="b") On Wed, Oct 29, 2008 at 2:48 PM, Alex99 <[EMAIL PROTECTED]> wrote: > > Hi there, > I am trying to have a connectivity graph (two plots at on

Re: [R] behavior of "by"

2008-10-29 Thread Sebastian P. Luque
On Wed, 29 Oct 2008 10:49:03 -0700, Jeff Laake <[EMAIL PROTECTED]> wrote: > Again thanks for the input. I've been a recipient of this list for > quite a few years although I don't post often. It is an invaluable > resource and I appreciate the effort of all the contributors. I > support a lot o

Re: [R] Barplot: Vertical bars with long labels

2008-10-29 Thread Udo
Thanks a lot, Henrique and Christos! It works fine Quoting Christos Hatzis <[EMAIL PROTECTED]>: > Udo, > > You can try inserting a newline where you need the break in your labels: > > > dd.names <- c('Conduct Disorders','Attention Deficit', 'Eating Disorders', > 'Substance Abuse','Developme

Re: [R] Barplot: Vertical bars with long labels

2008-10-29 Thread Christos Hatzis
Udo, You can try inserting a newline where you need the break in your labels: > dd.names <- c('Conduct Disorders','Attention Deficit', 'Eating Disorders', 'Substance Abuse','Developmental Disorders') > dd.names.2 <- sapply(dd.names, function(x) gsub("\\s", "\\\n", x)) > barplot(dd, names.arg=dd.n

Re: [R] Barplot: Vertical bars with long labels

2008-10-29 Thread Henrique Dallazuanna
Try this: nm <- c('Conduct Disorders','Attention Deficit', 'Eating Disorders','Substance Abuse','Developmental Disorders') barplot(dd, names.arg = gsub(" ", "\n", nm)) On Wed, Oct 29, 2008 at 4:43 PM, Udo <[EMAIL PROTECTED]> wrote: > Dear List, > I need a barplot with vertical bars. Each bar sho

[R] Help with Plots

2008-10-29 Thread Alex99
Hi there, I am trying to have a connectivity graph (two plots at once) in R: this is an example: x1=sin((0:100)*2*pi/100) y1=cos((0:100)*2*pi/100) plot(x1,y1) will draw a circle and x2=c(1,9,3,4,8,4,2,0) y2=c(3,6,8,2,4,1,9,6) plot(x2,y2,type="b") will draw a graph with corresponding x's and

[R] Barplot: Vertical bars with long labels

2008-10-29 Thread Udo
Dear List, I need a barplot with vertical bars. Each bar should have a label. The problem is, that the labels are too long, so they overlap, or only every seccond label is displayed in the output. Here is a little syntax: dd <- c(100,110,90,105,95) barplot(dd,names.arg=c('Conduct Disorders','Atte

Re: [R] Suppressing internal grid in filled.contour

2008-10-29 Thread Jonathan Greenberg
Ok, I've placed the input files and the PDF on a website (I apologize for attaching the PDF -- the readme guide for this listserv indicated that PDFs were fine): http://www.cstars.ucdavis.edu/~jongreen/temp/ The full suite of commands I used are: tahoecontourdata<-read.csv("tahoedata02.csv",h

[R] ANOVA and T-test with means and SEs as imput

2008-10-29 Thread José Alberto Monteiro
Dear friends I am analysing the leaf expansion of a grass species and am interested in the speed of expansion. I produced exponential models for each of the treatments and got the equation for leaf size in function of time. I want to compare the coeficients that gives the initial inclination of the

[R] reporting interactions of factors in linear mixed effects models

2008-10-29 Thread epigone26
Hi, I have a question about how I should report the results for a linear mixed effects model where the model includes as predictors three factors (facA, facB and facC), one of which (facA) interacts with the other two. facA and facB have two levels and facC has 3 levels. There are also several oth

[R] Constrained panel linear regression

2008-10-29 Thread sara amoroso
Hi, I would like to impose an inequality constraint on one of the regression parameters of a panel linear model. How can I do that? Thanks for your help, Sara _ [[elided Hotmail spam]] [[alternative HTML version deleted]] _

[R] Installation: not creating necessary directories

2008-10-29 Thread Tim
I have tried installing R on a web server on which I have a user account but not root access. I checked and the PERL, Fortran, etc. prerequisites all seem in order. The compiling of R with: % ./configure --with-x=no This works fine without errors. I try a "make check", however, and soon get a

Re: [R] behavior of "by"

2008-10-29 Thread Jeff Laake
Again thanks for the input. I've been a recipient of this list for quite a few years although I don't post often. It is an invaluable resource and I appreciate the effort of all the contributors. I support a lot of software so I know how much work it can be. I've seen the "reproducible code

Re: [R] SAS - surveyselect in R?

2008-10-29 Thread Tobias Verbeke
Hi Markus, is there a R function or package containing a similar functionality then the SAS PROC SURVEYSELECT? I think you need the sampling package http://cran.r-project.org/web/packages/sampling/index.html It is a package accompanying the book Tillé, Y. (2006). Sampling Algorithms, New Yo

[R] Error using fitting weibull distribution to some data

2008-10-29 Thread Borja Soto Varela
Dear R-users, Using Maximum-likelihood Fitting (fitdistr function) I've got the next error: > fitdistr(datos,"weibull",lower=0) Error in optim(x = c(1.4625e-06, 0.257854, 0.0001217545, 0.11421005, 0.028721576, : L-BFGS-B *needs finite values of 'fn' * where "datos" is a vector of length=1000

Re: [R] difficulties in reading a .prn file

2008-10-29 Thread Peter Dalgaard
jim holtman wrote: > I would guess that your separator is not really a tab like you think > it is. Take a small subset of the data, bring it up in a text editor, > check the contents and then try to read it. Always start small to see > if it is working the way you think it should. Also it seem t

Re: [R] difficulties in reading a .prn file

2008-10-29 Thread Philipp Pagel
On Wed, Oct 29, 2008 at 06:19:51PM +0200, [EMAIL PROTECTED] wrote: > I am having problems in reading appropriately a huge .prn file of almost > 450.000 rows and 29 columns. The variables are consisted of characters, > dates, time, numeric values. I use read.table("file.prn", header=F, > sep="\t",

Re: [R] difficulties in reading a .prn file

2008-10-29 Thread jim holtman
I would guess that your separator is not really a tab like you think it is. Take a small subset of the data, bring it up in a text editor, check the contents and then try to read it. Always start small to see if it is working the way you think it should. Also it seem to have a header, so why are

[R] SAS - surveyselect in R?

2008-10-29 Thread Markus Schmidberger
Hello, is there a R function or package containing a similar functionality then the SAS PROC SURVEYSELECT? Thanks Markus __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-pro

[R] difficulties in reading a .prn file

2008-10-29 Thread jass
Hello, I am having problems in reading appropriately a huge .prn file of almost 450.000 rows and 29 columns. The variables are consisted of characters, dates, time, numeric values. I use read.table("file.prn", header=F, sep="\t", na.strings="*"), where the missing values are declared as "*". Th

[R] problem with "simtest"

2008-10-29 Thread Susana Zuloaga
Hello all I am working with the package multcomp but I have problems with the function simtest; the program say that can not find this function, nevertheless I doesn't have any problem with the function glht that it is in the same package. Someone knows what could be the problem? Thank you

[R] Propagate vector attributes to data frame

2008-10-29 Thread Xavier Robin
Hello, I've got a function that takes a numeric vector (x), computes a transformation value (myAttr) for x, transforms x according to myAttr and then sets myAttr as an attribute of x before returning x, so I can easily know what myAttr was used (basically it's a power transformation and myAttr is

Re: [R] strptime and strftime

2008-10-29 Thread Gabor Grothendieck
?strptime gives the percent codes and R News 4/1 has an article on dates with a table at its end containing many examples. On Wed, Oct 29, 2008 at 11:03 AM, Santosh <[EMAIL PROTECTED]> wrote: > Dear R experts.. > > I am trying to understand what exactly strptime and strftime do... > Where can I l

[R] strptime and strftime

2008-10-29 Thread Santosh
Dear R experts.. I am trying to understand what exactly strptime and strftime do... Where can I look for the detailed notes on these two functions? In addition, how POSIX functions like POSIXct and POSIXlt are used in these functions? Regards, Santosh [[alternative HTML version deleted]]

[R] Distributions Comparison REFORMULATED

2008-10-29 Thread Igor Telezhinsky
Dear all, Yes, indeed my knowledge in statistics is rather limited, but let me reformulate my question. I have two samples (V1 and V2) of measurements of observed physical values( v1_i and v2_i). Each value in the samples is measured with an error (err_i), so it is in interval (v1_i-err_i, v1_i+er

Re: [R] How to get the duplicated elements from a vector?

2008-10-29 Thread Gustaf Rydevik
On Wed, Oct 29, 2008 at 3:45 PM, Erik Iverson <[EMAIL PROTECTED]> wrote: > > > Leon Yee wrote: >> >> Gustaf Rydevik wrote: >>> Hi Leon, >>> >>> unique(x) >>> >>> or >>> >>> duplicated(x) >>> >>> should work, depending on what you want. >>> >>> Best, >>> >>> Gustaf >>> >> >> Hi, >>Thank you all.

[R] Help with impute.knn

2008-10-29 Thread Jianying Li
ear all, This is my first time using this listserv and I am seeking help from the expert. OK, here is my question, I am trying to use impute.knn function in impute library and when I tested the sample code, I got the error as followingt: Here is the sample code: library(impute) data(khanmiss

Re: [R] How to get the duplicated elements from a vector?

2008-10-29 Thread Erik Iverson
Leon Yee wrote: > > Gustaf Rydevik wrote: >> Hi Leon, >> >> unique(x) >> >> or >> >> duplicated(x) >> >> should work, depending on what you want. >> >> Best, >> >> Gustaf >> > > Hi, >Thank you all. Actually, I have a data frame or matrix, whose first > column is numerical values, and whose 2

Re: [R] How to get the duplicated elements from a vector?

2008-10-29 Thread Jorge Ivan Velez
Dear Leon, It's not the most efficient way but it works. Hopefully someone else will come up with another approach. Here a toy example: 1. calculate the mean for each name in your second column by using tapply or others, 2. determinate which names are repeated >= 2 times, 3. match the names of the

Re: [R] How to get the duplicated elements from a vector?

2008-10-29 Thread Leon Yee
Gustaf Rydevik wrote: Hi Leon, unique(x) or duplicated(x) should work, depending on what you want. Best, Gustaf Hi, Thank you all. Actually, I have a data frame or matrix, whose first column is numerical values, and whose 2nd column is names. I need those whose names repeated 3 tim

Re: [R] How to get the duplicated elements from a vector?

2008-10-29 Thread Gustaf Rydevik
On Wed, Oct 29, 2008 at 2:47 PM, Leon Yee <[EMAIL PROTECTED]> wrote: > Dear all, > >How can I get the duplicated elements from a vector? For example, > x <- c("yes", "no", "yes", "yes", "no", "not sure"), how can I filter out > all the elements which occured >=2 times? > >Thanks for any hel

Re: [R] How to get the duplicated elements from a vector?

2008-10-29 Thread Dimitris Rizopoulos
check duplicated(), e.g., x <- c("yes", "no", "yes", "yes", "no", "not sure") x[duplicated(x)] I hope it helps. Best, Dimitris Leon Yee wrote: Dear all, How can I get the duplicated elements from a vector? For example, x <- c("yes", "no", "yes", "yes", "no", "not sure"), how can I filt

Re: [R] builtin to filter a list?

2008-10-29 Thread Whit Armstrong
?Filter ... how did I miss that one? Thanks, Gabor. -Whit On Wed, Oct 29, 2008 at 9:37 AM, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Try: > > ?Filter > > e.g. > > Filter(function(x) x > 0, x1) > > or using gsubfn's fn > > library(gsubfn) > fn$Filter(~ x > 0, x1) > > > On Wed, Oct 29, 20

Re: [R] How to get the duplicated elements from a vector?

2008-10-29 Thread Jorge Ivan Velez
Dear Leon, Perhaps: x <- c("yes", "no", "yes", "yes", "no", "not sure") names(table(x))[table(x)>=2] HTH, Jorge On Wed, Oct 29, 2008 at 9:47 AM, Leon Yee <[EMAIL PROTECTED]> wrote: > Dear all, > >How can I get the duplicated elements from a vector? For example, > x <- c("yes", "no", "ye

[R] How to get the duplicated elements from a vector?

2008-10-29 Thread Leon Yee
Dear all, How can I get the duplicated elements from a vector? For example, x <- c("yes", "no", "yes", "yes", "no", "not sure"), how can I filter out all the elements which occured >=2 times? Thanks for any help! Regards, Leon __ R-help@r-p

Re: [R] Recommended R books by XLSolutions Corporation

2008-10-29 Thread Marc Schwartz
Peter Dalgaard wrote: >> Drats!! I almost thought that you had gotten a hold on the elusive >> problem of estimating the population of R users I suspect that the Higgs Boson will be observed well before we get reasonable estimates on that figure...just need to get the LHC back online... ;-)

Re: [R] builtin to filter a list?

2008-10-29 Thread Gabor Grothendieck
Try: ?Filter e.g. Filter(function(x) x > 0, x1) or using gsubfn's fn library(gsubfn) fn$Filter(~ x > 0, x1) On Wed, Oct 29, 2008 at 9:06 AM, Whit Armstrong <[EMAIL PROTECTED]> wrote: > I know it's easy to write a simple loop to do this, but in the spirit > of lapply, I thought I would ask i

[R] how to restrict a parameter in optim()

2008-10-29 Thread Luis SAGAON TEYSSIER
Dear all, I'm trying to estimate some parameters with the optim() function but I need to restrict one parameter and I have not found how to do it. Could you help me please? my program is basically fn<-function(s) initial<-function(r) { cst<-r[1] cst1<-r[2] beta<-r[3] rho<-r[4] p1<-r[5] r

[R] Selecting cases for a grouping value to refill x and y vectors

2008-10-29 Thread Leif Peterson
The variable "iter" from read.table takes on values of 0,5,10,15, and 20. I am trying to pick off values of iter by assigning it to "grp", and e.g. iter<-5, then fill the x and y vectors and make plots of x,y for each value of iter (>0) For some reason all of the plots are the same, so I am not

[R] problem with impute.knn

2008-10-29 Thread Jianying Li
Dear all, This is my first time using this listserv and I am seeking help from the expert. OK, here is my question, I am trying to use impute.knn function in impute library and when I tested the sample code, I got the error as followingt: Here is the sample code: library(impute) data(khanmis

Re: [R] Pkg rgl: installation fails because of x11

2008-10-29 Thread Matthieu Stigler
Dear Duncan, Ben and Megha Thank you for your help! I tried sudo apt-get build-dep r-cran-rgl And so all necessitated package were installed and I could install rgl.. nice! Mat I believe the correct incantation is: sudo apt-get build-dep r-cran-rgl If that doesn't work, get back to us

Re: [R] Incorrect order

2008-10-29 Thread Alain Guillet
Hi, I believe Bart answered to your question. What is the solution you are expecting? If you don't give us more explanations we cannot understand what is wrong for you. > help(sort) |order| returns a permutation which rearranges its first argument into ascending or descending order, breaking

Re: [R] Incorrect order

2008-10-29 Thread ONKELINX, Thierry
Laura, Order works fine. The output tells you that the third element of a is the smallest, the first element is a second smallest, ... Try a[order(a)] that should be equal to sort(a). HTH, Thierry ir. Thierry Onkelin

Re: [R] Recommended R books by XLSolutions Corporation

2008-10-29 Thread Mitchell Maltenfort
I thought R users were measured in fractal dimensions...or is that fractious? On Wed, Oct 29, 2008 at 4:06 AM, Detlef Steuer <[EMAIL PROTECTED]> wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > >> > >> > This is the bit where I get stuck. >> >> Drats!! I almost thought that you had got

[R] Incorrect order

2008-10-29 Thread lll73
I am using the order function and the result seems to be incorrect: > a<-c(20,30,15,40) > order(a) [1] 3 1 2 4 Any suggestions? Thanks, Laura -- View this message in context: http://www.nabble.com/Incorrect-order-tp20224993p20224993.html Sent from the R help mailing list archive at Nabble.c

Re: [R] Recommended R books by XLSolutions Corporation

2008-10-29 Thread Detlef Steuer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 > > > > This is the bit where I get stuck. > > Drats!! I almost thought that you had gotten a hold on the elusive > problem of estimating the population of R users > We are legion! :-) I admit: that doesn't help with calculations ... Detlef

[R] builtin to filter a list?

2008-10-29 Thread Whit Armstrong
I know it's easy to write a simple loop to do this, but in the spirit of lapply, I thought I would ask if there is a builtin to filter or take a subset of a list based on a predicate in a similar way to the Erlang lists:filter/2 function: http://www.erlang.org/doc/man/lists.html#filter-2 filter(P

[R] maximum device size

2008-10-29 Thread Nishan Sugathadasa
Hi, I would like to know how to get the maximum possible values that can be used for the dimensions of a device, For example windows(h=,w=), what are the maximum values that I can pass as parameters for w and h. environment info: platform: Windows XP SP2 R version: 2.7.1 Thanks Nishan Sugat

[R] sessionInfo() error

2008-10-29 Thread Michael Friendly
[Using R 2.7.2 on Windows XP] After re-building our heplots package, I've begun to get the following error from sessionInfo(), even though it passes R CMD check and builds without errors: > sessionInfo() Error in x$Priority : $ operator is invalid for atomic vectors In addition: Warning message

Re: [R] R rockie

2008-10-29 Thread John Kane
For a good, extemely basic, tutorial see http://www.math.ilstu.edu/dhkim/Rstuff/Rtutor.html You might also want to have a look at http://zoonek2.free.fr/UNIX/48_R/all.html If you are familiar with SPSS or SAS then Bob Muenchen's paper in PDF form http://oit.utk.edu/scc/RforSAS&SPSSusers.pdf (

Re: [R] help with doing a manipulation on a column of a data frame based on another column

2008-10-29 Thread joris meys
> #this is my stab at - I am sure that I am missing something. If this > doesn't make sense then please ask for more details. #This may show > my low level of programing knowledge > > hester. <- c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4) > value <- rnorm(16) > x <- data.frame(value, hester.) > > z <- > (

Re: [R] Help using tapply with multiple variables

2008-10-29 Thread Dimitris Rizopoulos
try this: lapply(split(dat, dat$country), function (x) { pres.test(x$pop1995, x$pop2000) }) I hope it helps. Best, Dimitris Corey Sparks wrote: Dear list, I have the function (as a simple example, which is actually part of a larger function) pres.test<-function(N0=N0, N1=N1) { dt<

Re: [R] Help using tapply with multiple variables

2008-10-29 Thread Henrique Dallazuanna
Try this: split(mapply(function(x, y)pres.test(x, y), DF$pop1995, DF$pop2000), DF$country) On Wed, Oct 29, 2008 at 10:19 AM, Corey Sparks <[EMAIL PROTECTED]>wrote: > Dear list, > I have the function (as a simple example, which is actually part of a > larger function) > > pres.test<-function(N0=N

[R] problem with tune.rpart()

2008-10-29 Thread Claudio Conversano
Dear useRs, I am using the function tune.rpart() implemented in the e1071 package under R 2.7.1 on Windows XP. Sometimes, i.e., for some datasets, I get the following error: > tune.rpart(dataset, data = dataset, cp = c(.005,.01,.02)) > Error in table(pred, true.y) : all arguments must hav

[R] Help using tapply with multiple variables

2008-10-29 Thread Corey Sparks
Dear list, I have the function (as a simple example, which is actually part of a larger function) pres.test<-function(N0=N0, N1=N1) { dt<-5 r<-log(N1/N0)/dt r } which calculates the annual growth rates in a population Where N0 is the population classified into age intervals, say

Re: [R] R rockie

2008-10-29 Thread Steve_Friedman
Paul, Look for the An Introduction to R on the CRAN - R web site. The latest version, as far as I know, is Version 2.7.2 (2008-08-25). You might also want to examine the R Data Import/Export doc Both can be found here : http://cran.r-project.org/doc/manuals.html Steve Steve Friedman Ph. D. Sp

Re: [R] How to set read.table variables to vectors?

2008-10-29 Thread jim holtman
'xin' is an element of a dataframe and you must explicity reference it as such. See the Intro to R. plot(mydata$xin, mydata$yin) On Wed, Oct 29, 2008 at 4:29 AM, Leif Peterson <[EMAIL PROTECTED]> wrote: > The summary stats for the xin and yin variables below are correct. However, > if I use plo

Re: [R] Incorrect order

2008-10-29 Thread bartjoosen
What's wrong with that result? you should look at the result as: first take the 3th element of a, then the first one, than the second one and then the fourth. if you do a[order(a)] then you get 15,20,30,40. I suppose you expected: rank(a) [1] 2 3 1 4 Good luck Bart lll73 wrote: > > > I am

Re: [R] Suppressing internal grid in filled.contour

2008-10-29 Thread Dieter Menne
Jonathan Greenberg ucdavis.edu> writes: > ..faint internal grid when running the following command to make a > filled contour plot of some data I have (x,y,z being the inputs): > > filled.contour(interp(x,y,z,duplicate="strip", xo=seq(1800,3200,length=57), yo=seq(120,280,length=65)), col=grey.

  1   2   >