Re: [R] predict: remove columns with new levels automatically

2009-11-24 Thread Andreas Wittmann
Sorry for my bad description, i don't want get a constructed algorithm without own work. i only hoped to get some advice how to do this. i don't want to predict any sort of data, i reference only to newdata which variables are the same as in the model data. But if factors in the data than i can

[R] center of cluster of points in PCA

2009-11-24 Thread phoebe kong
Hi, Can someone tell me how to find the center of cluster points in PCA (PC1 vs PC2)? Can R find that out? If yes, how it's generated by R? Is the coordinate of center point equals (mean score of PC1, mean score of PC2)? Thanks bunch! Phoebe [[alternative HTML version deleted]] ___

Re: [R] 11 distinguishable colors

2009-11-24 Thread phoebe kong
Thanks milton! It is helpfull! On Tue, Nov 24, 2009 at 3:27 PM, milton ruser wrote: > Hi there, > > I picked it up from r.colors' grass manual: > > http://colorbrewer2.org/ > > The code bellow cold be usefull for you explore simbols and colors. > > x11(900,500) > par(mfrow=c(1,2)) > x<-runif(20)

Re: [R] XML package example code?

2009-11-24 Thread cls59
Peng Yu wrote: > > I'm interested in parsing an html page. I should use XML, right? Could > you somebody show me some example code? Is there a tutorial for this > package? > Did you try looking through the help pages for the XML package or browsing the Omegahat website? Look at: library(XM

Re: [R] predict: remove columns with new levels automatically

2009-11-24 Thread David Winsemius
On Nov 24, 2009, at 2:24 PM, Andreas Wittmann wrote: Dear R-users, in the follwing thread http://tolstoy.newcastle.edu.au/R/help/03b/3322.html the problem how to remove rows for predict that contain levels which are not in the model. now i try to do this the other way round and want to r

[R] Backfitting with Missing Explanatory Values

2009-11-24 Thread Charlotte Maia
Hi, I just wanted to check I'm not re-inventing the wheel here. I'm developing a new algorithm for backfitting (i.e. additive models) and for computing partial residuals, where partial residuals are still computed even where there are missing values. Noting additive models here contain both linear

Re: [R] keep empty subsets using aggregate

