Re: [R] Multiple Multivariate regression in R with 50 independent variables

2013-04-19 Thread peter dalgaard
On Apr 18, 2013, at 21:24 , Nilesh Gupta wrote: Hello all Is there a method/package in R in which I can do regressions for more than 50 independent variables ? What's wrong with lm() et al.? -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3,

Re: [R] mgcv: how select significant predictor vars when using gam(...select=TRUE) using automatic optimization

2013-04-19 Thread jholstei
Simon, that was very instructive—very special thanks to you. I already noticed that the model was bad, but it was not clear to me that transformation of predictors to, say a more centered distribution is helpful here. And thanks for pointing out Tweedie, I noticed that the error structure is

Re: [R] Multiple Multivariate regression in R with 50 independent variables

2013-04-19 Thread Nilesh Gupta
lm() does not accomodate more than 50 independent variables The woods are lovely, dark and deep But I have promises to keep And miles before I go to sleep And miles before I go to sleep - On Fri, Apr 19, 2013 at 12:26 PM, peter dalgaard pda...@gmail.com wrote: On Apr 18, 2013, at 21:24 ,

Re: [R] Multiple Multivariate regression in R with 50 independent variables

2013-04-19 Thread David Winsemius
On Apr 19, 2013, at 12:40 AM, Nilesh Gupta wrote: lm() does not accomodate more than 50 independent variables What is your source for this misinformation? dat - as.data.frame(matrix(rnorm(51000), ncol=51) ) names(dat) [1] V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17

[R] EDCR build from source with namespace problem

2013-04-19 Thread ltdm
Hi R community, I am running R version 2.15.3 (2013-03-01) -- Security Blanket on a Linux Ubuntu 12.10 i686 I tried to install EDCR from : ftp://orpheus.pfeg.noaa.gov/outgoing/EDC/R/EDCR_1.0_R_i686-pc-linux-gnu.tar.gz Dependencies (namely ncdf4) are installed. Install goes fine (at list it seems

Re: [R] How to read a direct access file by connecting fortran with R ?

2013-04-19 Thread Kaptue Tchuente, Armel
Dear Suzen, Thank you for your reply. I don't know why but it looks like my previous mail was truncated. Here is the R function (described in the step #4 in my previous mail) that I wrote. It contains .Fortran but like I said earlier, it didn't work.

Re: [R] avoid losing data.frame attributes on cbind()

2013-04-19 Thread Liviu Andronic
Dear Arun, On Tue, Apr 16, 2013 at 10:45 PM, arun smartpink...@yahoo.com wrote: Another method would be: Xc- Xa Xc$var1-NA; Xc$var2- NA Xc[]- append(as.list(Xa),as.list(Xb)) Unfortunately this is still too convoluted and error prone. And mutate() doesn't work for me, as I generate the new

[R] how to measure similarity between vectors of different length

2013-04-19 Thread Simone Gabbriellini
Dear R-People, I am trying to measure distances between an empiric vector and two random vectors. Since one of the synthetic vectors has different length from the empirical one, I tried to introduce 0s to make all vectors have the same length, but this introduces a bias in the measurement.

Re: [R] Multiple Multivariate regression in R with 50 independent variables

2013-04-19 Thread peter dalgaard
But that's not how to specify a multivariate regression. It's a univariate regression with a huge sum on the left hand side. On Apr 19, 2013, at 13:51 , Nilesh Gupta wrote: I used this link http://r.789695.n4.nabble.com/model-frame-and-formula-mismatch-in-model-matrix-td4664093.html

Re: [R] How to create a loop to test the condition?

