Re: [R] acf?

2011-11-04 Thread Gabor Grothendieck
On Sat, Nov 5, 2011 at 12:26 AM, Kevin Burton wrote: > I started to check what I thought I knew with autocovariance and it doesn’t > jive with the the calculations given by ‘R’. I was wondering if there is > some scaling or something that I am not aware of. > > > > Take the example > > > > Ø  d <-

[R] acf?

2011-11-04 Thread Kevin Burton
I started to check what I thought I knew with autocovariance and it doesn’t jive with the the calculations given by ‘R’. I was wondering if there is some scaling or something that I am not aware of. Take the example Ø d <- 1:10 Ø (a <- acf(d, type="covariance", demean=FALSE, plot=FALSE))

Re: [R] barplot as histogram

2011-11-04 Thread Jim Lemon
On 11/05/2011 05:04 AM, Jesse Brown wrote: Hello: I'm dealing with an issue currently that I'm not sure the best way to approach. I've got a very large (10G+) dataset that I'm trying to create a histogram for. I don't seem to be able to use hist directly as I can not create an R vector of size g

Re: [R] HoltWinters in R 2.14.0

2011-11-04 Thread Prof Brian Ripley
On Fri, 4 Nov 2011, R. Michael Weylandt wrote: I believe there were some changes to Holt-Winters, specifically in re optimization that probably lead to your problem, but you'll have to provide more details. See the NEWS file for citations about the change. If you put example code/data others may

Re: [R] 12th Root of a Square (Transition) Matrix