2009-11-24 Thread David Winsemius
On Nov 24, 2009, at 5:03 PM, Fang (Betty) Yang wrote: Dear all, I am struggling with a small problem. By using aggregate, the empty subsets are removed. I need each empty subset to be 0. Any suggestions will be appreciated. Code: edref = aggregate(rep(1,times=dim(eds)[1]),list(eds[,11],

[R] Eliminating 'Unprintable ASCII' characters

2009-11-24 Thread Steven Kang
Hi all, I have a csv file containing words with *UNPRINTABLE ASCII* characters (described in the following table). Are there any viable method in eliminating these characters? I realise that *EXTENDED ASCII* characters (i.e , ¡, ¢, £, ¤ etc) can be removed or replaced via *"gsub"* or *"gregexpr"

Re: [R] Method

2009-11-24 Thread David Winsemius
On Nov 24, 2009, at 3:21 PM, David Winsemius wrote: On Nov 24, 2009, at 1:44 PM, yonosoyelmejor wrote: I use length(myVector),but when i want to use for example exp(x.reconstruida[length(myVector)+1:length(myVector)+9]), I need that function returns the number of last element,would then:

Re: [R] random effects correlation in lmer

2009-11-24 Thread Daniel Malter
sorry, that escaped my attention. it was meant to be y2=10+rand.int+tim+rand.int*tim+e Daniel - cuncta stricte discussurus - _ Von: Dennis Murphy [mailto:djmu...@gmail.com] Gesendet: Tuesday, November 24, 2009 5:00 PM An: Daniel Mal

[R] which to trust...princomp() or prcomp() or neither?

2009-11-24 Thread Blair Smith
According to R help: princomp() uses eigenvalues of covariance data. prcomp() uses the SVD method. yet when I run the (eg., USArrests) data example and compare with my own "hand-written" versions of PCA I get what looks like the opposite. Example: comparing the variances I see: Using prcomp(USA

Re: [R] reshape question

2009-11-24 Thread Joe King
What about the melt function in reshape package? EX: > x=sample(1:100,20,replace=T) > x [1] 48 94 32 96 81 99 10 64 64 94 57 60 16 64 32 76 63 1 64 8 > y=sample(1:100,20,replace=T) > y [1] 73 78 82 43 58 85 74 64 73 41 45 38 63 36 44 74 7 88 91 1 > xy=cbind(x,y) > melt(xy) X1 X2 val

Re: [R] reshape question

2009-11-24 Thread hadley wickham
> I don't really understand what you want and the example solution throws away > quite a lot of data, so consider this alternative: > > data.out2 <- read.table(textConnection("id   rater.1 n.1   rater.2 n.2 > rater.3 n.3   rater.4 n.4 > 11   11 0.118  79        NA  NA        NA  NA        NA  N

[R] problem in building an R package

2009-11-24 Thread clue_less
i am trying to build an R package and submit to CRAN. i am using - package.skeleton(name="xxzz", code_files = "H:\xxzz.R") to build package xxzz. --- The code above generates 'xxzz' folder. It seems that I have to manually edit the files generated in xxzz folder (to add tit

Re: [R] Trellis Plot

2009-11-24 Thread ychu066
i was trying to do a for loop for plotting the histograms , but it doesnt work properly > library(lattice) > columns <- 8:153 > plots <- vector("list", length(columns)) > j <- 0 > for (i in columns) + { + plots[[ j <- j+1 ]] <- histogram( ~ data[,i] | data[,2],ylab = "Frequency", +

Re: [R] reshape question

2009-11-24 Thread David Winsemius
On Nov 24, 2009, at 8:33 PM, AC Del Re wrote: Hi All, I am wanting to convert a data.frame from a wide format to a long format (with >1 variable) and am having difficulties. Any help is appreciated! #current wide format head(data.out2) id rater.1 n.1 rater.2 n.2 rater.3 n.3

[R] XML package example code?

2009-11-24 Thread Peng Yu
I'm interested in parsing an html page. I should use XML, right? Could you somebody show me some example code? Is there a tutorial for this package? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the post

[R] reshape question

2009-11-24 Thread AC Del Re
Hi All, I am wanting to convert a data.frame from a wide format to a long format (with >1 variable) and am having difficulties. Any help is appreciated! #current wide format > head(data.out2) id rater.1 n.1 rater.2 n.2 rater.3 n.3 rater.4 n.4 11 11 0.118 79NA NA

[R] questions on the ff package

2009-11-24 Thread Hao Cen
Hi, I have two questions on using the ff package and wonder if anyone who used ff can share some thoughts. I need to save a matrix as a memory-mapped file and load it back later. To save the matrix, I use mat = matrix(1:20, 4, 5) matFF = ff(mat, dim=dim(mat), filename="~/a.mat", overwrite=TRUE,

[R] Accessing remote data (ftp) over the net

2009-11-24 Thread Marshall Feldman
Hi, Is there any way to access data remotely over the Internet? In particular, I'm starting a project that will use data from the U.S. Bureau of Labor Statistics. The Bureau regularly updates various data series and publishes them as a series of flat files that can be downloaded via ftp (e.g.

Re: [R] Titles in plots overlap

2009-11-24 Thread David Winsemius
I did not get anything very interesting with that plot but nonetheless, I suspect that you want to put your oma= parameter a bit earlier. On Nov 24, 2009, at 6:14 PM, Roslina Zakaria wrote: Hi, I use fCopulae package to draw different graphs of univariate and bivariate skew t. But the

Re: [R] How to get the item in list that is a number?

2009-11-24 Thread Nikhil Kaza
?unlist if I understand you correctly. On 24 Nov 2009, at 5:50PM, Peng Yu wrote: I have the following list. The second item in the list is a number. I'm wondering how to write R code to return this information for any list? $`1` integer(0) $`2` [1] 123 $`3` integer(0) $`4` integer(0) $`5

Re: [R] Split column

2009-11-24 Thread Lisaj
I really appreciate your help. But if there is a big dataset, I need to write lots of code. Lisa David Winsemius wrote: > > The solution I offered does exactly that. It also addresses your other > supplemental request. > > -- > David (Dangerfield?) > > On Nov 24, 2009, at 5:57 PM, Lisaj

Re: [R] 11 distinguishable colors

2009-11-24 Thread milton ruser
Hi there, I picked it up from r.colors' grass manual: http://colorbrewer2.org/ The code bellow cold be usefull for you explore simbols and colors. x11(900,500) par(mfrow=c(1,2)) x<-runif(20) y<-runif(20) plot(y~x, type="n") Number.of.symbols<-20 for (i in 1:Number.of.symbols) { points(y[i]~x[

[R] R Packages Crack the 3,000 Mark!

2009-11-24 Thread Muenchen, Robert A (Bob)
Hi All, I don't know if this has been reported before, but according to Henrique Dallazuanna's program (below) the number of R packages has exceeded the 3,000 mark. The count today is 3,175. I ran this just a couple of months ago & the number was still in the high 2,000s, so it must be fairly r

[R] Titles in plots overlap

2009-11-24 Thread Roslina Zakaria
Hi,   I use fCopulae package to draw different graphs of univariate and bivariate skew t.  But the plots titles overlap.  I tried using cex.main, font.main to adjust the size but they still overlaps.  Here is my code: par(mfrow = c(3, 1)) mu = 0 Omega = 1 alpha1 = 0 alpha2 = 1.5 alpha3 = 2 alpha4

Re: [R] Split column

2009-11-24 Thread David Winsemius
The solution I offered does exactly that. It also addresses your other supplemental request. -- David (Dangerfield?) On Nov 24, 2009, at 5:57 PM, Lisaj wrote: I have a further question. If there is NA (missing data) in the original dataset, just like this: id var1 var2 1 1

Re: [R] 11 distinguishable colors

2009-11-24 Thread phoebe kong
It should be 11 different groups, not 8. On Tue, Nov 24, 2009 at 3:00 PM, phoebe kong wrote: > Hi, > > I want to draw a plot where the data set has 8 different groups. Could you > suggest 8 combination of colors and symbols that are distinguishable? If the > colors are too close, it would be har

[R] 11 distinguishable colors

2009-11-24 Thread phoebe kong
Hi, I want to draw a plot where the data set has 8 different groups. Could you suggest 8 combination of colors and symbols that are distinguishable? If the colors are too close, it would be hard to differentiate from the plot. Thanks, [[alternative HTML version deleted]] ___

Re: [R] Split column

2009-11-24 Thread Lisaj
I have a further question. If there is NA (missing data) in the original dataset, just like this: id var1 var2 1 1 3 2 3 1 3 NA1 4 1 2 5 2 3 how to deal with it? The converted dataset should be this: id var1.1 var1.2

[R] How to get the item in list that is a number?

2009-11-24 Thread Peng Yu
I have the following list. The second item in the list is a number. I'm wondering how to write R code to return this information for any list? $`1` integer(0) $`2` [1] 123 $`3` integer(0) $`4` integer(0) $`5` integer(0) __ R-help@r-project.org mail

Re: [R] overdispersion and quasibinomial model

2009-11-24 Thread David Winsemius
On Nov 24, 2009, at 3:41 PM, djpren wrote: I am looking for the correct commands to do the following things: 1. I have a binomial logistic regression model and i want to test for overdispersion. Under the teach a man to fish precept, ... try: RSiteSearch("test over dispersion binomial mo

[R] Scatter plot with margin distributions

2009-11-24 Thread Jose Narillos de Santos
Hi All, My doub I think is very simple. I hope it is. So you can again help, guide me. I´m trying to make a graph (scatter graph) about two variables, imagine I have a watter.txt file with two variables watter and hardness: This code extracted from: http://cran.r-project.org/web/packages/HSAUR/v

Re: [R] merge on non-identical names

2009-11-24 Thread Henrique Dallazuanna
See agrep: agrep("American Services", "Americam Services") On Tue, Nov 24, 2009 at 7:11 PM, j daniel wrote: > > Greetings, > > I need to conduct a merge on two databases containing information on > organizations, but the organization names are often non-identical and there > is no common unique

Re: [R] Re moving white space help

2009-11-24 Thread Henrique Dallazuanna
If I understand, you can try this: gsub("\\s+","",x) On Tue, Nov 24, 2009 at 7:18 PM, Ramyathulasingam wrote: > > Hi  there > > I am trying to remove the white space and replace it with nothing but didnt > have any luck with that > > x <- and fgh- > > i can replace the comma using gsub > gsub("\

Re: [R] Re moving white space help

2009-11-24 Thread jim holtman
Is this what you want: > x <- " and fgh-" > gsub(" +", "", x) [1] "andfgh-" On Tue, Nov 24, 2009 at 4:18 PM, Ramyathulasingam wrote: > > Hi  there > > I am trying to remove the white space and replace it with nothing but didnt > have any luck with that > > x <- and fgh- > > i can replace

[R] Install RPostgreSQL (Mac OSX 10.6)

2009-11-24 Thread XDriftwood
Dear all, I'm an absolute R-beginner and want to connect to my PostgreSQL DB (on my local Mac OSX 10.6). 1) I tried to install RPostgreSQL (Package Installer > CRAN (sources)) and get this log below. There seems to be an issue with libpq, bug I don't have any clue how to fix this. What can I do?

[R] Re moving white space help

2009-11-24 Thread Ramyathulasingam
Hi there I am trying to remove the white space and replace it with nothing but didnt have any luck with that x <- and fgh- i can replace the comma using gsub gsub("\\-","",x) but i cant replace the white space with nothing. Ramya -- View this message in context: http://old.nabble.com/Remov

[R] merge on non-identical names

2009-11-24 Thread j daniel
Greetings, I need to conduct a merge on two databases containing information on organizations, but the organization names are often non-identical and there is no common unique identifier. Does anyone know a good way to calculate a similarity measure on two names, or even better is there a natura

[R] Monthly Returns where first day is the 14th of the month and last day is the 13th of next month

2009-11-24 Thread F. Garavito
Dear All, I am trying to do something very simple but I have not been able to figure it out. I am trying to calculate monthly returns (i.e stock returns) from daily prices, where the first price is on the 14th day of the month and the last price is on the 13th day of the next month. The return

[R] Lag correlation

2009-11-24 Thread gauravbhatti
Hi I have a data frame which looks like : hs361224 hs426435 hs903411 hs205893 sPP13_2 hs792300 hs747811 2.5 0.837 -0.7684995 -0.4209555 -0.4996375 1.363161 -0.259850 -0.503650 5 1.8617705 -0.5842845 -0.3615625 -0.9784640 1.862586 2.104920 1.192305 24 .

[R] overdispersion and quasibinomial model

2009-11-24 Thread djpren
I am looking for the correct commands to do the following things: 1. I have a binomial logistic regression model and i want to test for overdispersion. 2. If I do indeed have overdispersion i need to then run a quasi-binomial model, but I'm not sure of the command. 3. I can get the residuals of t

[R] Aquamacs/emacs and color of echo in R console 2!

2009-11-24 Thread Christian Hoffmann
Hi Sorry, I forgot to state the version: GNU Emacs 22.3.1 I have been unable to find information on the following problem: All the text in my *R* window is shown in light red, starting after the echo "This is mgcv 1.5-6 . For overview type ", the following `help("mgcv-package")' is already in

[R] Aquamacs/emacs and color of echo in R console

2009-11-24 Thread Christian Hoffmann
Hi I have been unable to find information on the following problem: All the text in my *R* window is shown in light red, starting after the echo "This is mgcv 1.5-6 . For overview type ", the following `help("mgcv-package")' is already in the light red. This color annoys me because I need m

Re: [R] Subscript out of bounds

2009-11-24 Thread Tom Wainwright
On 11/24/2009 10:00 AM, tobiasfa wrote: Hi! Trying to make a forecast, and get the following error message: Error in NextMethod("[<-") : subscript out of bounds The script is as follows: Forecast.A<- ts(matrix(NA, nrow=25, ncol = 1, + dimnames = list(c(), c("Outcome"))), + start = c(2006,

[R] keep empty subsets using aggregate

2009-11-24 Thread Fang (Betty) Yang
Dear all, I am struggling with a small problem. By using aggregate, the empty subsets are removed. I need each empty subset to be 0. Any suggestions will be appreciated. Code: edref = aggregate(rep(1,times=dim(eds)[1]),list(eds[,11], eds[,7], eds[,27]), sum) Thanks in advance,

[R] contr.sdif from MASS

2009-11-24 Thread Christoph Scherber
Dear all, When using contr.sdif (from MASS), is it true that the *Intercept* is the mean of the response variable *across all levels* of the explanatory variables included in the model? Somehow, it doesn´t seem to be the overall mean. Many thanks for any help! Christoph # Below is an example:

[R] Anova and covariable

2009-11-24 Thread john polo
Dear R users, i want to use ANOVA with a small data set, here is an example of the data: Rich FireDe TimeS Area 8 2 4 C 92.5 7 C 51.9 2 C 7 3 4 C 82.5 0 L 2 4 3 L 9

Re: [R] Graphic Device - View/get all graphics

2009-11-24 Thread Don MacQueen
You might try putting readline('CR to continue') between the two sets of plot commands. -Don At 8:52 AM -0800 11/24/09, MarcioRibeiro wrote: Hi Listers, I am producing some graphics that the commands are in a FUNCTION... The problem is that I end up viewing just last graphic and in my FUNC

Re: [R] Split column

2009-11-24 Thread Lisaj
Thank you for your help. But how to change the column names to var1.1, var1.2, var2.1, and var2.2? Lisa Henrique Dallazuanna wrote: > > Try this: > > cbind(x$id, t(do.call(rbind, lapply(x[-1], sapply, switch, '1' = > c(1,1), '2' = c(1, 2), '3' = c(2, 2) > > On Tue, Nov 24, 2009 at 1:51

Re: [R] Method

2009-11-24 Thread William Dunlap
Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius > Sent: Tuesday, November 24, 2009 12:22 PM > To: yonosoyelmejor > Cc: r-help@r-project.org > Subject: Re: [R] Method > > > On Nov 24, 2009, at 1:44 PM, yonosoyelmejor wrote: >

[R] anova() method for coxph objects with robust standard errors

2009-11-24 Thread Terry Therneau
> what is the reason why the anova() method for coxph objects does not work when robust standard errors have been requested, e.g., A robust variance estimate is normally used in situations where the model may be mis-specified, e.g., multiple events per subject. In this case a comparison of partia

Re: [R] linear regression on groups of consecutive rows of a matrix

2009-11-24 Thread Jim Bouldin
> But I do feel compelled to ask: Do you really get meaningful > information from lm applied to 5 cases? Especially when the predictors > used may not be the same from subset to subset??? Thanks again for your help David. Your question is a good one. It's a bit complicated but here's the bas

[R] predict from glmer

2009-11-24 Thread sj
Hi all, Windows XP R 2.10.0 I am trying to generate predictions from a binomial mixed model using glmer. the models is as follows: mod.PN <- glmer(PN_out~ as.factor(intr3) + transcode + Yr + (Yr|ID) family=binomial,data=partset, na.action=na.omit) where PN_out is a two column binomial variable

Re: [R] linear regression on groups of consecutive rows of a matrix

2009-11-24 Thread David Winsemius
Perhaps along these lines: 1st #need to decide what your group width is , so the second number inside the extraction call will be that number minus 1: for (x in seq(1:1000, by=6) { temp <- na,omit( shp[x:(x+5), ] ) # Need the parens in x:(x+5) lm( formula, data=temp) } Or dependi

Re: [R] How to identify the rows in my dataframe with a negative value in any column?

2009-11-24 Thread David Winsemius
On Nov 24, 2009, at 3:04 PM, Henrique Dallazuanna wrote: Try this: DF[rowSums(DF < 0) == 0,] ITYM: > DF <- data.frame(a=1:10, b=c(1:3,-4, 5:10), c=c(-1, 2:10)) > > DF[rowSums(DF < 0) > 0,] a b c 1 1 1 -1 4 4 -4 4 -- David On Tue, Nov 24, 2009 at 5:58 PM, Mark Na wrote: Dear R

[R] linear regression on groups of consecutive rows of a matrix

2009-11-24 Thread Jim Bouldin
I want to perform linear regression on groups of consecutive rows--say 5 to 10 such--of two matrices. There are many such potential groups because the matrices have thousands of rows. The matrices are both of the form: > shp[1:5,16:20] SL495B SL004C SL005C SL005A SL017A -2649 1.06 0.56

Re: [R] Method

2009-11-24 Thread David Winsemius
On Nov 24, 2009, at 1:44 PM, yonosoyelmejor wrote: I use length(myVector),but when i want to use for example exp(x.reconstruida[length(myVector)+1:length(myVector)+9]), I need that function returns the number of last element,would then: if the last position of my vector is 1440 exp(x.reco

Re: [R] How to identify the rows in my dataframe with a negative value in any column?

2009-11-24 Thread Mark Na
Thanks Steve, this works very well! Mark On Tue, Nov 24, 2009 at 2:07 PM, Steve Lianoglou < mailinglist.honey...@gmail.com> wrote: > Hi, > > On Nov 24, 2009, at 2:58 PM, Mark Na wrote: > > > Dear R-helpers, > > > > I have a dataframe that should not contain any negative values, but it > does.

Re: [R] random effects correlation in lmer

2009-11-24 Thread Daniel Malter
It implies that the random intercept is perfectly collinear with the random slope, as you suggested. I attach an example. The data generating process of y1 has a random intercept, but no random slope. When you fit a model with random intercept and random slope, the correlation between the two is

Re: [R] how to change the class of a group of objects

2009-11-24 Thread Ben Mazzotta
Erik and others, Many thanks for your assistance. Erik correctly points out that the as.dist() coercion requires a different format than I was using. The correct format for input to as.dist() is a square matrix, not a lower triangle matrix. Once I had that in order, everything went much better. I

Re: [R] Method

2009-11-24 Thread Sarah Goslee
If the last position of your vector is 1440, what do you expect to get from 1440 + 1??? And you certainly need some parentheses in there if you expect to get a range of values from your vector. Perhaps you need some subtraction? And no, we still can't tell exactly what you want. If this doesn't a

Re: [R] How to interpret the name of an object literally?

2009-11-24 Thread Duncan Murdoch
On 11/24/2009 1:13 PM, novocaine wrote: Hi, I can't seem to figure out how to tell R to stop expanding an object. I would like to use the literal name rather than the expanded value. The issue occurs in a function I've been writing. The problematic part looks like this: # "fund" is a matr

Re: [R] How to identify the rows in my dataframe with a negative value in any column?

2009-11-24 Thread Steve Lianoglou
Hi, On Nov 24, 2009, at 2:58 PM, Mark Na wrote: > Dear R-helpers, > > I have a dataframe that should not contain any negative values, but it does. > I wish to print the rows from my dataframe that contain a negative value in > any column. I've tried this: > >> dataframe[dataframe<0,] > > but i

Re: [R] How to identify the rows in my dataframe with a negative value in any column?

2009-11-24 Thread Henrique Dallazuanna
Try this: DF[rowSums(DF < 0) == 0,] On Tue, Nov 24, 2009 at 5:58 PM, Mark Na wrote: > Dear R-helpers, > > I have a dataframe that should not contain any negative values, but it does. > I wish to print the rows from my dataframe that contain a negative value in > any column. I've tried this: > >>

[R] How to identify the rows in my dataframe with a negative value in any column?

2009-11-24 Thread Mark Na
Dear R-helpers, I have a dataframe that should not contain any negative values, but it does. I wish to print the rows from my dataframe that contain a negative value in any column. I've tried this: > dataframe[dataframe<0,] but it just returns a row of NAs. I would very much appreciate any help

Re: [R] Method

2009-11-24 Thread yonosoyelmejor
I use length(myVector),but when i want to use for example exp(x.reconstruida[length(myVector)+1:length(myVector)+9]), I need that function returns the number of last element,would then: if the last position of my vector is 1440 exp(x.reconstruida[1440+1:1440+9] This is what I need, I hope havin

Re: [R] Re adline()

2009-11-24 Thread yonosoyelmejor
Sure,but my problem is that the script is run from the console windows,therefore I believe that the cat or readline doesn´t work... JorisMeys wrote: > > I can't reproduce the error you have. With me, it runs all fine. In > fact, readline apparently flushes automatically, as I didn't have to > us

[R] How to interpret the name of an object literally?

2009-11-24 Thread novocaine
Hi, I can't seem to figure out how to tell R to stop expanding an object. I would like to use the literal name rather than the expanded value. The issue occurs in a function I've been writing. The problematic part looks like this: # "fund" is a matrix of open, high, low, close, and volume pr

[R] Subscript out of bounds

2009-11-24 Thread tobiasfa
Hi! Trying to make a forecast, and get the following error message: Error in NextMethod("[<-") : subscript out of bounds The script is as follows: > Forecast.A <- ts(matrix(NA, nrow=25, ncol = 1, + dimnames = list(c(), c("Outcome"))), + start = c(2006, 10), frequency = 12) > for (i in 1:25) {

Re: [R] Convert Time Variable to Numeric

2009-11-24 Thread Don MacQueen
Perhaps something like: as.numeric(chron(times.=c('01:23:21','11:12:13'))) [1] 0.05788194 0.46681713 -Don At 7:02 AM -0800 11/24/09, RanjanV wrote: Hello Everyone I am new to R I would like to know how to deal with Time Variable. If I have a column of containing Time data in the format of

Re: [R] NAs introduced by coercion warning?

2009-11-24 Thread Don MacQueen
In my experience, it is generally due to something like this example: as.numeric(c('1','b','2')) [1] 1 NA 2 Warning message: NAs introduced by coercion There may be other operations that generate that error, I can't say for sure. But the above example illustrates what I look for when I

[R] predict: remove columns with new levels automatically

2009-11-24 Thread Andreas Wittmann
Dear R-users, in the follwing thread http://tolstoy.newcastle.edu.au/R/help/03b/3322.html the problem how to remove rows for predict that contain levels which are not in the model. now i try to do this the other way round and want to remove columns (variables) in the model which will be lat

Re: [R] Excel-Export

2009-11-24 Thread Hans-Peter Suter
2009/11/24 Kevin Wright : > If had done a little searching before posting, you surely would have found > this link > https://stat.ethz.ch/pipermail/r-help/2008-July/169149.html > which describes how to create .xls files that are customized any way that > you desire. Manually convert to html, then

Re: [R] Split column

2009-11-24 Thread David Winsemius
On Nov 24, 2009, at 12:53 PM, Adaikalavan wrote: Not very elegant but this does the trick: df <- cbind( var1=c(1,3,2,1,2), var2=c(3,1,1,2,3) ) df <- data.frame(id=1:5, df) data.frame(id=df$id, var1.1 = (df$var1<3) + 2*(df$var1==3), # 1 for < 3; 2 for 3 var1.2 = (d

Re: [R] reshaping data

2009-11-24 Thread Henrique Dallazuanna
Try this; with(x, data.frame(Case = rep(Case, (Endyear - Startyear) + 1), Year = unlist(mapply(seq, Startyear, Endyear On Tue, Nov 24, 2009 at 4:14 PM, Joseph Magagnoli wrote: > Hi all, > I have a dataframe that has one observation per case. > for example: > > Case

Re: [R] Graphic Device - View/get all graphics

2009-11-24 Thread Greg Snow
There are multiple ways, some are OS specific (and I don't see where you told us that). Some things to try: par(ask=TRUE) # or pdf('tempfile.pdf') yourfunctionhere() dev.off() # or par(mfrow=c(2,2)) # or Windows(record=TRUE) # or Look at the help for the function creating the plots, som

[R] reshaping data

2009-11-24 Thread Joseph Magagnoli
Hi all, I have a dataframe that has one observation per case. for example: CaseStartyear Endyear A 1979 1989 B 1950 1955 I would like to create a dataframe in which each case has multiple observations corresponding to the start and end

Re: [R] Tests in Anova

2009-11-24 Thread Sarah Goslee
www.rseek.org is great for finding functions/packages that perform specific tests. Sarah On Tue, Nov 24, 2009 at 1:09 PM, Silvano wrote: > Hi, > > how can I make tests like Dunnett and Duncan using R? > > Thanks, > -- Sarah Goslee http://www.functionaldiversity.org __

[R] Tests in Anova

2009-11-24 Thread Silvano
Hi, how can I make tests like Dunnett and Duncan using R? Thanks, -- Silvano Cesar da Costa Departamento de Estatística Universidade Estadual de Londrina Fone: 3371-4346 __ R-help@r-project.org mailing list https:/

Re: [R] Split column

2009-11-24 Thread Adaikalavan Ramasamy
Not very elegant but this does the trick: df <- cbind( var1=c(1,3,2,1,2), var2=c(3,1,1,2,3) ) out <- df out[ which(df==1, arr.ind=T) ] <- "1&1" out[ which(df==2, arr.ind=T) ] <- "1&2" out[ which(df==3, arr.ind=T) ] <- "2&2" outlist <- apply(out, 2, strsplit, split="&") do.call( "cbind.data.fram

Re: [R] Graphic Device - View/get all graphics

2009-11-24 Thread David Winsemius
On Nov 24, 2009, at 11:52 AM, MarcioRibeiro wrote: Hi Listers, I am producing some graphics that the commands are in a FUNCTION... The problem is that I end up viewing just last graphic and in my FUNCTION there are 4 graphics with the PAR command function... Like those below... How do I v

Re: [R] Split column

2009-11-24 Thread Henrique Dallazuanna
Try this: cbind(x$id, t(do.call(rbind, lapply(x[-1], sapply, switch, '1' = c(1,1), '2' = c(1, 2), '3' = c(2, 2) On Tue, Nov 24, 2009 at 1:51 PM, Lisaj wrote: > > Hello, R users, > > I have a dataset that looks like this: > > id   var1   var2 >  1      1      3 >  2      3      1 >  3      2

Re: [R] From R to LaTeX to pdf?

2009-11-24 Thread Frank E Harrell Jr
Tom Backer Johnsen wrote: As a general observation, few, if any, statistical packages, generate tables in the format what you might think you need or want. R is not an exception. Then it is better to transfer the table to a spreadsheet, shift things around, add headers, etc.. The R2HTML libr

Re: [R] From R to LaTeX to pdf?

2009-11-24 Thread cryan
Doesn't the APA package in LaTeX help in this situation? --Chris Ryan Original message >Date: Tue, 24 Nov 2009 18:24:52 +0100 >From: Tom Backer Johnsen >Subject: Re: [R] From R to LaTeX to pdf? >To: Erik Iverson >Cc: "r-help@r-project.org" , Joel Fürstenberg-Hägg > > >I am sure y

Re: [R] Grouped Boxplot

2009-11-24 Thread David Winsemius
Back in March Soren Vogel asked exactly the same thing: Here is the solution that was offered then. (He offered a dataset as requested in the Posting Guide.) ... with only a minor adjustment: g <- rep.int(c("A", "B", "C", "D"), 125) t <- rnorm(5000) a <- sample(t, 500, replace=TRUE) b <- sam

Re: [R] Help: Beanplots calculating wrong average

2009-11-24 Thread Tom Wainwright
Hi Michael, Looking at the help for beanplot(), note that the 'log' option defaults to 'auto' which means the function will automatically log-transform data like yours. This also implies that the mean it shows is the geometric mean, not the arithmetic mean. As you note, the transformation do

Re: [R] Encoding problems.

2009-11-24 Thread Peter Dalgaard
Gérald Jean wrote: > Hello, > > I use: > > R version 2.9.2 (2009-08-24) > Copyright (C) 2009 The R Foundation for Statistical Computing > ISBN 3-900051-07-0 > > on Ubuntu 9.10, I usually run R from ESS (5.4 on current Unbuntu) from > Emacs-22.2.1. But I also tried the following from the console

Re: [R] From R to LaTeX to pdf?

2009-11-24 Thread Tom Backer Johnsen
I am sure you are right. I myself have not looked at the LaTeX function in Hmisc, that really sounds interesting, and thank you. On the other hand I had the impression (which may be wrong) that the original question was posed by someone with not too much experience. If that is the case the s

[R] Convert Time Variable to Numeric

2009-11-24 Thread RanjanV
Hello Everyone I am new to R I would like to know how to deal with Time Variable. If I have a column of containing Time data in the format of hh:mm:ss such as 00:56:45, 01:24:36, 01:41:25, and so on.. I could find averages for this column using the Chron package. But now I need to plot a gr

[R] Graphic Device - View/get all graphics

2009-11-24 Thread MarcioRibeiro
Hi Listers, I am producing some graphics that the commands are in a FUNCTION... The problem is that I end up viewing just last graphic and in my FUNCTION there are 4 graphics with the PAR command function... Like those below... How do I view/get the other 3 graphics? Any help? Thanks in advance...

[R] Split column

2009-11-24 Thread Lisaj
Hello, R users, I have a dataset that looks like this: id var1 var2 1 1 3 2 3 1 3 2 1 4 1 2 5 2 3 I want to split one column to two columns with 1 = 1 and 1, 2 = 1 and 2, 3 = 2 and 2: id var1.1 var1.2 var2.1 va

Re: [R] Understanding hclust and dendrogram

2009-11-24 Thread Peng Yu
On Thu, Oct 15, 2009 at 4:11 AM, Fearghas MacGregor wrote: > I'd recommend "The Elements of Statistical Learning" by Hastie, Tibshirani, > and Friedman. There's a lot of good information on clustering, as well as a > wealth of info on many other apsects of classification, machine learning, > etc.

[R] Encoding problems.

2009-11-24 Thread Gérald Jean
Hello, I use: R version 2.9.2 (2009-08-24) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 on Ubuntu 9.10, I usually run R from ESS (5.4 on current Unbuntu) from Emacs-22.2.1. But I also tried the following from the console and it gave the same results. I have

Re: [R] Translation from R codes to SAS.

2009-11-24 Thread Greg Snow
You should really learn at least basic SAS yourself. Don't abandon R, but if you use R only because it is the only program you know, then you are making an uninformed decision. If you learn SAS and still prefer R (I do) then it is an informed decision and much better. And your teachers are no

Re: [R] convex hull for cluster analysis

2009-11-24 Thread james.foadi
-Original Message- From: Henrique Dallazuanna [mailto:www...@gmail.com] Sent: Tue 24/11/2009 16:10 To: Foadi, James (Imperial Coll.,RAL,DIA) Cc: r-help@r-project.org Subject: Re: [R] convex hull for cluster analysis Try this: plot(Y) polygon(Y[chull(Y),]) Yes! Lovely! Thanks. J D

Re: [R] Loess Fit

2009-11-24 Thread Greg Snow
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Karl Ove Hufthammer > Sent: Tuesday, November 24, 2009 1:11 AM > To: r-h...@stat.math.ethz.ch > Subject: Re: [R] Loess Fit > > On Mon, 23 Nov 2009 14:03:11 -0700 Greg Snow > wr

Re: [R] convex hull for cluster analysis

2009-11-24 Thread Henrique Dallazuanna
Try this: plot(Y) polygon(Y[chull(Y),]) On Tue, Nov 24, 2009 at 1:58 PM, wrote: > Dear R gurus and users, > I seem to have problem finding the right tool for plotting convex hulls over > 2D plots, after a cluster analysis. In fact I would like to draw a convex hull > in 2D for a generic group

Re: [R] Labels in horizontal dendrogram not placed correctly?

2009-11-24 Thread joris meys
Thx Chris, extending the margins worked like a charm. It would be nice though if the plot function would take the length of the labels into account as well, but I guess I'm just being too much of a spoiled kid here ;-) Cheers Joris On Thu, Nov 19, 2009 at 6:46 AM, Chris Campbell wrote: > On Mon,

Re: [R] Excel-Export

2009-11-24 Thread Kevin Wright
If had done a little searching before posting, you surely would have found this link https://stat.ethz.ch/pipermail/r-help/2008-July/169149.html which describes how to create .xls files that are customized any way that you desire. Kevin Wright On Mon, Nov 23, 2009 at 7:02 AM, koj wrote: > > De

  1   2   >