2013-04-19 Thread arun
Hi, I am not sure I understand your question correctly. set.seed(25) mydata- data.frame(vol3=sample(1:20,20,replace=TRUE),vol4=sample(5:45,20,replace=TRUE),vol15=sample(25:50,20,replace=TRUE),vol20=sample(30:60,20,replace=TRUE),week=rep(1:4,each=5)) funct- function(target,data=NULL){ target-

Re: [R] Singular design matrix in rq

2013-04-19 Thread Roger Koenker
Jonathan, This is not what we call a reproducible example... what is raw_data? Does it have something to do with mydata? what is i? Roger url:www.econ.uiuc.edu/~rogerRoger Koenker emailrkoen...@uiuc.eduDepartment of Economics vox: 217-333-4558

Re: [R] efficiently diff two data frames

2013-04-19 Thread Liviu Andronic
Dear Rui, Thanks for the pointer. On Tue, Apr 16, 2013 at 8:12 PM, Rui Barradas ruipbarra...@sapo.pt wrote: setdiffDF2 - function(A, B){ f - function(X, Y) !duplicated(rbind(Y, X))[nrow(Y) + 1:nrow(X)] ix1 - f(A, B) ix2 - f(B, A) ix1 ix2 } ix - setdiffDF2(Xe, Xf)

Re: [R] Singular design matrix in rq

2013-04-19 Thread Jonathan Greenberg
Roger: Doh! Just realized I had that error in the code -- raw_data is the same as mydata, so it should be: mydata - read.csv(singular.csv) plot(mydata$predictor,mydata$response) # A big cloud of points, nothing too weird summary(mydata) # No NAs: # Xresponse predictor

[R] Returning overall ms for CVlm

2013-04-19 Thread ben1983
Hi All, when doing CVlm cross validation, I would just like to view the overall MS but i am having trouble getting just this value. I'm kina new to R. Any help really appreciates. Cheers, Ben -- View this message in context:

[R] Sequence analysis

2013-04-19 Thread ben1983
Hiya, I am trying to look at the similarities between a number of sequences, for example i am trying to see how similar ababbbassdaa is to addffggssbbsbbs I was wondering is the some way for me to see how similar they are in terms of, for example, number of a's, number of b's, how

Re: [R] Multiple Multivariate regression in R with 50 independent variables

2013-04-19 Thread Nilesh Gupta
I used this link http://r.789695.n4.nabble.com/model-frame-and-formula-mismatch-in-model-matrix-td4664093.html Regards The woods are lovely, dark and deep But I have promises to keep And miles before I go to sleep And miles before I go to sleep - On Fri, Apr 19, 2013 at 2:19 PM, David

Re: [R] EDCR build from source with namespace problem

2013-04-19 Thread Roy Mendelssohn - NOAA Federal
Several changes in R and in Java broke the code in EDCR. We have in beta a new version that fixes these problems. I will be certain to let you know when it is ready. -Roy M. On Apr 19, 2013, at 4:11 AM, ltdm luis.tito-de-mor...@ird.fr wrote: Hi R community, I am running R version

[R] extracting the diagonal of an inverse matrix

2013-04-19 Thread Camarda, Carlo Giovanni
Dear R-users, I would like to know whether there is a way to extract a diagonal of an inverse matrix without computing the inverse of the matrix itself. The size of my matrices are really huge and, also using sparse matrix, computing the inverse leads to storage problems and low speed. In

[R] 3D Histograms on a Geographical Map

2013-04-19 Thread Lorenzo Isella
Dear All, I like very much figure 2.a) and 2.b) of this paper http://www.nature.com/srep/2013/130410/srep01640/pdf/srep01640.pdf and I probably need a similar visualization. Is anything like that doable in R? I have some experience with R and gadm (gadm.org), but that is only to produce maps

[R] NAMESPACE and imports

2013-04-19 Thread Frank Harrell
I am cleaning up the rms package to not export functions not to be called directly by users. rms uses generic functions defined in other packages. For example there is a latex method in the Hmisc package, and rms has a latex method for objects of class anova.rms so there are anova.rms and

Re: [R] 3D Histograms on a Geographical Map

2013-04-19 Thread Barry Rowlingson
On Fri, Apr 19, 2013 at 3:13 PM, Lorenzo Isella lorenzo.ise...@gmail.com wrote: Dear All, I like very much figure 2.a) and 2.b) of this paper http://www.nature.com/srep/2013/130410/srep01640/pdf/srep01640.pdf and I probably need a similar visualization. Is anything like that doable in R? I

Re: [R] Sequence analysis