2011-11-04 Thread David Winsemius
This is just one of many 12-th roots. (Peter knows this i'm sure.) The negative of this would also be an nth root, and I read that there are quite few others that arise from solutions based on permuting negatives of eigen values of a triangularized form. But as I said , I'm not a matrix mechanic

Re: [R] How to avoid ifelse statement converting factor to character

2011-11-04 Thread David Winsemius
On Nov 4, 2011, at 7:33 PM, clint wrote: > most all those posts were right in sourcing the problemits just that > nobody actually offered a viable solution Very few problems that are posed with a test dataset go unanswered. > > the problem is that the new level "C" was not one of the

Re: [R] nested "for" loops

2011-11-04 Thread R. Michael Weylandt
Your problem is that you redefine l each time through the loops and don't record old values; you could do so by using c() for concatenation, but perhaps this is what you are looking for: exp(rowSums(log(expand.grid(V1, V2, V3 Hope this helps, Michael On Fri, Nov 4, 2011 at 7:49 PM, nick_pan

Re: [R] Matrix element-by-element multiplication

2011-11-04 Thread R. Michael Weylandt
Did you even try? a <- 1:3 x <- matrix(c(1,2,3,2,4,6,3,6,9),3) a*x [,1] [,2] [,3] [1,]123 [2,]48 12 [3,]9 18 27 Michael On Fri, Nov 4, 2011 at 7:26 PM, Steven Yen wrote: > is there a way to do element-by-element multiplication as in Gauss > and MATLAB, as sh

[R] nested "for" loops

2011-11-04 Thread nick_pan
Hi all , I have written a code with nested "for" loops . The aim is to estimate the maximum likelihood by creating 3 vectors with the same length( sequence ) and then to utilize 3 "for" loops to make combinations among the 3 vectors , which are (length)^3 in number , and find the one that maximiz

Re: [R] How to avoid ifelse statement converting factor to character

2011-11-04 Thread clint
most all those posts were right in sourcing the problemits just that nobody actually offered a viable solution the problem is that the new level "C" was not one of the original levels in $social status add "C" as a level and then just do the ol fashioned way and it works just fine do this: d

[R] Matrix element-by-element multiplication

2011-11-04 Thread Steven Yen
is there a way to do element-by-element multiplication as in Gauss and MATLAB, as shown below? Thanks. --- a 1.000 2.000 3.000 x 1.0002.0003.000 2.0004.0006.000 3.0006

Re: [R] set seed for random draws

2011-11-04 Thread R. Michael Weylandt
This might be more fundamental, but why do you feel the need to reset the seed each loop? There's nothing that suggests you need to... Michael On Fri, Nov 4, 2011 at 8:38 PM, Md Desa, Zairul Nor Deana Binti wrote: > Hello, all! > I need help on these two problems: > > 1) If I want to randomly dr

[R] set seed for random draws

2011-11-04 Thread Md Desa, Zairul Nor Deana Binti
Hello, all! I need help on these two problems: 1) If I want to randomly draw numbers from standard normal (or other distributions) in loops e.g.: ty=0; ks=0 for (i in 1:5) { set.seed(14537+i) k<-rnorm(1) ks[i]<-.3*k+.9 if (ty==0) { while ((ks<.2)||(ks>

Re: [R] error message

2011-11-04 Thread R. Michael Weylandt
Could you provide an example of your code? The error is coming up because lastLine - n + 1 < 0 but obviously I can't tell you why it's happening in your code without seeing it. Michael On Fri, Nov 4, 2011 at 2:06 PM, JulianaMF wrote: > Hello, > I am a PhD candidate at University of Sao Paulo, fi

Re: [R] Creating a sequence from two samples with several constraints (frequency and repeats)

2011-11-04 Thread R. Michael Weylandt
I believe the permute package is set up to generate restricted permutations. Michael On Fri, Nov 4, 2011 at 4:59 PM, Jeremy Wang wrote: > I'm attempting to create a sequence for an experiment and am hoping I can > use R to create it. It has several constraints: > > (1) It is made up of two seque

Re: [R] representing wind date using windrose

2011-11-04 Thread Clint Bowman
I'm also very impressed with openair , also Clint -- Clint BowmanINTERNET: cl...@ecy.wa.gov Air Quality Modeler INTERNET: cl...@math.utah.edu Department of Ecology VOICE: (360) 407-6815 PO Box 47600

Re: [R] Unused Arguments Error Even Though I'm Using Them?

2011-11-04 Thread R. Michael Weylandt
I can't see anything in your code at first glance that would lead to that error: could you perhaps provide some self-contained code that reproduces that error? Michael On Fri, Nov 4, 2011 at 3:21 PM, Christopher Simons wrote: > Greetings, > > I am running into an error I can't seem to get past;

Re: [R] HoltWinters in R 2.14.0

2011-11-04 Thread R. Michael Weylandt
I believe there were some changes to Holt-Winters, specifically in re optimization that probably lead to your problem, but you'll have to provide more details. See the NEWS file for citations about the change. If you put example code/data others may be able to help you -- I haven't updated yet so I

Re: [R] Determining r2 values for a SEM

2011-11-04 Thread John Fox
Dear Mark and Katherine, As well, version 2.0-0 of the sem package on R-Forge, and soon to be on CRAN, includes R^2 values as part of the summary() output (along with many other enhancements). Best, John > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-

Re: [R] representing wind date using windrose

2011-11-04 Thread R. Michael Weylandt
Try this: http://rss.acs.unt.edu/Rdoc/library/climatol/html/rosavent.html Michael On Fri, Nov 4, 2011 at 6:06 PM, Norman Khine wrote: > hello, > i am new to R and want to use it for a small project to draw a wind > data from a microclimate datasource, can someone give me an example of > how i ca

Re: [R] representing wind date using windrose

2011-11-04 Thread David Winsemius
There are several windrose functions in various packages. Try this RSiteSearch("winrose") -- David On Nov 4, 2011, at 6:06 PM, Norman Khine wrote: > hello, > i am new to R and want to use it for a small project to draw a wind > data from a microclimate datasource, can someone give me an exam

[R] bug calculating ROC with caret and earth?

2011-11-04 Thread Andrew Ziem
Does caret have a bug calculating ROC with earth?  When using caret and earth on any of my data sets, caret's ROC never varies.  This could mean earth is finding the same model (for example, because of using an nprune parameter that is too high).  However, if that were true, sensitivity and spec

Re: [R] XLConnect Error

2011-11-04 Thread Martin Studer
Hi Daniel, you can get Java from http://www.java.com/en/download/manual.jsp?locale=en Simply download and follow the instructions. Hope that helps. Martin -- View this message in context: http://r.789695.n4.nabble.com/XLConnect-Error-tp3628528p3991681.html Sent from the R help mailing list arch

[R] Creating a sequence from two samples with several constraints (frequency and repeats)

2011-11-04 Thread Jeremy Wang
I'm attempting to create a sequence for an experiment and am hoping I can use R to create it. It has several constraints: (1) It is made up of two sequences (red and green) that have 4 different repeating triplets (e.g. T1=ABC T2=DEF T3=GHI JKL) (2) Each sequence has the following constraints: (a)

Re: [R] Reading parameters from dataframe and loading as objects

2011-11-04 Thread David Winsemius
On Nov 4, 2011, at 1:50 PM, "Francois Pepin" wrote: > Hi, > > assign is your friend here: > apply(data,1,function(x)assign(x[1],x[2],envir = .GlobalEnv)) > > As a note, you probably don't want to use data as a variable because it > overwrites the data function, leading to unwanted side-effe

[R] how to interpret vglm output?

2011-11-04 Thread Akram Khaleghei Ghosheh balagh
Hello , I need to estimate the parameters of generalized poisson regression model. I found that I could use : vglm(formula, family,.., data), but I dont know how to interpret the output!!! min 1Q Median 3Q Max elogit (lambda)-.66 -.61

[R] ANCOVA with many levels of one factor

2011-11-04 Thread suzzy
I am trying to do and ANCOVA with ten sites that I want to compare condition at, with Length as a covariate. Most examples I have found only deal with two levels and I am unsure if the same code applies for more than two levels. Here is what I have, and I just wanted to double check that I am on t

[R] Unused Arguments Error Even Though I'm Using Them?

2011-11-04 Thread Christopher Simons
Greetings, I am running into an error I can't seem to get past; something tells me I am making an obvious mistake as I am new to R, but everything looks fine to me. Basically, I'm getting the message "unused arguments" even though my arguments are all being used. I have posted my code at the fol

Re: [R] How to use 'prcomp' with CLUSPLOT?

2011-11-04 Thread jo
Hello Michael, Thank you for replying to my post! That was an interesting solution - good to know, but I am now getting a different error: /Error in if (length(clus) != n) stop("The clustering vector is of incorrect length") : argument is of length zero/ which brought me here: https://svn.r-pr

[R] representing wind date using windrose

2011-11-04 Thread Norman Khine
hello, i am new to R and want to use it for a small project to draw a wind data from a microclimate datasource, can someone give me an example of how i can represent this in a neat way? for example, i have: speed, direction 0.3,NNE 0.45,NNE 0.32,NE 0.28,N 0.30,NE how do i put this data to get a w

Re: [R] error message

2011-11-04 Thread JulianaMF
Hello, I am a PhD candidate at University of Sao Paulo, finishing the thesis and know nothing about R language... I am trying to analyze a structure data set (STRs) with 82 samples and 10 loci (missing data = -9) and I keep getting the same Error in text[(last line - n + 1):last line] : only 0's ma

Re: [R] Determining r2 values for a SEM

2011-11-04 Thread Mark Difford
On Nov 04, 2011 at 6:55pm Katherine Stewart wrote: > Is there a way to determine r2 values for an SEM in the SEM package or > another way to get > these values in R? Katherine, rsquare.sem() in package sem.additions will do it for you. Regards, Mark. - Mark Difford (Ph.D.) Research Assoc

Re: [R] Reading parameters from dataframe and loading as objects

2011-11-04 Thread Francois Pepin
Hi, assign is your friend here: apply(data,1,function(x)assign(x[1],x[2],envir = .GlobalEnv)) As a note, you probably don't want to use data as a variable because it overwrites the data function, leading to unwanted side-effects if you ever use it. Cheers, François Pepin Scientist Sequenta,

[R] HoltWinters in R 2.14.0

2011-11-04 Thread TimothyDalbey
Hey All, First time on these forums. Thanks in advance. S... I have a process that was functioning well before the 2.14 update. Now the HoltWinters function is throwing an error whereby I get the following: Error in HoltWinters(sales.ts) : optimization failure I've been looking around

Re: [R] How to delete only those rows in a dataframe in which all records are missing

2011-11-04 Thread Jose Iparraguirre
It does! Thanks, José -Original Message- From: R. Michael Weylandt [mailto:michael.weyla...@gmail.com] Sent: 04 November 2011 15:18 To: Jose Iparraguirre Cc: r-help@r-project.org Subject: Re: [R] How to delete only those rows in a dataframe in which all records are missing Perhaps som

[R] Determining r2 values for a SEM

2011-11-04 Thread K Stewart
Hello, I have been using the SEM package and developed 4 models that all have an adequate fit. I require r2 values for the variables in my SEM and cannot find a way to get r2 values for a SEM. I have attempted using the smc (squared multiple correlation) function, but this only takes the initia

Re: [R] Decision tree model using rpart ( classification

2011-11-04 Thread Andrew Ziem
aajit75 yahoo.co.in> writes: > fit <- rpart(decile ~., method="class", > control=rpart.control(minsplit=min_obs_split, cp=c_c_factor), > data=dtm_ip) > > In A and B target variable 'segment' is from the clustering data using same > set of input variables , while in C target va

Re: [R] 12th Root of a Square (Transition) Matrix

2011-11-04 Thread Peter Langfelder
On Fri, Nov 4, 2011 at 2:37 PM, David Winsemius wrote: > > The 12th (matrix) root of M: e^( 1/n * log(M) ) > >> require(Matrix) >> M1.12 <- expm( (1/12)*logm(M) ) I like this - haven't thought of the matrix algebra functions in Matrix. Thanks, Peter ___

Re: [R] 12th Root of a Square (Transition) Matrix

2011-11-04 Thread David Winsemius
On Nov 4, 2011, at 4:04 PM, Peter Langfelder wrote: Is it just me or are you confusing the 12th root of a matrix with taking the 12th root of each entry? I think I got confused as well. Thanks for clarifying. Because your formula involving the eigenvectors and eigenvalues calculates the 12t

Re: [R] Lattice plots and missing x-axis labels on second page

2011-11-04 Thread David Winsemius
On Nov 2, 2011, at 8:23 PM, Evans, David G (DFG) wrote: I should say I'm using Windows-7, R version 2.13.0 and lattice version 0.19-33. I've pared down my code to this : pdat = read.table("RGRAPHSDGE.csv",header=T,sep=",",fill=T) print(xyplot(pdat$NITRATE~pdat$DATEYR|pdat$WELL, I generally

Re: [R] Lattice plots and missing x-axis labels on second page

2011-11-04 Thread David Winsemius
On Nov 2, 2011, at 8:23 PM, Evans, David G (DFG) wrote: I should say I'm using Windows-7, R version 2.13.0 and lattice version 0.19-33. I've pared down my code to this : pdat = read.table("RGRAPHSDGE.csv",header=T,sep=",",fill=T) print(xyplot(pdat$NITRATE~pdat$DATEYR|pdat$WELL, I generally

Re: [R] nproc parameter in efpFunctional

2011-11-04 Thread Achim Zeileis
On Fri, 4 Nov 2011, bonda wrote: The 2006 CSDA paper is really very informative, perhaps, I'm trying to understand the things lying beyond. If we have e.g. k=3, then taking nproc=3 for the functional maxBB we get a critical value (boundary) maxBB$computeCritval(0.05,nproc=3) [1] 1.544421, an

Re: [R] 12th Root of a Square (Transition) Matrix

2011-11-04 Thread Peter Langfelder
Is it just me or are you confusing the 12th root of a matrix with taking the 12th root of each entry? Because your formula involving the eigenvectors and eigenvalues calculates the 12th root of the matrix, while round(nth_root^12,4) will print out a matrix whose components are powers of 12 of the

Re: [R] 12th Root of a Square (Transition) Matrix

2011-11-04 Thread David Winsemius
On Nov 4, 2011, at 6:34 AM, clangkamp wrote: I have tried this method, but the result is not working, at least not as I expect: I used the CreditMetrics package transition matrix rc <- c("AAA", "AA", "A", "BBB", "BB", "B", "CCC", "D") M <- matrix(c(90.81, 8.33, 0.68, 0.06, 0.08, 0.02, 0.01, 0

Re: [R] barplot as histogram

2011-11-04 Thread Jesse Brown
I believe that plot(..., type='h') will do the trick. I had tried that earlier but forgot to play with the lwd parameter. Incidentally, I didn't know about getAnywhere(hist.default) - really handy. I was reading the code to find the details. Thanks! Jesse R. Michael Weylandt wrote: Perh

Re: [R] Fit continuous distribution to truncated empirical values

2011-11-04 Thread David Winsemius
On Nov 3, 2011, at 7:54 AM, Michele Mazzucco wrote: Hi all, I am trying to fit a distribution to some data about survival times. I am interested only in a specific interval, e.g., while the data lies in the interval (0,, 600), I want the best for the interval (0,..., 24). I have trie

[R] Random multinomial variable

2011-11-04 Thread Scott Raynaud
I need some help interpreting the following code which is part of a mutlilevel model simulation with 2 levels.  I've put in comments with my understanding of the code, but I'm not sure how [i2id] is functioning.  It's defined in another part of the program as l2id<-rep(c(1:n2),each=n1) which loo

Re: [R] barplot as histogram

2011-11-04 Thread Duncan Murdoch
On 04/11/2011 2:04 PM, Jesse Brown wrote: Hello: I'm dealing with an issue currently that I'm not sure the best way to approach. I've got a very large (10G+) dataset that I'm trying to create a histogram for. I don't seem to be able to use hist directly as I can not create an R vector of size gr

Re: [R] barplot as histogram

2011-11-04 Thread R. Michael Weylandt
Perhaps plot(xs, ys, type = "h", lwd = 3) will work? I'm not sure that a direct call to hist(, plot = F) will get around the data problems. If you type getAnywhere(hist.default) you can see the code that runs hist(): perhaps you can extract the working bits you need. Michael On Fri, Nov 4, 201

[R] barplot as histogram

2011-11-04 Thread Jesse Brown
Hello: I'm dealing with an issue currently that I'm not sure the best way to approach. I've got a very large (10G+) dataset that I'm trying to create a histogram for. I don't seem to be able to use hist directly as I can not create an R vector of size greater than 2.2G. I considered condensin

[R] Plotting skewed normal distribution with a bar plot

2011-11-04 Thread R. Michael Weylandt
You might want to check again: I'm running fGarch on 2.13.2, Mac OSX 10.5.8. Michael On Fri, Nov 4, 2011 at 9:36 AM, Steve Friedman wrote: > Hi Michael, > > Thanks for pointing me fGarch.  I actually started there, but it is not yet > available for 2.13.2 so I went directly to the (sn-package).

Re: [R] query about counting rows of a dataframe

2011-11-04 Thread David Winsemius
On Nov 3, 2011, at 12:28 PM, Stefano Sofia wrote: Dear R users, I have got the following data frame, called my_df: gender day_birth month_birth year_birth labour 1 F 22 10 2001 1 2 M29 10

Re: [R] zoo performance regression noticed (1.6-5 is faster...)

2011-11-04 Thread Gabor Grothendieck
On Fri, Nov 4, 2011 at 12:56 PM, Gabor Grothendieck wrote: > On Fri, Nov 4, 2011 at 12:34 PM, James Marca > wrote: >> Good morning, >> >> I have discovered what I believe to be a performance regression >> between Zoo 1.6x and Zoo 1.7-6 in the application of rollapply. >> On zoo 1.6x, rollapply of

Re: [R] Decision tree model using rpart ( classification

2011-11-04 Thread Tal Galili
Could you please repeat the error massage you get for C ? Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (Engli

Re: [R] zoo performance regression noticed (1.6-5 is faster...)

2011-11-04 Thread Gabor Grothendieck
On Fri, Nov 4, 2011 at 12:34 PM, James Marca wrote: > Good morning, > > I have discovered what I believe to be a performance regression > between Zoo 1.6x and Zoo 1.7-6 in the application of rollapply. > On zoo 1.6x, rollapply of my function over my data takes about 20 > minutes. Using 1.7-6, the

[R] zoo performance regression noticed (1.6-5 is faster...)

2011-11-04 Thread James Marca
Good morning, I have discovered what I believe to be a performance regression between Zoo 1.6x and Zoo 1.7-6 in the application of rollapply. On zoo 1.6x, rollapply of my function over my data takes about 20 minutes. Using 1.7-6, the same code takes about 6 hours. R --version R version 2.13.1 (2

Re: [R] Select some, but not all, variables stepwise

2011-11-04 Thread Frank Harrell
Why do any of that? Those procedures are statistically invalid. Frank AndreE wrote: > > Thanks Francisco - I've actually realized that ?step can do pretty much > exactly what I want. > Andre > - Frank Harrell Department of Biostatistics, Vanderbilt University -- View this message in conte

Re: [R] replace double backslash with singel backslash

2011-11-04 Thread Jeff Newmiller
A) you wrote // when you meant \\. This behavior does not apply to forward slash. B) if you want the ability to represent any arbitrary character in a string, some version of this feature is required. Visual Basic doesn't allow arbitrary characters unless you concatenate chr() function calls, t

Re: [R] Select some, but not all, variables stepwise

2011-11-04 Thread AndreE
Thanks Francisco - I've actually realized that ?step can do pretty much exactly what I want. Andre -- View this message in context: http://r.789695.n4.nabble.com/Select-some-but-not-all-variables-stepwise-tp3990002p3990516.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] How to delete only those rows in a dataframe in which all records are missing

2011-11-04 Thread R. Michael Weylandt
Perhaps something like this will work. df[!(rowSums(is.na(df))==NCOL(df)),] Michael On Fri, Nov 4, 2011 at 9:27 AM, Jose Iparraguirre wrote: > Hi, > > Imagine I have the following data frame: > >> a <- c(1,NA,3) >> b <- c(2,NA,NA) >> c <- data.frame(cbind(a,b)) >> c >   a  b > 1  1  2 > 2 NA NA

Re: [R] Counting number of common elements between the rows of two different matrices

2011-11-04 Thread Parodi, Pietro
Jim I tried that and it works. Thank you very much for your help! Regards Pietro -Original Message- From: jim holtman [mailto:jholt...@gmail.com] Sent: 04 November 2011 13:38 To: Parodi, Pietro Cc: r-help@r-project.org Subject: Re: [R] Counting number of common elements between the ro

[R] survfit function?

2011-11-04 Thread Ying Zhou
Hi, I am working on fitting a proportional hazard model to predict the probability of default for mortgage loans. I have a question regarding survfit function. My historical data set is a pool of loans with monthly observed default status for the next 24 months. The data is left truncated (d

[R] How to delete only those rows in a dataframe in which all records are missing

2011-11-04 Thread Jose Iparraguirre
Hi, Imagine I have the following data frame: > a <- c(1,NA,3) > b <- c(2,NA,NA) > c <- data.frame(cbind(a,b)) > c a b 1 1 2 2 NA NA 3 3 NA I want to delete the second row. If I use na.omit, that would also affect the third row. I tried to use a loop and an ifelse clause with is.na to get

Re: [R] Select some, but not all, variables stepwise

2011-11-04 Thread Francisco Mora Ardila
Hi Andre I don´t know if it will work, but I´ve tried the MuMIn package, were you can evaluate all possible models (usin for example AIC) at one time. Maybe you can focus on comparing those models which retain the explanators you want. Best wishes Francisco On Fri, 4 Nov 2011 13:06:09 +,

[R] How to write a shapefile with projection - problem solved

2011-11-04 Thread Monica Pisica
Hi, Sorry i have put such a detailed question to the list about writing a shapefile with projection. I realized that if i use writeOGR from rgdal and not the other write shapefile functions i can get a shapefile with projection recognized by ArcGIS. The command is (in case anybody wonders):  

Re: [R] Plotting skewed normal distribution with a bar plot

2011-11-04 Thread boylangc
Steve, I don't profess to be an expert in R (by ANY means), but I've used the sn.mle function in package sn to do something similar. So, for example, if you have data (y), you can do the following: y = c(5,4,6,4,5,6,7,7,55,64,23,13,1,4,1,14,1,15,11,12) sn.mle(y=y) I just made up this stream

Re: [R] nproc parameter in efpFunctional

2011-11-04 Thread bonda
The 2006 CSDA paper is really very informative, perhaps, I'm trying to understand the things lying beyond. If we have e.g. k=3, then taking nproc=3 for the functional maxBB we get a critical value (boundary) maxBB$computeCritval(0.05,nproc=3) [1] 1.544421, and this for nproc=NULL (Bonferroni appr

Re: [R] 12th Root of a Square (Transition) Matrix

2011-11-04 Thread clangkamp
I have tried this method, but the result is not working, at least not as I expect: I used the CreditMetrics package transition matrix rc <- c("AAA", "AA", "A", "BBB", "BB", "B", "CCC", "D") M <- matrix(c(90.81, 8.33, 0.68, 0.06, 0.08, 0.02, 0.01, 0.01, 0.70, 90.65, 7.79, 0.64, 0.06, 0.13, 0.02, 0.0

[R] formatting a dataframe

2011-11-04 Thread ATANU
http://r.789695.n4.nabble.com/file/n3989638/tab3.gif i want to create a dataframe like the one given in the pictures having names of sub categories of columns. the table may be presented either in the console or in an excel sheet. anyone please suggest me a technique. thanks in advance. -atanu

Re: [R] How to use 'prcomp' with CLUSPLOT?

2011-11-04 Thread R. Michael Weylandt
Hello Jo, Full disclosure: I don't know much about clustering/partition cluster analysis/etc so I've only attacked this as an R problem. However, this might get you going in the right direction: df <- read.table(textConnection("PRVID,VAR1,VAR2,VAR3,VAR4,VAR5,VAR6,VAR7,VAR8,VAR9,VAR10,VAR11 PRV1,

[R] How to write a shapefile with projection

2011-11-04 Thread Monica Pisica
Hi,   I am trying to write a shapefile with projection. I have my data in a data.frame called try and consists in xy coordinates and a numerical attribute value z1.   Libraries loaded are: sp, rgdal, raster, maptools   head(try) x       y                    z1 1 610237.1    

Re: [R] replace double backslash with singel backslash

2011-11-04 Thread Gene Leynes
I think that people are afraid to say "You can't do that in R"... But I think the real answer is: you can't do that in R. Although, it is helpful to understand Jeff's reply. I hadn't fully realized why this particular problem occurs before reading that. It's odd to me that // and / are both stor

Re: [R] replace double backslash with singel backslash

2011-11-04 Thread Jeff Newmiller
Your str does not have any double backslashes to replace. You need to revisit the concept of escape characters in the documentation. In brief, every "\\" in a quoted string is actually a single character as stored in memory.

Re: [R] Counting number of common elements between the rows of two different matrices

2011-11-04 Thread jim holtman
Try this: # create dummy data a <- matrix(sample(20, 50, TRUE), ncol = 5) b <- matrix(sample(20, 50, TRUE), ncol = 5) # create combinations to test x <- expand.grid(seq(nrow(a)), seq(nrow(b))) # test result <- mapply(function(m1, m2) any(a[m1, ] %in% b[m2, ]) , x[, 1] , x[,

Re: [R] replace double backslash with singel backslash

2011-11-04 Thread Michael Friendly
On 11/4/2011 5:35 AM, Kay Cichini wrote: I want to replace \\ with \ in: str<- "C:\\DOKUME~1\\u0327336\\LOKALE~1\\Temp\\RtmpQ5NJ8X\\TIRIS_PICS\\1_Img.jpg" and tried: gsub("", "\\", str) but this removes the \\ without replacing them by \ You may be able to avoid this simply by using forw

Re: [R] Plotting skewed normal distribution with a bar plot

2011-11-04 Thread Steve Friedman
Hi Michael, Thanks for pointing me fGarch. I actually started there, but it is not yet available for 2.13.2 so I went directly to the (sn-package). I've briefly explored your suggestion and think it will work. Thanks Steve On Nov 3, 2011 10:41 PM, "R. Michael Weylandt" wrote: > It seems like

Re: [R] Select some, but not all, variables stepwise

2011-11-04 Thread Frank Harrell
Resist the temptation. Stepwise analysis without shrinkage will ruin model inferences without helping with predictive accuracy. Frank AndreE wrote: > > Hi, > > I would like to fit a linear model where some but not all explanators are > chosen stepwise - ie I definitely want to include some term

[R] Select some, but not all, variables stepwise

2011-11-04 Thread Andre Easom
Hi, I would like to fit a linear model where some but not all explanators are chosen stepwise - ie I definitely want to include some terms, but others only if they are deemed significant (by AIC or whatever other approach is available). For example if I wanted to definitely include x1 and x2,

[R] Counting number of common elements between the rows of two different matrices

2011-11-04 Thread Parodi, Pietro
Hello I'm trying to solve this problem without using a for loop but I have so far failed to find a solution. I have two matrices of K columns each, e.g. (K=5), and with numbers of row N_A and N_B respectively A = (1 5 3 8 15; 2 7 20 11 13; 12 19 20 21 43) B = (2 6 30

Re: [R] Extract Data from Yahoo Finance

2011-11-04 Thread Joshua Ulrich
Deb, Sorry, you can't do that with getQuote because Yahoo does not make those data available historically. Generally, you will need to pay for historical bid/ask (tick) data. Best, -- Joshua Ulrich  |  FOSS Trading: www.fosstrading.com On Fri, Nov 4, 2011 at 6:10 AM, Deb Midya wrote: > Joshu

Re: [R] replace double backslash with singel backslash

2011-11-04 Thread Jim Holtman
what is the problem that you are trying to solve? you need the double \\ since they have a special meaning in quoted strings. in this case they represent a since backslash. if you really had a single one, then something like this '\n' would be a carriage return. Sent from my iPad On Nov 4

[R] array manipulation

2011-11-04 Thread Simone Salvadei
This worked example, hoping to be helpful, has been requested after a (my) further enquiry about array manipulation. I was looking for a command that is equivalent to repmat() in matlab and that could also be applied to array. (for Matlab users) The Matlal code was the following: 1)temp_u=zeros

Re: [R] Decision tree model using rpart ( classification

2011-11-04 Thread aajit75
Hi, Thanks for the responce, code for each case is as: c_c_factor <- 0.001 min_obs_split <- 80 A) fit <- rpart(segment ~., method="class", control=rpart.control(minsplit=min_obs_split, cp=c_c_factor), data=Beh_cluster_out) B) fit <- rpart(segment ~., method="class",

[R] replace double backslash with singel backslash

2011-11-04 Thread Kay Cichini
I want to replace \\ with \ in: str <- "C:\\DOKUME~1\\u0327336\\LOKALE~1\\Temp\\RtmpQ5NJ8X\\TIRIS_PICS\\1_Img.jpg" and tried: gsub("", "\\", str) but this removes the \\ without replacing them by \ Any help much appreciated, Kay - Kay Cichini Postgraduate studen

[R] array manipulation

2011-11-04 Thread Simone Salvadei
This worked example, hoping to be helpful, has been requested after a (my) further enquiry about array manipulation. I was looking for a command that is equivalent to repmat() in matlab and that could also be applied to array. (for Matlab users) The Matlal code was the following: temp_u=zeros(d

Re: [R] how to count number of occurrences

2011-11-04 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of uka > Sent: Thursday, November 03, 2011 4:10 PM > To: r-help@r-project.org > Subject: Re: [R] how to count number of occurrences > > This was very helpful. Thank you very much. J

Re: [R] Reading parameters from dataframe and loading as objects

2011-11-04 Thread Eric Lecoutre
Hi, Did you program in SAS previously? :) You don't really want data.frame but a named list (note that data frames are lists but for columns). mypars <- as.list(value) names(mypars) <- param mypars$max_pct If you really want to use data.frame you can assign rownames and access parameters throu

Re: [R] Decision tree model using rpart ( classification

2011-11-04 Thread Tal Galili
Hi Ajit, Please send the code you are running in each case. Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (Engl

[R] Reading parameters from dataframe and loading as objects

2011-11-04 Thread Aher
Hi List, I want to read several parameters from data frame and load them as object into R session, Is there any package or function in R for this?? Here is example param <-c("clust_num", "minsamp_size", "maxsamp_size", "min_pct", "max_pct") value <-c(15, 2, 20, 0.001, .999) data <- d

[R] Decision tree model using rpart ( classification

2011-11-04 Thread aajit75
Hi Experts, I am new to R, using decision tree model for getting segmentation rules. A) Using behavioural data (attributes defining customer behaviour, ( example balances, number of accounts etc.) 1. Clustering: Cluster behavioural data to suitable number of clusters 2. Decision Tree: Using rpart