Re: [R] Parsing unusual date format

2008-12-17 Thread Phil Spector
You can use regular expressions: as.Date(sub('(\\d+)m(\\d+)','\\1-\\2-01',dts,perl=TRUE)) but as.Date isn't as inflexible as you think: as.Date(paste(dts,'m01',sep=''),'%Ym%mm%d') - Phil Spector Statistical Computing

[R] Predict

2008-12-17 Thread Ricardo L Gómez
Dear Cristopher, I have a question and hope you may help me...I designed a model with a data set, the model Call: lm(formula = outcom ~ vari1 + vari2 + dummy1 + dummy2) Residuals: Min 1Q Median 3Q Max -0.7090 -0.2648 0.1466 0.2167 0.7513 Coefficients: Estimate Std. Error t value Pr(>|t|) (In

Re: [R] PREDICT NEW VALUES FROM REGRESSION MODEL, EST. ST.ERROR, AND CI

2008-12-17 Thread Paul Teetor
First, package the new values of your predictor variables into a data frame: data.frame(VAR1=8, VAR2=64) Then, use the predict() method to apply the model to the predictor values: predict(model, newdata=data.frame(VAR1=8, VAR2=64)) Finally, tell the predict() method that these are

Re: [R] Parsing unusual date format

2008-12-17 Thread markleeds
hi: i tried regular expressions and , as usual, failed. but below does do the job uglily using strsplit. i'd still be curious and appreciate if someone could do the regular expression method. thanks. dts <- c("1990m12", "1992m8") #March 1990 and Aug 1992 #SPLIT IT USING m temp <- strsplit(dts,

[R] Parsing unusual date format

2008-12-17 Thread Shruthi Jayaram
Hello, If I have a character string like d <- c("1990m3", "1992m8") #March 1990 and Aug 1992 what is the easiest way to convert it into any standard date form; for example, d <- c("01/03/1990", "01/08/1992") I looked at as.Date but it doesn't seem to address my problem as I have an "m" stuck

Re: [R] Add a string to each string of an array

2008-12-17 Thread Gabor Grothendieck
Your question has already been answered but as an aside note that the zoo package has a yearqtr class that can be helpful when dealing with quarterly dates. On Wed, Dec 17, 2008 at 10:25 AM, Boriss wrote: > Dear all, > > I have an array of strings > > a <- c("2008q3","2005q1","2004q3") > > I woul

Re: [R] replacing elements of a zoo object

2008-12-17 Thread Gabor Grothendieck
Remove the comma in the line with the error. On Wed, Dec 17, 2008 at 11:24 AM, wrote: > Dear R Users, > > I am trying to do something quite simple: replace the elements of a zoo > object. For some reason, the following code does not seem to work. How can > I replace the value for the 14th of Dec

Re: [R] Trouble pulling data from a messy ACII file...

2008-12-17 Thread Gabor Grothendieck
Its not clear what the result would be but you may be able to use read.table. Try this: Lines <- "19 c:/data/WF-100/2008/20080911/trk/20080911.013115.007.17.txt 10 s name of program that wrote this file trkplt name of program that wrote this file 10 GORDON machine that generated this file

Re: [R] [Rd] "Error: bad value" problem

2008-12-17 Thread Duncan Murdoch
On 17/12/2008 9:47 PM, Duncan Murdoch wrote: On 17/12/2008 8:56 PM, Peter Dalgaard wrote: Ben Bolker wrote: I can get the errors to happen on Ubuntu 8.10 with R --vanilla (*without* valgrind) -- but editing momfit.r line 742 so that plot.progress=FALSE seems to make the problem go away. (Thi

Re: [R] [Rd] "Error: bad value" problem

2008-12-17 Thread Duncan Murdoch
On 17/12/2008 8:56 PM, Peter Dalgaard wrote: Ben Bolker wrote: I can get the errors to happen on Ubuntu 8.10 with R --vanilla (*without* valgrind) -- but editing momfit.r line 742 so that plot.progress=FALSE seems to make the problem go away. (This was a lucky guess, it looked like there was

Re: [R] "Error: bad value" problem

2008-12-17 Thread Peter Dalgaard
Ben Bolker wrote: I can get the errors to happen on Ubuntu 8.10 with R --vanilla (*without* valgrind) -- but editing momfit.r line 742 so that plot.progress=FALSE seems to make the problem go away. (This was a lucky guess, it looked like there was something odd going on with the plots.) Ho

Re: [R] "Error: bad value" problem

2008-12-17 Thread Ben Bolker
I can get the errors to happen on Ubuntu 8.10 with R --vanilla (*without* valgrind) -- but editing momfit.r line 742 so that plot.progress=FALSE seems to make the problem go away. (This was a lucky guess, it looked like there was something odd going on with the plots.) Hope that helps someo

Re: [R] Construct All Possible Strings from 4 Bases (ATCG)

2008-12-17 Thread Ben Bolker
Gundala Viswanath wrote: > > Dear Ivar, > > How can I extend the limit of "n" size? > > When I tried this function with n>= 15, it fails: > >> f <- function(bases, n){apply(expand.grid(rep(list(bases),n)), 1, paste, >> collapse="")} >> f(c("A", "T", "C", "G"), 15) > Error in rep.int(rep.int

Re: [R] Newbie "if" problem

2008-12-17 Thread Erik Iverson
glenn roberts wrote: I have got a general problem when applying a function to a dataframe using the function; Apply(df,1,myfunct) Do you mean "apply"? Or does the "Aaply" function come from a separate package? Where myfunct has an IF statement in it along the lines of; If (z == 0) X

[R] Newbie "if" problem

2008-12-17 Thread glenn roberts
I have got a general problem when applying a function to a dataframe using the function; Apply(df,1,myfunct) Where myfunct has an IF statement in it along the lines of; If (z == 0) X = 1 If (z ==0) Z = 1 I.e. Two If statements Is there something I am missing or have a just formed the if statem

Re: [R] Construct All Possible Strings from 4 Bases (ATCG)

2008-12-17 Thread Gundala Viswanath
Dear Ivar, How can I extend the limit of "n" size? When I tried this function with n>= 15, it fails: > f <- function(bases, n){apply(expand.grid(rep(list(bases),n)), 1, paste, > collapse="")} > f(c("A", "T", "C", "G"), 15) Error in rep.int(rep.int(seq_len(nx), rep.int(rep.fac, nx)), orep) :

Re: [R] "Error: bad value" problem

2008-12-17 Thread Peter Dalgaard
Peter Dalgaard wrote: Rolf Turner wrote: On 18/12/2008, at 11:34 AM, Richard E. Chandler wrote: Dear R-help, Like several other subscribers, I have recently encountered a problem whereby R will execute code apparently correctly and without error, but any subsequent command will yield "Error:

Re: [R] "Error: bad value" problem

2008-12-17 Thread Rolf Turner
On 18/12/2008, at 1:09 PM, Peter Dalgaard wrote: Rolf Turner wrote: I can confirm that the error occurs. I downloaded the files and sourced ``ErrorDemo.R''. Doing x <- rnorm(10) after doing so triggered the error. Subsequently attempting traceback() (or anything else) simply

Re: [R] "Error: bad value" problem

2008-12-17 Thread Duncan Murdoch
On 17/12/2008 5:34 PM, Richard E. Chandler wrote: Dear R-help, Like several other subscribers, I have recently encountered a problem whereby R will execute code apparently correctly and without error, but any subsequent command will yield "Error: bad value" so that R has to be killed and rest

Re: [R] "Error: bad value" problem

2008-12-17 Thread Peter Dalgaard
Rolf Turner wrote: On 18/12/2008, at 11:34 AM, Richard E. Chandler wrote: Dear R-help, Like several other subscribers, I have recently encountered a problem whereby R will execute code apparently correctly and without error, but any subsequent command will yield "Error: bad value" so that R h

Re: [R] "Error: bad value" problem

2008-12-17 Thread Rolf Turner
On 18/12/2008, at 11:34 AM, Richard E. Chandler wrote: Dear R-help, Like several other subscribers, I have recently encountered a problem whereby R will execute code apparently correctly and without error, but any subsequent command will yield "Error: bad value" so that R has to be killed and

Re: [R] model.tables error from aov

2008-12-17 Thread John Vokey
In addition, your model statement is odd. Note that within-S factor Type is tested with both the type I and the type II residuals, whereas only the latter should be used. Try this model instead: aov.errs.ae <- aov(TrainErrs ~ idio*Type + Error(Subject/ Type),data=learnDat.ae) or, for mor

Re: [R] Noobie question, regression across levels

2008-12-17 Thread AllenL
This is what I ended up using: Data.subset<-data.frame(PlotFinal,YearFinal,BioFinal,ritFinal) ###Subset of main dataset Data.length<-sapply(split(Data.subset,PlotFinal),nrow) ### The number of data points in each plot Data.sub<-split(Data.subset,PlotFinal) ##Split Data.subset

[R] "Error: bad value" problem

2008-12-17 Thread Richard E. Chandler
Dear R-help, Like several other subscribers, I have recently encountered a problem whereby R will execute code apparently correctly and without error, but any subsequent command will yield "Error: bad value" so that R has to be killed and restarted. We have checked this out with a few differe

Re: [R] non numeric argument to binary operator

2008-12-17 Thread Sarah Goslee
I'm not sure what you are trying to do: modulo arithmetic isn't exactly splitting a matrix into 2. Or even remotely. Regardless of the goal, when numbers are shown in quotes, it's a sure sign that R thinks they are strings, and thus non-number, just as the error message (not a warning) states. To

[R] non numeric argument to binary operator

2008-12-17 Thread Baurzhan Aituov
hi i have a huge matrix and want to split it into 2. with the command %%2. but i get this warning message: *"Error in mmat%%2 : non-numeric argument to binary operator*" here's the bit from my matrix: V1 V2 [1,] "Affymetrix:CompositeSequence:ATH1-

Re: [R] "Dotted lines at the end of the KM-curve"

2008-12-17 Thread Terry Therneau
> Referees demand that the line in the KM-curve should be changed to > dotted at the point where standarerror is <= 10 %. I don't think it's > a good habit but I urgently need to implement such a thing in R with > survfit, survplot or another program. They also want numbers at risk > below the cu

[R] Noobie question, regression across levels

2008-12-17 Thread AllenL
NB: Not reply needed (Ben was extremely helpful!) I've just started using R last week and am still scratching my head. I have a data set and want to run a separate regression across each level of a factor (treating each one separately). The data right now is arranged such that the value of the f

Re: [R] glmnet : Error in validObject(.Object) :

2008-12-17 Thread Jorge Ivan Velez
Dear Hao, It works for me. Here is my sessionInfo(): > sessionInfo() R version 2.8.0 Patched (2008-11-08 r46864) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

Re: [R] Trouble pulling data from a messy ACII file...

2008-12-17 Thread Charles C. Berry
On Wed, 17 Dec 2008, Titan8883 wrote: Hi all, I am a new graduate student who is also new to R. I am ok with the basics, but the problem I am having right now seems beyond what I can do..so I am looking for advice. Advice? OK. Here goes. I would suggest you pull one of the data files into

[R] glmnet : Error in validObject(.Object) :

2008-12-17 Thread Hao
Could any one help ? I start to learn the glmnet package. I tried with the example in the manual. x=matrix(rnorm(100*20),100,20) y=rnorm(100) fit1=glmnet(x,y) When I tried to fit the model, I received the error message: Error in validObject(.Object) : invalid class "dgCMatrix" object: row in

Re: [R] Shrink Trellis margins settings (when printed to png file)

2008-12-17 Thread Deepayan Sarkar
On Wed, Dec 17, 2008 at 8:11 AM, Mark Heckmann wrote: > Dear R-experts, > > I have two problems: > > PROBLEM (1) > --- > > I want to produce a very small png file (35 x 18 px) that contains a > histogram without a figure region or margins, only the pure heights. > In the base graphic syste

Re: [R] Problems with graphical devices, e.g., png(), pdf(): blurry graphical output

2008-12-17 Thread Y-H Chen
On Wed, Dec 17, 2008 at 3:06 AM, Martyn Plummer wrote: > The artefacts that you see are a normal result of using bitmap graphics > devices. I have tried to explain these below: Thanks very much for your explanations, MP; they were quite informative!! I recognize that others may feel differently

Re: [R] passing arguments to subset from a function

2008-12-17 Thread Vitalie S.
On Wed, 17 Dec 2008 20:07:08 +0100, GOUACHE David wrote: argument which I will pass on to subset() somewhere inside my function. I would use the example of .() function from plyr package in this case: .<-function (...){ structure(as.list(match.call()[-1]), class = "quoted") } myfuncti

Re: [R] Trouble pulling data from a messy ASCII file...

2008-12-17 Thread Titan8883
The output I would be looking for would be one row for each data file with columns for each variable, so using a .csv example with a few variables would be: - File_name,date_written,program_ver,data_file_ver,bin_width 20080911

Re: [R] Trouble pulling data from a messy ASCII file...

2008-12-17 Thread jim holtman
It would be helpful if you could show what the output would be for the example given. Exactly what are 'values' and what would be the 'headings'. As mentioned before, you can use readLines and then parse the data you want, but something like Perl might be easier, but it is hard to tell from the m

Re: [R] passing arguments to subset from a function

2008-12-17 Thread iverson
This thread may help? https://stat.ethz.ch/pipermail/r-help/2007-November/145345.html On Wed, 17 Dec 2008 20:07:08 +0100, "GOUACHE David" wrote: > Hello R-helpers, > > I'm writing a long function in which I manipulate a certain number of > datasets. I want the arguments of said function to allo

Re: [R] Trouble pulling data from a messy ASCII file...

2008-12-17 Thread Sarah Goslee
I usually use Unix tools to process really data beforehand (sed, awk), but if you want a pure R solution it is usually possible to kludge something together with scan() working line by line. # read a line # if it contains stuff you aren't interested in, go on to the next line # if it contains one

Re: [R] passing arguments to subset from a function

2008-12-17 Thread baptiste auguie
I wrote a dirty hack last time I faced this problem, I'll be curious to see what is the proper way of dealing with the scoping and evaluation rules. library(datasets) myfunction<-function(table, extraction) { table2<-subset(table,extraction) return(table2) } condition1 <- quote(iris$S

[R] Trouble pulling data from a messy ASCII file...

2008-12-17 Thread Titan8883
Hi all, I am a new graduate student who is also new to R. I am ok with the basics, but the problem I am having right now seems beyond what I can do..so I am looking for advice. I am trying to pull data from flat ASCII files, but they do not have a "nice" structure so a simple "read.table" doesn't

Re: [R] passing arguments to subset from a function

2008-12-17 Thread David Winsemius
Available free for the typing are the functions for the default and the dataframe methods of subset: > subset.default function (x, subset, ...) { if (!is.logical(subset)) stop("'subset' must be logical") x[subset & !is.na(subset)] } > subset.data.frame function (x, subset, se

[R] R2winbugs : vectorization

2008-12-17 Thread Philip A. Viton
Many thanks to all responders. It turns out that there is a winbugs update available, which defines a new version of inprod, inprod2. Using inprod2 the vectorized code runs in about the same time as the "scalar" version. On the print problem: the issue here turns out to be that the arm pack

[R] passing arguments to subset from a function

2008-12-17 Thread GOUACHE David
Hello R-helpers, I'm writing a long function in which I manipulate a certain number of datasets. I want the arguments of said function to allow me to adapt the way I do this. Among other things, I want my function to have an argument which I will pass on to subset() somewhere inside my functio

Re: [R] Plot multiple lines, same plot, different axes?

2008-12-17 Thread Rolf Turner
On 18/12/2008, at 4:52 AM, zack holden wrote: Dear list, I would like to plot 2 series of numbers with very different ranges/ scales as lines on the same plot. I assumed this is commonly done and easy, but I have not found any help files (e.g. axis() or matplot() that show how. I've sear

Re: [R] Yet another set of codes to optimize

2008-12-17 Thread William Dunlap
> [R] Yet another set of codes to optimize > Daren Tan daren76 at hotmail.com > Fri Dec 5 03:41:23 CET 2008 > > I have problems converting my dataset from long to wide format. Previous > attempts using reshape package and aggregate function were unsuccessful > as they took too long. Apparently, my

Re: [R] Plot multiple lines, same plot, different axes?

2008-12-17 Thread Ben Bolker
zackfire wrote: > > > Dear list, > > I would like to plot 2 series of numbers with very different ranges/scales > as lines on the same plot. I assumed this is commonly done and easy, but I > have not found any help files (e.g. axis() or matplot() that show how. > I've searched many old posts

Re: [R] replacing elements of a zoo object

2008-12-17 Thread Henrique Dallazuanna
Try this: x[index(x) == as.Date("2008-12-14")] <- 1 x On Wed, Dec 17, 2008 at 2:24 PM, wrote: > Dear R Users, > > I am trying to do something quite simple: replace the elements of a zoo > object. For some reason, the following code does not seem to work. How can > I replace the value for the

Re: [R] Problem with ggplot2

2008-12-17 Thread ts8
I'm also getting this error with ggplot2_0.8.1 on winXP with R 2.8.0 and R 2.7.1. hadley wrote: > > Hi David, > > I inadvertently introduced a bug in ggplot in the last release. I > uploaded a fix to CRAN this morning and it should be available in the > near future. Sorry for the inconveni

[R] Shrink Trellis margins settings (when printed to png file)

2008-12-17 Thread Mark Heckmann
Dear R-experts, I have two problems: PROBLEM (1) --- I want to produce a very small png file (35 x 18 px) that contains a histogram without a figure region or margins, only the pure heights. In the base graphic system this is simple: png(filename = "hist.png", res = 72, width=35, hei

[R] Plot multiple lines, same plot, different axes?

2008-12-17 Thread zack holden
Dear list, I would like to plot 2 series of numbers with very different ranges/scales as lines on the same plot. I assumed this is commonly done and easy, but I have not found any help files (e.g. axis() or matplot() that show how. I've searched many old posts to no avail. I'll be very gra

Re: [R] OT: (quasi-?) separation in a logistic GLM

2008-12-17 Thread Grant Izmirlian
Gavin: I think its important to point out two probably obvious things (1) the dataset is very imbalanced...we have an overabundance of 'analogs==FALSE' roughly 94% of the data. If we think of a purely non-parametric test of equality of the underlying CDF's then we have alot of confidence in F0

Re: [R] Plotting regression lines and points from lm using lattice

2008-12-17 Thread Deepayan Sarkar
On 12/17/08, Javier PB wrote: > > Dear R-users, > > Sorry if someone came out with a similar question but after one day of > searching I am giving up: > > Does anyone know how to plot the original points used in a lm model and the > set of resulting regression lines generated by the model? >

Re: [R] win.graph question

2008-12-17 Thread Duncan Murdoch
On 12/17/2008 12:27 PM, Kirk Wythers wrote: I have what I hope is a ridiculously simple question. I am trying to follow an example that uses the function win.graph(), but my machine does not recognize win.graph(). I am running R 2.8.0 on OS X. Is there some OS X specific function that replac

[R] win.graph question

2008-12-17 Thread Kirk Wythers
I have what I hope is a ridiculously simple question. I am trying to follow an example that uses the function win.graph(), but my machine does not recognize win.graph(). I am running R 2.8.0 on OS X. Is there some OS X specific function that replaces win.graph or am I missing some package?

Re: [R] replacing elements of a zoo object

2008-12-17 Thread stephen sefick
If this were copy and paste-able then I could probably give you a solution, but I would have a look at ?coredata On Wed, Dec 17, 2008 at 11:24 AM, wrote: > Dear R Users, > > I am trying to do something quite simple: replace the elements of a zoo > object. For some reason, the following code do

Re: [R] using dvi with latex object: directory not correctly set, maybe due to error in shQuote()

2008-12-17 Thread Willner, Marco
Dear Bernhard You were right, pushing my knowledge about R once again to the next level! Sys.getenv("R_SHELL") indeed returns "". The fix you are proposing works for me. If I am right, your function dvi.latex2 makes use of shell rather than of sys in the original function dvi.latex and stores r

[R] replacing elements of a zoo object

2008-12-17 Thread tolga . i . uzuner
Dear R Users, I am trying to do something quite simple: replace the elements of a zoo object. For some reason, the following code does not seem to work. How can I replace the value for the 14th of Dec of 2008 in the zoo object x below with 1 (it is currently NA). > x 2008-12-11 2008-12-12 2008

Re: [R] PREDICT NEW VALUES FROM REGRESSION MODEL, EST. ST.ERROR, AND CI

2008-12-17 Thread Greg Snow
?predict.lm -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Ricardo Gomez > Sent: Wednesday, December 17, 2008

Re: [R] Model building using lmer

2008-12-17 Thread ONKELINX, Thierry
Dear Luciano, The "1" in (1|NestID) indicates only a random intercept. Note that in most models in R, a "1" on the righthandside of the formula indicates the intercept, "-1" or "0" indicates no intercept. ~X, which is equivalent to ~X + 1, indicates a slope along X and an intercept. Hence a random

[R] PREDICT NEW VALUES FROM REGRESSION MODEL, EST. ST.ERROR, AND CI

2008-12-17 Thread Ricardo Gomez
Greetings, I'd be grateful if a good Samaritan helps me to approach this problem with my data, I've created the following model lm(formula = OUTCOME ~ VAR1 + VAR2) summary(model) Call: lm(formula = OUTCOME ~ VAR1 + VAR2) Residuals: Min 1Q Median 3Q Max -1.4341 -0.3621 0.1879 0.

Re: [R] Add a string to each string of an array

2008-12-17 Thread Jorge Ivan Velez
Hi Boris, Yes. Try this: paste('IMT',a,sep="") See ?paste. HTH, Jorge On Wed, Dec 17, 2008 at 10:25 AM, Boriss wrote: > Dear all, > > I have an array of strings > > a <- c("2008q3","2005q1","2004q3") > > I would like to add to each a[i], with i = 1,2,3 > > the following string "IMT", > > s

[R] Add a string to each string of an array

2008-12-17 Thread Boriss
Dear all, I have an array of strings a <- c("2008q3","2005q1","2004q3") I would like to add to each a[i], with i = 1,2,3 the following string "IMT", such that in the end I could get b <- c("IMT2008q3","IMT2005q1","IMT2004q3") Is it possible to accomplish this without a loop command? Thank

Re: [R] using dvi with latex object: directory not correctly set, maybe due to error in shQuote()

2008-12-17 Thread Pfaff, Bernhard Dr.
Hello Marco, as might not be evident at first sight, but have you set the environment variable "R_SHELL"? If you spot at the dvi method for latex you will find a call to sys(), which will call shell() and if the argument shell is unset then the contents of "R_SHELL" will be used. Hence, what do

Re: [R] Confidence intervals of log transformed data

2008-12-17 Thread Greg Snow
The boxcox function in the MASS package computes these intervals. If you want to see how it computes the interval you can look at the source code. MASS the book also describes the general process. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcar

Re: [R] surface contour plot help

2008-12-17 Thread Greg Snow
Look at rotate.wireframe in the TeachingDemos package. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On

[R] Model building using lmer

2008-12-17 Thread Luciano La Sala
Dear R-experts, Quite new to R on this end, but learning fast (I hope). I am running version 2.7.1 on Windows Vista. I have small dataset which consists of: # NestID: nest indicator for each chicken. Siblings sharing the same nest have the same nest indicator. # Chick: chick indicator consis

Re: [R] Confidence intervals of log transformed data

2008-12-17 Thread Eoin Barry
Hello, I was wondering if you could tell me how to calculate 95% confidence intervals for lambda for a box-cox power transformation. Best wishes Eoin [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.et

Re: [R] Noobie question, regression across levels

2008-12-17 Thread Ben Bolker
AllenL wrote: > > Much thanks! This helped a lot. Another quick one: > In using the lmList function in the nlme package, is it possible to subset > my data according to the number of observations in each level? (ie. I > obviously want to include only those levels in which the observations are >

[R] bug (?!) in "pam()" clustering from fpc package ?

2008-12-17 Thread Tal Galili
Hello all. I wish to run k-means with "manhattan" distance. Since this is not supported by the function "kmeans", I turned to the "pam" function in the "fpc" package. Yet, when I tried to have the algorithm run with different starting points, I found that pam ignores and keep on starting the algori

[R] Plotting regression lines and points from lm using lattice

2008-12-17 Thread Javier PB
Dear R-users, Sorry if someone came out with a similar question but after one day of searching I am giving up: Does anyone know how to plot the original points used in a lm model and the set of resulting regression lines generated by the model? This is how I do it using the "plot" and "lines" f

Re: [R] odfWeave learning resources

2008-12-17 Thread Max Kuhn
> In general I try not to post questions to forums until I've tried my best to > read about them in the available documentation. I recently undertook a > project that used odfWeave and have been very pleased with the package. > But, the R help documentation suggests that there are more sophisticat

Re: [R] R function to calculate number of data points of each level

2008-12-17 Thread Philipp Pagel
On Wed, Dec 17, 2008 at 02:09:57PM +0100, Philipp Pagel wrote: > or maybe > > ggregate(foo$V1, by=list(foo$V1), FUN=length) Oops- that was supposed to be 'aggegate'... -- Dr. Philipp Pagel Lehrstuhl für Genomorientierte Bioinformatik Technische Universität München Wissenschaftszentrum Weihens

Re: [R] R function to calculate number of data points of each level

2008-12-17 Thread Philipp Pagel
On Wed, Dec 17, 2008 at 03:36:44AM -0800, RON70 wrote: > > I have a dataframe with two columns : > > 11600 238'4 > 12000 218'0 [...] > There are repeatations in 1st column and I want to use this as Level. Next I > want to report for each level how many data points are there, with > corresponding

Re: [R] Find all numbers in a certain interval

2008-12-17 Thread Antje
Thanks a lot for every answer I got! I could solve my problem! Greg, your proposal seems to be quite useful for me :-) Thank you. Ciao, Antje Antje schrieb: Hi all, I'd like to know, if I can solve this with a shorter command: a <- rnorm(100) which(a > -0.5 & a < 0.5) # would give me all

Re: [R] Prediction intervals for zero inflated Poisson regression

2008-12-17 Thread ONKELINX, Thierry
Dear Achim, Thanks for the script. It works fine except it sometimes yields extreme wide confidence intervals. That is for a factor level with only a few replications or a level with all zeros. I noticed that the se for those predictions was Nan. Therefore I've added two lines (marked with #% at t

[R] pcnm - scaling

2008-12-17 Thread robert . ptacnik
Dear listers, I am using the pcnm function (spacemakeR) to obtain eigenvectors for a spatial grid of sampling sites. These pcnm eigenvectors are then used in multivariate ordination to test where community composition follows local environment or rather shows spatial autocorrelation, and get suppo

Re: [R] Principal Component Analysis - Selecting compo nents? + right choice?

2008-12-17 Thread Corrado
Hi, I have been testing some of the alternative suggested approaches. The best PC set may not be the best predictors subset, but is that true that it is not generally the case? If you have to explore data patterns and (potential) relationships between a response variables and a large set of can

[R] R function to calculate number of data points of each level

2008-12-17 Thread RON70
I have a dataframe with two columns : 11600 238'4 12000 218'0 12200 209'0 12600 192'0 13000 176'4 14000 145'0 15000 119'0 16000 103'0 1800080'0 1900068'3 2 59'0 11600 208'1 12000 189'2 12200 180'3 There are repeatations in 1st column and I want to use this as

Re: [R] bug (?!) in "pam()" clustering from fpc package ?

2008-12-17 Thread Christian Hennig
Dear Tal, pam is not in the fpc package but in the cluster package. Look at ?pam and ?pam.object to find out what it does. As far as I see, the medoids in the output object are the final cluster medoids, not the initial ones, which presumably explains the observed behaviour. Best regards, Ch

Re: [R] Kolmogorow-Smirnow-Test to check if Data comes from Subbotin distribution

2008-12-17 Thread Jose Iparraguirre D'Elia
Dear Sara, You could also use the Subbotools package by Giulio Bottazzi and test the goodness of fit of your data to this distribution. See: http://www.lem.sssup.it/WPLem/files/2004-14.pdf Also, http://cafim.sssup.it/~giulio/software/subbotools/install_cygwin.html Regards, José Mr José Luis

[R] using dvi with latex object: directory not correctly set, maybe due to error in shQuote()

2008-12-17 Thread Willner, Marco
Dear friends of R, I want to produce a pdf file with the contents of a matrix. I employ the latex command in combination with dvi, both contained in the Hmisc package. It seems to me that the function does not correctly set the directory. > tbl.loc <- matrix(1:4, nc=2) > latex.obj <- latex(t

Re: [R] Problems with graphical devices, e.g., png(), pdf(): blurry graphical output

2008-12-17 Thread Martyn Plummer
The artefacts that you see are a normal result of using bitmap graphics devices. I have tried to explain these below: I have looked at your figures in Eye of Gnome, with anti-aliasing turned off (Menu Edit/Preferences; Tab "Image View"; option "Smooth images when zoomed"). I recommend that you d

Re: [R] Find all numbers in a certain interval

2008-12-17 Thread Vitalie Spinu
Hi, If you can formulate your question it in terms of actual problem you have with data.frame it would be easier to answer. for the time being check subset() if it is what you want. SV. On Tue, 16 Dec 2008 11:09:19 +0100, Antje wrote: Hi all, I'd like to know, if I can solve this with a sho

Re: [R] Timing Portion of R Code

2008-12-17 Thread matthieu dubois
see ?system.time __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] repeated measures aov with weights

2008-12-17 Thread Prof Brian Ripley
On Wed, 17 Dec 2008, Ingmar Visser wrote: I see, I was afraid for an answer along these lines as my problem now turns into a stat problem (-;Any suggestions on how to analyze such data as given You mean, you were afraid that the help page was correct? Weights can be specified by a 'weigh

[R] Timing Portion of R Code

2008-12-17 Thread Gundala Viswanath
Dear all, What's the common R idiom to do this task? For example I want to compute the running time of one function in R > mylong_running_func(100) How can I compute the running time of the function above? - Gundala Viswanath Jakarta - Indonesia __ R

Re: [R] repeated measures aov with weights

2008-12-17 Thread Prof Brian Ripley
On Wed, 17 Dec 2008, Ingmar Visser wrote: I see, I was afraid for an answer along these lines as my problem now turns into a stat problem (-;Any suggestions on how to analyze such data as given below with weights AND at the same time taking into account that there are repeated measurements? It

Re: [R] repeated measures aov with weights

2008-12-17 Thread Ingmar Visser
I see, I was afraid for an answer along these lines as my problem now turns into a stat problem (-; Any suggestions on how to analyze such data as given below with weights AND at the same time taking into account that there are repeated measurements? Best, Ingmar On 17 Dec 2008, at 11:02, Pro

[R] OFF topic testing for positive coeffs

2008-12-17 Thread vito muggeo
Dear all, This is off-topic, however I hope someone can give me useful suggestion.. Given the regression model y = b0 + b1*x + e I am interested in testing for positive coeffs, namely H0: b0>0 AND b1>0 H1: b0,b1 unconstrained It is simple to estimate the model under H0 and H1 (there are several

Re: [R] Check if data frame column is numeric

2008-12-17 Thread Vitalie Spinu
On Tue, 16 Dec 2008 16:25:07 +0100, Mark Heckmann wrote: Hi R-users, I want to apply a function to each column of a data frame that is numeric. colwise(), numcolwise() and catcolwise() in plyr package turn a function that operates on vectors into one that operates on columns of data fra

Re: [R] pruning trees using rpart

2008-12-17 Thread Prof Brian Ripley
On Wed, 17 Dec 2008, Tom Cattaert wrote: Hi, I am using the packages tree and rpart to build a classification tree to predict a 0/1 outcome. The package rpart has the advantage that the function plotcp gives a visual representation of the cross-validation results with a horizontal line indicati

Re: [R] repeated measures aov with weights

2008-12-17 Thread Prof Brian Ripley
Weights are not supported: multistratum aov is designed for balanced designs and uses projection for which weighting is inappropriate. On Wed, 17 Dec 2008, Ingmar Visser wrote: Dear R-help, I'm facing a problem with defining a repeated measures anova with weighted data. Here's the code to rep

Re: [R] Construct All Possible Strings from 4 Bases (ATCG)

2008-12-17 Thread Ivar Herfindal
To add on Robin Hankin's solution, if you want to generate the strings you can try: f <- function(bases, n){apply(expand.grid(rep(list(bases),n)), 1, paste, collapse="")} f(c("A", "T", "C", "G"), 2) f(c("A", "T", "C", "G"), 4) best Ivar Robin Hankin wrote: Gundala f <- function(n){expand.

[R] pruning trees using rpart

2008-12-17 Thread Tom Cattaert
Hi, I am using the packages tree and rpart to build a classification tree to predict a 0/1 outcome. The package rpart has the advantage that the function plotcp gives a visual representation of the cross-validation results with a horizontal line indicating the 1 standard error rule, i.e. the recom

Re: [R] Problems with graphical devices, e.g., png(), pdf(): blurry graphical output

2008-12-17 Thread Y-H Chen
On Wed, Dec 17, 2008 at 12:54 AM, Prof Brian Ripley wrote: > Your PDF problems indicate a broken viewer. How were you viewing PDF? You are absolutely correct about the PDF files; I've since checked the PDF files in other viewers and have not been able to reproduce the problem. There was definite

[R] repeated measures aov with weights

2008-12-17 Thread Ingmar Visser
Dear R-help, I'm facing a problem with defining a repeated measures anova with weighted data. Here's the code to reproduce the problem: # generate some data seed=11 rtrep <- data.frame(rt=rnorm(100),ti=rep(1:5,20),subj=gl (20,5,100),we=runif(100)) # model with within factor for subjects/repea

Re: [R] Construct All Possible Strings from 4 Bases (ATCG)

2008-12-17 Thread Robin Hankin
Gundala f <- function(n){expand.grid(rep(list(seq_len(4)),n))} HTH Robin Gundala Viswanath wrote: Dear all, Is there an efficient way in R to construct all strings from 4 bases (ATCG). If we want a length L string, there are 4 ^ L possible strings of such. e . g with L = 2 we have AA

Re: [R] Help - java.library.path

2008-12-17 Thread Christian Ruckert
Stefan Gengenbach schrieb: Hello all, I`m a computer science student from Frankfurt/main (germany). Our student team (10 students) are working on a R/Interface project (Java and R) and we have a problem with R and JRI. We are working on 10 computers with Windows XP SP2, R 2.8.0, jdk1.6.0_11

[R] Construct All Possible Strings from 4 Bases (ATCG)

2008-12-17 Thread Gundala Viswanath
Dear all, Is there an efficient way in R to construct all strings from 4 bases (ATCG). If we want a length L string, there are 4 ^ L possible strings of such. e . g with L = 2 we have AA, AT, AC, AG, .. GC, GA, GT, GG as many as 4 ^ 2 = 16 strings, with L = 3 we have as many as 4 ^ 3 = 64 str

Re: [R] Problems with graphical devices, e.g., png(), pdf(): blurry graphical output

2008-12-17 Thread Prof Brian Ripley
Your PDF problems indicate a broken viewer. How were you viewing PDF? You have also not told us how you view PNG, but you would expect anti-aliased output to be blurry when viewed at 100% (or more). You need to be careful not to have anti-aliasing turned on in the viewer as well as in the fi

  1   2   >