2013-04-19 Thread arun
Hi, May be library(Biostrings) from Bioconductor helps you. source(http://bioconductor.org/biocLite.R;) biocLite(Biostrings) ?matchPattern() ?letterFrequency() vec1- ababbbassdaa alphabetFrequency(DNAString(vec1)) #A C G T M R W S Y K V H D B N - + #5 0 0 0 0 0 0 2 0 0 0 0 1 4 0 0 0

[R] Reading CSV file

2013-04-19 Thread Gafar Matanmi Oyeyemi
I am trying to read a csv file using the code; contol - read.csv(RBS.csv) This is the error message I got; Error in file(file, r) : unable to open connection In addition: Warning message: In file(file, r) : cannot open file 'RBS.csv', reason 'No such file or directory' Where was the mistake? --

Re: [R] Reading CSV file

2013-04-19 Thread Steve Friedman
Make sure you have the correct path to the file. On Apr 19, 2013 10:53 AM, Gafar Matanmi Oyeyemi gmoyey...@gmail.com wrote: I am trying to read a csv file using the code; contol - read.csv(RBS.csv) This is the error message I got; Error in file(file, r) : unable to open connection In

Re: [R] Reading CSV file

2013-04-19 Thread Charles Determan Jr
Are you sure the file is in your current working directory? Often people simply put the full path such as /Users/Name/RBS.csv Cheers, On Fri, Apr 19, 2013 at 9:30 AM, Gafar Matanmi Oyeyemi gmoyey...@gmail.comwrote: I am trying to read a csv file using the code; contol - read.csv(RBS.csv)

Re: [R] Reading CSV file

2013-04-19 Thread Bretschneider SIG-R
Dear Gafar Matanmi Oyeyemi, Re: I am trying to read a csv file using the code; contol - read.csv(RBS.csv) This is the error message I got; Error in file(file, r) : unable to open connection In addition: Warning message: In file(file, r) : cannot open file 'RBS.csv', reason 'No such file

Re: [R] NAMESPACE and imports

2013-04-19 Thread Blaser Nello
Not sure this fixes your problem, but as far as I can know (and can tell from the manual: http://cran.r-project.org/doc/manuals/r-release/R-exts.pdf), importFrom needs to know what functions you are importing [e.g. importFrom(Hmisc, latex) importFrom(stats, anova)]. -Original

Re: [R] NAMESPACE and imports

2013-04-19 Thread Hadley Wickham
Hi Frank, The problem is you can't lump together multiple S3 methods. Instead of: S3method(latex, anova.rms, bj, cph, Glm, Gls, lrm, naprint.delete, ols, pphsm, psm, rms, Rq, summary.rms, validate) You need S3method(latex, anova.rms) S3method(latex, bj) S3method(latex, cph) etc. Hadley

Re: [R] NAMESPACE and imports

2013-04-19 Thread Frank Harrell
Right, I should have said import(Hmisc) instead of importFrom(Hmisc), but that does not explain the error message. Blaser Nello wrote Not sure this fixes your problem, but as far as I can know (and can tell from the manual: http://cran.r-project.org/doc/manuals/r-release/R-exts.pdf),

Re: [R] 3D Histograms on a Geographical Map

2013-04-19 Thread ilai
Also combining the code for figures 6.5, 13.8 and 13.9 in the following link http://lmdvr.r-forge.r-project.org/figures/figures.html gets you there. On Fri, Apr 19, 2013 at 8:38 AM, Barry Rowlingson b.rowling...@lancaster.ac.uk wrote: On Fri, Apr 19, 2013 at 3:13 PM, Lorenzo Isella

Re: [R] avoid losing data.frame attributes on cbind()

2013-04-19 Thread arun
Dear Liviu, May be you can use the method mentioned in the link: http://stackoverflow.com/questions/10404224/how-to-delete-a-row-from-a-data-frame-without-losing-the-attributes str(Xa) #'data.frame':    150 obs. of  5 variables: # $ Sepal.Length: num  5.1 4.9 4.7 4.6 5 5.4 4.6 5 4.4 4.9 ... # $

Re: [R] count each answer category in each column

2013-04-19 Thread Ye Lin
Thanks David! I do get confused sometimes when sth can be easily and directly done in Excel which is what I am familiar with, but I find it takes more time for me to operate that in R. On Thu, Apr 18, 2013 at 4:27 PM, David Winsemius dwinsem...@comcast.netwrote: On Apr 18, 2013, at 3:46 PM,

Re: [R] Multiple Multivariate regression in R with 50 independent variables

2013-04-19 Thread David Winsemius
On Apr 19, 2013, at 4:51 AM, Nilesh Gupta wrote: I used this link http://r.789695.n4.nabble.com/model-frame-and-formula-mismatch-in-model-matrix-td4664093.html But you said 50 independent variables, and that was probably someone's (failed) effort to submit 50 _dependent_ variables. What is

Re: [R] Singular design matrix in rq

2013-04-19 Thread William Dunlap
I believe that those repeated values (more than half your x values are 0.0) are causing bs() problems, because its default knots are at quantiles of the data at equally spaced probabilities. The following may be the same problem: set.seed(1) x - c(rep(0, 20), 1:15) y - sort(rnorm(length(x)))

Re: [R] Multiple Multivariate regression in R with 50 independent variables

2013-04-19 Thread Ranjan Maitra
First, do you know what a multivariate multiple (linear) regression means? As opposed to (univariate) multiple (linear) regression. As others have pointed out, the example referred to is of univariate multiple linear regression. Second, and more importantly, have you yourself tried doing the

Re: [R] count each answer category in each column

2013-04-19 Thread Ye Lin
Thanks A.K Is it possible to apply this to a more complicated situation , for example, I have an ID column for each row, say: ID Gender Age Rate A Female0-10 Good A Male0-10 Good B Female 11-20 Bad B Male 11-20 Bad C Male

[R] Logistic regression

2013-04-19 Thread Endy BlackEndy
Dear colleagues I have a couple of problems related with binary logistic regression. The first problem is how to compute Pearson and Likelihood chi-squeared tests for grouped data. For the same form of data set how to compute sensitivity, specificity and related measures. When I speak about

Re: [R] Multiple Multivariate regression in R with 50 independent variables

2013-04-19 Thread peter dalgaard
On Apr 19, 2013, at 19:15 , Nilesh Gupta wrote: cbind( X1,X2,X3,X4,X5,X6,X7, ... ,X2393,X2394,X2395 )~ R_M_F+SMB+HML+WML I ran this code in the formula for i wanted to regress 2395 stocks for 500 months each on the three independent variables. I got this error . The idea was to run

Re: [R] count each answer category in each column

2013-04-19 Thread arun
Hi, In the example given, there is only one female and one male for ID A. dat1- read.table(text= ID   Gender   Age   Rate  A   Female    0-10   Good   A  Male    0-10   Good   B   Female 11-20  Bad  B   Male 11-20  Bad    C   Male 20 N/A

Re: [R] Arranging two different types of ggplot2 plots with axes lined up

2013-04-19 Thread Dennis Murphy
library(ggplot2) library(gridExtra) #generate test precipitation data year-c(2000,2001,2002,2003,2004) precip-c(46,100,80,74,20) yp-data.frame(year, precip) #generate test fecal coliform data year2-c(2000,2000,2000,2000,2000,2000,2000,2000,2000,2000,

Re: [R] NAMESPACE and imports

2013-04-19 Thread Frank Harrell
Now I see it. S3method() wants two arguments so I need to create multiple S3method() statements for each generic. Frank Frank Harrell wrote Right, I should have said import(Hmisc) instead of importFrom(Hmisc), but that does not explain the error message. Blaser Nello wrote Not sure this

Re: [R] NAMESPACE and imports

2013-04-19 Thread Prof Brian Ripley
On 19/04/2013 19:16, Frank Harrell wrote: Now I see it. S3method() wants two arguments so I need to create multiple S3method() statements for each generic. Sort of. It actually accepts two or three arguments: see package 'tools' for an example of using three. Frank Frank Harrell wrote

[R] Logistic Regression

2013-04-19 Thread Endy BlackEndy
Please read the attach file. Thank you Endy __ 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,

Re: [R] Logistic Regression

2013-04-19 Thread David Winsemius
On Apr 19, 2013, at 11:45 AM, Endy BlackEndy wrote: Please read the attach file. Please re-read : http://www.r-project.org/mail.html#instructions Thank you Endy __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Arranging two different types of ggplot2 plots with axes lined up

2013-04-19 Thread Saalem Adera
Hi all, Thanks for the quick replies. Dennis - I tried rotating the y-axis tick labels 90 degrees and while the x-axes became the same width, the x-axis values still didn't line up with each other. So maybe I need to be more clear - how can I get the x-axis tick values to line up? For example,

[R] how to subtotal by rows

2013-04-19 Thread shyam basnet
Dear R-users, I have a dataset as like below, and I want to subtotal the values of rice,wheat and maize by year for each fid. fid      year     rice     wheat      maize 1        1995      5        NA           NA 1        1995      NA        3

Re: [R] Multiple Multivariate regression in R with 50 independent variables

2013-04-19 Thread Nilesh Gupta
The beta shall be 4X2398 because there shall be an additional column of the const. which is not fed into the X matrix in R The woods are lovely, dark and deep But I have promises to keep And miles before I go to sleep And miles before I go to sleep - On Fri, Apr 19, 2013 at 10:56 PM, Nilesh

Re: [R] Memory usage reported by gc() differs from 'top'

2013-04-19 Thread Christian Brechbühler
Merci beaucoup Milan, thank you very much Martin and Kjetil for your responses. I appreciate the caveat about virtual memory. I gather that besides resident memory and swap space, it may also include memory mapped files, which don't cost anything. Maybe by pure chance, in my case virtual memory

Re: [R] avoid losing data.frame attributes on cbind()

2013-04-19 Thread Liviu Andronic
Dear Arun, On Fri, Apr 19, 2013 at 6:30 PM, arun smartpink...@yahoo.com wrote: Dear Liviu, May be you can use the method mentioned in the link: http://stackoverflow.com/questions/10404224/how-to-delete-a-row-from-a-data-frame-without-losing-the-attributes This approach is still much too

Re: [R] Multiple Multivariate regression in R with 50 independent variables

2013-04-19 Thread Nilesh Gupta
cbind( X1,X2,X3,X4,X5,X6,X7, ... ,X2393,X2394,X2395 )~ R_M_F+SMB+HML+WML I ran this code in the formula for i wanted to regress 2395 stocks for 500 months each on the three independent variables. I got this error . The idea was to run multivriate regressions on each of these stocks. Error in

Re: [R] Multiple Multivariate regression in R with 50 independent variables

2013-04-19 Thread Nilesh Gupta
Ranjan I have multiple y's(stocks,2300 odd) which i want to run on 3 variables. for 500 months. I assume this is multivariate regression for there are multiple y's and multiple X's as compared to univariate multiple regression wherein there is only one y and there are more than X's. If I were to

[R] Logistic Regression

2013-04-19 Thread Endy BlackEndy
Dear colleagues I have a couple of problems related with binary logistic regression. The first problem is how to compute Pearson and Likelihood chi-squeared tests for grouped data. For the same form of data set how to compute sensitivity, specificity and related measures. When I speak about

Re: [R] how to subtotal by rows

2013-04-19 Thread Rui Barradas
Hello, Try the following. dat - read.table(text = fid year rice wheat maize 11995 5NA NA 11995 NA3 NA 11995 NA NA 2 11996 4NA NA 11996 NA

Re: [R] Multiple Multivariate regression in R with 50 independent variables

2013-04-19 Thread William Dunlap
To avoid the formula handling bug in lm/model.matrix/etc., you can try making the formula shorter. E.g., if you know the names of your response columns, responseCols - c(X1, X2, X3, ..., X2395) try the formula as.matrix(d[, responseCols]) ~ d[,R_M_F] + d[,SMB] + d[,HML] + d[,WML] and do

Re: [R] how to subtotal by rows

2013-04-19 Thread Janesh Devkota
Hello Shyam, This is one way to do it jd1 - read.table(text= fid year rice wheat maize 11995 5NA NA 11995 NA3 NA 11995 NA NA 2 11996 4NA NA 11996

Re: [R] count each answer category in each column

2013-04-19 Thread arun
Hi, Try this: dat1- read.table(text= ID   Gender   Age   Rate  A   Female    0-10   Good   A  Male    0-10   Good   B   Female 11-20  Bad  B   Male 11-20  Bad    C   Male 20 N/A ,sep=,header=TRUE,stringsAsFactors=FALSE,na.strings=N/A) library(plyr)

Re: [R] how to subtotal by rows

2013-04-19 Thread Janesh Devkota
You can also use this short command. library(plyr) ddply(jd1,.(fid,year),colSums,na.rm=T) Janesh On Fri, Apr 19, 2013 at 2:30 PM, Janesh Devkota janesh.devk...@gmail.comwrote: Hello Shyam, This is one way to do it jd1 - read.table(text= fid year rice wheat maize 1

Re: [R] how to subtotal by rows

2013-04-19 Thread Rui Barradas
Hello, You don't need as.matrix(), the following will do. aggregate(dat[, 3:5], by = list(dat$year, dat$fid), FUN = sum, na.rm = TRUE) Rui Barradas Em 19-04-2013 20:24, Rui Barradas escreveu: Hello, Try the following. dat - read.table(text = fid year rice wheat maize 1

Re: [R] how to subtotal by rows

2013-04-19 Thread arun
#or ddply(jd1,.(fid,year),numcolwise(sum,na.rm=TRUE))  # fid year rice wheat maize #1   1 1995    5 3 2 #2   1 1996    4 2 6 #3   2 1995    3 8 4 #4   2 1996    7 6 7 A.K. - Original Message - From: Janesh Devkota janesh.devk...@gmail.com To: shyam

Re: [R] how to subtotal by rows

2013-04-19 Thread Janesh Devkota
Thanks, Arun. I was also trying to come up with that solution. On Fri, Apr 19, 2013 at 2:43 PM, arun smartpink...@yahoo.com wrote: #or ddply(jd1,.(fid,year),numcolwise(sum,na.rm=TRUE)) # fid year rice wheat maize #1 1 19955 3 2 #2 1 19964 2 6 #3 2 19953

Re: [R] Arranging two different types of ggplot2 plots with axes lined up

2013-04-19 Thread David Winsemius
Adding this to the first plot object seems to come pretty close: yp_plot + xlim(1999.6, 2004.4) I also tried adding and subtracting 0.5. It does not appear that 0.4 is an exact solution. -- David On Apr 19, 2013, at 8:49 AM, Saalem Adera wrote: Hi all, Thanks for the quick replies.

[R] tables package - error message of duplicate values

2013-04-19 Thread Santosh
Dear expeRts! when I try summarize data using tabular of tables package.. here is an example.. a - data.frame(a=rep(10,10),b=round(runif(10,10,20)),c=round(runif(10,40,50))) a a b c 1 10 14 44 2 10 17 40 3 10 13 40 4 10 18 40 5 10 11 49 6 10 16 46 7 10 15 43 8 10 19 49 9 10 19 49

[R] Spider Plot

2013-04-19 Thread XINLI LI
Does any one have a sample code for a Spider Plot as attached? Thanks, Xing __ 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

Re: [R] tables package - error message of duplicate values

2013-04-19 Thread John Kane
Are you sure that it is not just telling you that it cannot tabulate on a since it only has one value? John Kane Kingston ON Canada -Original Message- From: santosh2...@gmail.com Sent: Fri, 19 Apr 2013 13:29:05 -0700 To: r-help@r-project.org Subject: [R] tables package - error

Re: [R] Spider Plot

2013-04-19 Thread Janesh Devkota
Xing, I cannot open the attachment. Can you attach the png file or pdf or any other format ? -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of XINLI LI Sent: Friday, April 19, 2013 3:30 PM To: r-help Subject: [R] Spider Plot Does

Re: [R] Spider Plot

2013-04-19 Thread John Kane
Attachment did not make it. The list is picky about what it accepts. txt and pdf both get through as IIRC png. Anyway does ?stars help or it is more complicated? John Kane Kingston ON Canada -Original Message- From: lihaw...@gmail.com Sent: Fri, 19 Apr 2013 14:29:58 -0600 To:

Re: [R] tables package - error message of duplicate values

2013-04-19 Thread David Winsemius
On Apr 19, 2013, at 1:29 PM, Santosh wrote: Dear expeRts! when I try summarize data using tabular of tables package.. here is an example.. a - data.frame(a=rep(10,10),b=round(runif(10,10,20)),c=round(runif(10,40,50))) a a b c 1 10 14 44 2 10 17 40 3 10 13 40 4 10 18 40 5

Re: [R] Spider Plot

2013-04-19 Thread Hasan Diwan
install.packages('psych', repos='http://cran.rstudio.com', dep=TRUE) require(psych) spider(y=1,x=2:9,data=Thurstone) On 19 April 2013 22:29, XINLI LI lihaw...@gmail.com wrote: Does any one have a sample code for a Spider Plot as attached? Thanks, Xing

Re: [R] tables package - error message of duplicate values

2013-04-19 Thread Santosh
Rounding was done to replicate the problem I faced in the original data set... 2 independent identifiers in a group (shown only for 1 of 7 groups) may have same value of b or c. On Fri, Apr 19, 2013 at 1:53 PM, David Winsemius dwinsem...@comcast.netwrote: On Apr 19, 2013, at 1:29 PM, Santosh

Re: [R] Arranging two different types of ggplot2 plots with axes lined up

2013-04-19 Thread David Winsemius
On Apr 19, 2013, at 2:06 PM, Saalem Adera wrote: Thanks! I really appreciate everyone's help. I was able to get the x-axes ticks very close (close enough!) to lining up on the test data using both Dennis and David's code. So, I've got a work-around. However, I need to do this same

Re: [R] tables package - error message of duplicate values

2013-04-19 Thread David Winsemius
On Apr 19, 2013, at 2:03 PM, Santosh wrote: Rounding was done to replicate the problem I faced in the original data set... I got an error every time I tried to use digits=0. My basic rule is that if a parameter choice consistently errors out ... stop using it. I'm fundamentally a pragmatist.

Re: [R] extracting the diagonal of an inverse matrix

2013-04-19 Thread Greg Snow
This link http://math.stackexchange.com/questions/18488/diagonal-of-an-inverse-of-a-sparse-matrix might help. It is about sparse matrices, but the general idea should be able to be extended to non-sparse matrices as well. On Fri, Apr 19, 2013 at 8:13 AM, Camarda, Carlo Giovanni

Re: [R] how to subtotal by rows

2013-04-19 Thread arun
Hi Janesh, There is a difference in output between these : ddply(jd1,.(fid,year),colSums,na.rm=T)  #especially the first two columns #  fid year rice wheat maize #1   3 5985    5 3 2 #2   3 5988    4 2 6 #3   6 5985    3 8 4 #4   6 5988    7 6 7  

Re: [R] count each answer category in each column

2013-04-19 Thread arun
Hi, Try this: dat1- read.csv(Ye.csv,header=TRUE,stringsAsFactors=FALSE,sep=,,na.strings=N/A) library(plyr) library(reshape2) lst1-lapply(seq(2,ncol(dat1)),function(i) {x1-

Re: [R] how to subtotal by rows

2013-04-19 Thread arun
HI, If you wanted to use colSums, may be this works: ddply(jd1,.(fid,year),function(x) colSums(x[,-c(1,2)],na.rm=TRUE)) #  fid year rice wheat maize #1   1 1995    5 3 2 #2   1 1996    4 2 6 #3   2 1995    3 8 4 #4   2 1996    7 6 7 A.K. - Original Message

Re: [R] tables package - error message of duplicate values

2013-04-19 Thread Santosh
Dear Rxperts! Thanks for the suggestions...(esp. Dr. Mathemedician)! :) I add one more factor level (a level higher to a) in the example.. a - data.frame(p=rep(c(A,B),each=10,len=30), a=rep(c(1,2,3),each=10),id=seq(30), b=round(runif(30,10,20)), c=round(runif(30,40,70)))

Re: [R] Arranging two different types of ggplot2 plots with axes lined up

2013-04-19 Thread Saalem Adera
Thanks! I really appreciate everyone's help. I was able to get the x-axes ticks very close (close enough!) to lining up on the test data using both Dennis and David's code. So, I've got a work-around. However, I need to do this same operation for many other sets of plots, with varied data

[R] How to select the scale parameter for Gabor transform (Rwave)?

2013-04-19 Thread Joaquin Rapela
Dear list, I am trying to choose the scale parameter for the cgt transform but I don't know how to do it. In time I would like to be able to separate points 30 samples apart, and in frequency I would like to separate bands 0.04 Hz apart. I tried the two approaches described below and they gave

Re: [R] How to select the scale parameter for Gabor transform (Rwave)?

2013-04-19 Thread Joaquin Rapela
Dear list, It seems that there is a typo in the book Practical Time-Frequency Analysis that documents Rwave. The window that the cgt function of Rwave seems to be using g(x)=exp(-x^2/(2*sigma^2)) and not g(x)=exp(-x^2/(2*sigma)) as stated in Equation (3.23) of the book. Also, it appears