Re: [R] Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP

2009-11-16 Thread Karl Ove Hufthammer
On Mon, 16 Nov 2009 19:54:08 -0800 (PST) ychu066 wrote: > here is the codes that i tried. > > > png(paste("hist",i,".png",sep="") > + library(lattice) > Error: unexpected symbol in: > "png(paste("hist",i,".png",sep="") > library" There is a missing ')' at the end of the first line. If you

Re: [R] Weighted descriptives by levels of another variables

2009-11-16 Thread Karl Ove Hufthammer
On Mon, 16 Nov 2009 10:43:38 -0500 Andrew Miles wrote: > Thanks! Using the plyr package and the approach you outlined seems to > work well for relatively simple functions (like wtd.mean), but so far > I haven't had much success in using it with more complex descriptive > functions like des

Re: [R] [Rd] How to generate dependency file that can be used by gnu make?

2009-11-16 Thread Linlin Yan
I don't think this function is same as gcc's option -MM. Because gcc checks pre-compile command #include, in which the filename can be fetched definitely. But in your scenario, the filename may be from some variables, which can not be determined by the R script only. Maybe you can write a tool by y

[R] How to do Hodrick-Prescott Filter in R?

2009-11-16 Thread sdlywjl666
Dear All, How to do Hodrick-Prescott Filter in R? Thanks! [[alternative HTML version deleted]] __ 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-gui

[R] How to do band-pass filters, low-pass filters, high-pass filters in R?

2009-11-16 Thread sdlywjl666
Dear All, How to do band-pass filters,low-pass filters,high-pass filters in R? Thanks! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide ht

Re: [R] Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP

2009-11-16 Thread ychu066
here is the codes that i tried. > png(paste("hist",i,".png",sep="") + library(lattice) Error: unexpected symbol in: "png(paste("hist",i,".png",sep="") library" > for(i in 8:153){ + histogram(~ data[,i] | data[,2], data=data,ylab="Frequency",xlim=c(1,5),xlab="Score",ylim=c(0,100))) Error: u

[R] Plotting graphs using FOR loop

2009-11-16 Thread ychu066
I have the following codes but can anyone make it shorter i.e making these FOR loop into one loop ... thanks... par(mfrow=c(2,4)) for(i in 16:23){ hist(data[,i],main=paste(colnames(data)[i],sep=""),ylab="Frequency",xlim=c(1,5),xlab="Score",ylim=c(0,100)) } png("histogram.png

Re: [R] Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP

2009-11-16 Thread ychu066
still doesnt work ... Karl Ove Hufthammer wrote: > > On Thu, 12 Nov 2009 19:10:52 -0800 (PST) ychu066 @aucklanduni.ac.nz> wrote: >> And I also want to save each histogram in each separate pdf file using >> the >> following codes ?. >> png("hist.png[i]") >> dev.off() > > Try png(paste("hist",i

[R] parsing Google search results

2009-11-16 Thread Philip Leifeld
Hi, how can I parse Google search results? The following code returns "integer(0)" instead of "1" although the results of the query clearly contain the regex "cran". address <- url("http://www.google.com/search?q=cran";) open(address) lines <- readLines(address) grep("cran", lines[3]) ##

[R] non homogeneous poisson process

2009-11-16 Thread frenchcr
I want to do a non homogeneous poisson process model in R. Any advice, or know of places where i can get some, ive googled it but nothing came up relating to R. -- View this message in context: http://old.nabble.com/non-homogeneous-poisson-process-tp26378037p26378037.html Sent from the R help

[R] Biometric Summit - 2010

2009-11-16 Thread William Rogers
JOIN YOUR COLLEAGUES FOR THE 20TH HIGHLY ACCLAIMED INTERNATIONAL FORUM TO HEAR THE LATEST IMPLEMENTATIONS OF BIOMETRICS... THE WINTER 2010 BIOMETRICS SUMMIT: Practical Implementation Strategies, Market Trends And Best Practices In Government And Business --

Re: [R] extracting the last row of each group in a data frame

2009-11-16 Thread Hao Cen
Thanks to all who helped. These are all great suggestions. Jeff -Original Message- From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] Sent: Monday, November 16, 2009 6:27 PM To: Hao Cen Cc: r-help@r-project.org Subject: Re: [R] extracting the last row of each group in a data fram

Re: [R] How to generate dependency file that can be used by gnu make?

2009-11-16 Thread Peng Yu
On Sun, Nov 15, 2009 at 8:45 PM, Peng Yu wrote: > gcc has options like -MM, which can generate the dependence files for > a C/C++ file that I can be used by gnu make. I'm wondering if there is > a tool that can generate dependence file for an R script. > > For example, I have an R script test.R >

Re: [R] Error on reading an excel file

2009-11-16 Thread butter
i have used excel almost exclusively to import data files and CSV is fine. why dont you just go to the bottom of the excel sheet after you convert to CSV and clean out the last rows, delete the end rows. also maybe try another spread sheet program like open office, openoffice.org. cls59 wrote: >

Re: [R] Error on reading an excel file

2009-11-16 Thread cls59
Gabor Grothendieck wrote: > > That doesn't necessarily follow since the various methods don't use > Excel itself to create the csv file. > I was trying to point out cases where I have seen this behavior and R wasn't involved. Now that I think about it, I have observed to blank cells in a Goo

Re: [R] Where are usages like "== 2L" documented?

2009-11-16 Thread Steven McKinney
> -Original Message- > From: Gabor Grothendieck [mailto:ggrothendi...@gmail.com] > Sent: Monday, November 16, 2009 4:52 PM > To: Duncan Murdoch > Cc: Steven McKinney; R Help > Subject: Re: [R] Where are usages like "== 2L" documented? > > On Mon, Nov 16, 2009 at 7:25 PM, Duncan Murdoch >

Re: [R] how can one break or stop or return from a script?

2009-11-16 Thread Don MacQueen
I don't know how to do this in the way you describe. Easy alternatives include: - putting the part of the script that is to be executed conditionally into a separate file, and then source it or not based on some condition. - simply wrapping the different parts of the script in if, then, el

Re: [R] Where are usages like "== 2L" documented?

2009-11-16 Thread Bryan Hanson
As the OP, I will say that I had deduced that it probably was a way of specifying type integer, so I went to the ?integer page hoping for further info. I agree there should be some kind of short comment or see also at that page. I've been a self-taught user of R for about a year and a half, and t

Re: [R] Where are usages like "== 2L" documented?

2009-11-16 Thread Gabor Grothendieck
On Mon, Nov 16, 2009 at 7:25 PM, Duncan Murdoch wrote: > On 16/11/2009 6:47 PM, Steven McKinney wrote: >> >> ?NumericConstants >> >> will bring up a help page that mentions >> "All other numeric constants start with a digit or period and are either a >> decimal or hexadecimal constant optionally f

Re: [R] Where are usages like "== 2L" documented?

2009-11-16 Thread Duncan Murdoch
On 16/11/2009 6:47 PM, Steven McKinney wrote: ?NumericConstants will bring up a help page that mentions "All other numeric constants start with a digit or period and are either a decimal or hexadecimal constant optionally followed by L." and "An numeric constant immediately followed by L

[R] Fwd: dendrogram

2009-11-16 Thread joris meys
I was missing something. Thx Dennis. -- Forwarded message -- From: Dennis Murphy Date: Tue, Nov 17, 2009 at 12:34 AM Subject: Re: dendrogram To: jorism...@gmail.com Hi, There are a couple of things you could do to pull the text back into the dendrogram plot, both of which I fo

[R] Paper on data exploration

2009-11-16 Thread Alain Zuur
R users doing data analysis may be interested in the following paper: http://methodsblog.wordpress.com/2009/11/13/first-paper-now-online/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+wordpress%2Fmethodsblog+(methods.blog) All data and R code is available. Alain - ---

Re: [R] Where are usages like "== 2L" documented?

2009-11-16 Thread Steven McKinney
?NumericConstants will bring up a help page that mentions "All other numeric constants start with a digit or period and are either a decimal or hexadecimal constant optionally followed by L." and "An numeric constant immediately followed by L is regarded as an integer number when possible

[R] lmomco package and confidence limits?

2009-11-16 Thread Douglas M. Hultstrand
Hello, I am using the lmomco package (lmom.ub and pargev) to compute the GEV parameters (location, scale, and shape), which are used to estimate return values. I was wondering how/if I can calculate upper and lower confidence (CI_u, CI_l) intervals for each return frequency using the GEV par

Re: [R] Error on reading an excel file

2009-11-16 Thread Gabor Grothendieck
That doesn't necessarily follow since the various methods don't use Excel itself to create the csv file. On Mon, Nov 16, 2009 at 1:22 PM, cls59 wrote: > > > Gabor Grothendieck wrote: >> >> You could try one of the other methods of reading Excel files and see >> if they are affected: >> > > I woul

Re: [R] Where are usages like "== 2L" documented?

2009-11-16 Thread Duncan Murdoch
Bryan Hanson wrote: Gurus: I keep seeing other people¹s code that contain ideas like If (x == 2L) X[-1L] X - 1L I have some idea of what¹s going on, but where is the use of concepts like ³2L² documented? In the R Language Definition manual. In this case, look in section 3.1.1, "Constant

Re: [R] Where are usages like "== 2L" documented?

2009-11-16 Thread David Winsemius
On Nov 16, 2009, at 6:22 PM, Bryan Hanson wrote: Gurus: I keep seeing other people’s code that contain ideas like If (x == 2L) X[-1L] X - 1L I have some idea of what’s going on, but where is the use of concepts like “2L” documented? Not sure where exactly, and it would depend on where y

Re: [R] extracting the last row of each group in a data frame

2009-11-16 Thread Gabor Grothendieck
Try this: > aggregate(DF[-1], DF[1], tail, 1) Name Value 1A 3 2B 8 3C 2 4D 3 On Mon, Nov 16, 2009 at 2:42 PM, Hao Cen wrote: > Hi, > > I would like to extract the last row of each group in a data frame. > > The data frame is as follows > > Name Value > A 1 > A

[R] Where are usages like "== 2L" documented?

2009-11-16 Thread Bryan Hanson
Gurus: I keep seeing other people¹s code that contain ideas like If (x == 2L) X[-1L] X - 1L I have some idea of what¹s going on, but where is the use of concepts like ³2L² documented? Thanks, Bryan * Bryan Hanson Acting Chair Professor of Chemistry & Biochemistry DePauw University,

Re: [R] Error running lda example from Help File (MASS library )

2009-11-16 Thread Greg Riddick
The actual code for the lda example is below. If anyone can reproduce the error, let me know. Thanks. library(MASS) Iris <- data.frame(rbind(iris3[,,1], iris3[,,2], iris3[,,3]), Sp = rep(c("s","c","v"), rep(50,3))) train <- sample(1:150, 75) table(Iris$Sp[train]) z <- lda(Sp

[R] Poly()

2009-11-16 Thread chris carleton
Hi All, I was hoping someone could save me the trouble of reading through source code and answer a quick question of mine regarding poly(). Does the poly() function use a classical orthogonal polynomial series to fit polynomial models, or does poly() generate a unique series of orthogonal poly

Re: [R] Models

2009-11-16 Thread Greg Snow
If t1-t5 are all correlated with the outcome and with each other, than which are significant will depend on variations in the data (it is possible to have a set of values t1-t5 that predict the outcome well, but which all have nonsignificant p-values when taking the others into account). Allowi

Re: [R] p-value calculation on a joint distribution

2009-11-16 Thread Greg Snow
I don't think that the p-value concept is as well defined for multivariate distributions. Do you want the area under the curve corresponding to (x < t.x & y < t.y) or (x < t.x | y < t.y) or ( t.x + t.y < C ) or all the area where the height of the density is less than at t.x,t.y? or possibly o

Re: [R] Question about simulation design...

2009-11-16 Thread Greg Snow
You should be able to do this effectively in 1 line: > my.data <- lapply( paste( 'data', 1:N, '.dat', sep='' ), read.table ) Then everything is in my.data, if you want them named then do a second line: > names(my.data) <- paste( 'data', 1:N, '.dat', sep='' ) Doing the same analysis on each data

Re: [R] simulated correlated vectors

2009-11-16 Thread Greg Snow
Try this: x <- rexp(100, 1/3) xp <- scale(x) cor.mat <- rbind( c(1, 0.8, 0.7), c(0.8, 1, 0.3), c(0.7, 0.3, 1) ) x23 <- matrix( rnorm( 100 * 2, 1/3 ), ncol=2 ) x23 <- cbind(xp, scale(x23)) x23 <- x23 %*% solve(chol(var(x23))) ## skip if you don't want exact cor's x.new <- x23 %*% chol(cor.ma

Re: [R] Error using 32-bit R and RODBC package on 64-bit Windows Server OS with R version 2.10

2009-11-16 Thread Marc Schwartz
On Nov 16, 2009, at 2:39 PM, helpme wrote: I am receiving an error when trying to connect to the Oracle Database using RODBC on a 64-bit Windows Server OS. The version of R is 2.10.0- win32.exe Is this the wrong version. Does RODBC only work with 32-bit ODBC drivers? 've read over all th

[R] how can one break or stop or return from a script?

2009-11-16 Thread Stu
Hi, I am using a script to initialize variables in the global workspace. Based on some condition, I would like to stop evaluation of a script sourced on the command-line, without issuing an error. My current solution is the following hack that uses a repeat { } statement --- init.R

Re: [R] object not found inside step() function

2009-11-16 Thread shuai yuan
Thanks David. My code is ok if I did not wrap it up. The problem poped up after i make it as a function. In my step() call, i just make it a little bit more general. I do not like stepwise method too, but need it as a comparison. samer On Mon, Nov 16, 2009 at 3:03 PM, David Winsemius wrote:

[R] Error using 32-bit R and RODBC package on 64-bit Windows Server OS with R version 2.10

2009-11-16 Thread helpme
I am receiving an error when trying to connect to the Oracle Database using RODBC on a 64-bit Windows Server OS. The version of R is 2.10.0-win32.exe Is this the wrong version. Does RODBC only work with 32-bit ODBC drivers? 've read over all the posts and documentation manuals. The system is Wind

Re: [R] (Parallel) Random number seed question...

2009-11-16 Thread Dirk Eddelbuettel
On 16 November 2009 at 11:42, Blair Christian wrote: | I have k identical parallel pieces of code running, each using n.rand | random numbers.  I would like to use the same RNG (for now), and set | the seeds so that I can guarantee that there are no overlaps in the | random numbers sampled by the

Re: [R] test for causality

2009-11-16 Thread Schalk Heunis
Tobias The grangertest function in the lmtest package might be simpler for your application. Regards Schalk Heunis On Mon, Nov 16, 2009 at 5:31 PM, tobiasfa wrote: > > Hi useRs.. > > I cant figure out how to test for causality using causality() in vars > package > > I have two datasets (A, B)

Re: [R] Writing a data frame in an excel file

2009-11-16 Thread David Winsemius
On Nov 16, 2009, at 3:13 PM, David Winsemius wrote: On Nov 16, 2009, at 3:06 PM, smu wrote: hello, sep="\n" will seperate each column by \n which is not what you want. I think a csv would be the best solution. write.table(yourdataframe,sep=",") Excel will also read (and even prefers in

Re: [R] extracting the last row of each group in a data frame

2009-11-16 Thread Peter Ehlers
I would use pkg:plyr, but just to show how versatile R is: ind <- cumsum(rle(as.numeric(dat$Name))$lengths) dat[ind, ] where I'm assuming that your data frame is called 'dat'. -Peter Ehlers Hao Cen wrote: Hi, I would like to extract the last row of each group in a data frame. The data fram

Re: [R] fitting a logistic regression with mixed type of variabl

2009-11-16 Thread Ted Harding
On 16-Nov-09 19:22:10, Jack Luo wrote: > Hi, > I am trying to fit a logistic regression using glm, but my > explanatory variables are of mixed type: some are numeric, > some are ordinal, some are categorical, say > > If x1 is numeric, x2 is ordinal, x3 is categorical, is the > following formula OK

Re: [R] Writing a data frame in an excel file

2009-11-16 Thread Peter Ehlers
anna_l wrote: Hello, I am having trouble by using the write.table function to write a data frame of 4 columns and 7530 rows. I don´t know if I should just use a sep="\n" and change the .xls file into a .csv file. Thanks in advance - Anna Lippel new in R so be careful I should be asking a l

Re: [R] Writing a data frame in an excel file

2009-11-16 Thread David Winsemius
On Nov 16, 2009, at 3:06 PM, smu wrote: hello, sep="\n" will seperate each column by \n which is not what you want. I think a csv would be the best solution. write.table(yourdataframe,sep=",") Excel will also read (and even prefers in some sense) tab delimited files, so: write.table(yo

Re: [R] fitting a logistic regression with mixed type of variables

2009-11-16 Thread David Winsemius
On Nov 16, 2009, at 2:53 PM, Jack Luo wrote: > David, > > Thanks for your reply. Since I am kinda new to this forum, could you > please advise me on where to read those questions in R-help? http://search.r-project.org/nmz.html http://search.r-project.org/cgi-bin/namazu.cgi?query=%22ordered+fa

Re: [R] Writing a data frame in an excel file

2009-11-16 Thread smu
hello, sep="\n" will seperate each column by \n which is not what you want. I think a csv would be the best solution. write.table(yourdataframe,sep=",") or use write.csv directly. regards, stefan On Mon, Nov 16, 2009 at 11:49:28AM -0800, anna_l wrote: > > Hello, I am having trouble by using

Re: [R] Writing a data frame in an excel file

2009-11-16 Thread cls59
anna_l wrote: > > Hello, I am having trouble by using the write.table function to write a > data frame of 4 columns and 7530 rows. I don´t know if I should just use > a sep="\n" and change the .xls file into a .csv file. Thanks in advance > Base R cannot write .xls files by it's self. You s

Re: [R] object not found inside step() function

2009-11-16 Thread David Winsemius
On Nov 16, 2009, at 2:31 PM, shuai yuan wrote: Hi, there, My appologize if someone ask the same question before. I searched the mailing list and found one similar post, but not what i want. The problem for me is, I use the step( glm()) to do naive forward selection for logistic regression

Re: [R] extracting the last row of each group in a data frame

2009-11-16 Thread cls59
jeffc wrote: > > Hi, > > I would like to extract the last row of each group in a data frame. > > The data frame is as follows > > Name Value > A 1 > A 2 > A 3 > B 4 > B 8 > C 2 > D 3 > > I would like to get a data frame as > Name Value > A 3 > B 8 > C 2 > D 3 > > Thank you for your suggesti

Re: [R] extracting the last row of each group in a data frame

2009-11-16 Thread Jorge Ivan Velez
Dear Jeff, Here is a suggestion using tapply: data.frame(last = with(x, tapply(Value, Name, function(x) x[length(x)]))) See ?tapply for more information. HTH, Jorge On Mon, Nov 16, 2009 at 2:42 PM, Hao Cen <> wrote: > Hi, > > I would like to extract the last row of each group in a data frame

Re: [R] extracting the last row of each group in a data frame

2009-11-16 Thread David Winsemius
On Nov 16, 2009, at 2:42 PM, Hao Cen wrote: Hi, I would like to extract the last row of each group in a data frame. The data frame is as follows Name Value A 1 A 2 A 3 B 4 B 8 C 2 D 3 by(dfname$Value, dfname$Name, tail, 1) #which gets you a list Or: aggregate(dfname$Value, list(dfname$N

Re: [R] pairs

2009-11-16 Thread cindy Guo
Thank you. I will check that. Cindy On Mon, Nov 16, 2009 at 1:45 PM, cls59 wrote: > > > David Winsemius wrote: > > > > ?order > > > > cindy Guo wrote: > > > > Do you mean if the numbers in each row are ordered? They are not, but if > > it's needed, we can order them. The matrix only has 5000 row

Re: [R] fitting a logistic regression with mixed type of variables

2009-11-16 Thread Jack Luo
David, Thanks for your reply. Since I am kinda new to this forum, could you please advise me on where to read those questions in R-help? In addition, I did not pay much attention to the na.action, probably I should use na.action = na.omit instead of na.pass. -Jack On Mon, Nov 16, 2009 at 2:32 PM

Re: [R] extracting the last row of each group in a data frame

2009-11-16 Thread baptiste auguie
Hi, You could try plyr, library(plyr) ddply(d,.(Name), tail,1) Name Value 1A 3 2B 8 3C 2 4D 3 HTH, baptiste 2009/11/16 Hao Cen : > Hi, > > I would like to extract the last row of each group in a data frame. > > The data frame is as follows > > Name Value > A

[R] Writing a data frame in an excel file

2009-11-16 Thread anna_l
Hello, I am having trouble by using the write.table function to write a data frame of 4 columns and 7530 rows. I don´t know if I should just use a sep="\n" and change the .xls file into a .csv file. Thanks in advance - Anna Lippel new in R so be careful I should be asking a lt of que

Re: [R] pairs

2009-11-16 Thread David Winsemius
On Nov 16, 2009, at 2:41 PM, cindy Guo wrote: > Do you mean if the numbers in each row are ordered? They are not, > but if it's needed, we can order them. The matrix only has 5000 rows. > No, I mean type ?order at the R command line and read the help page. > On Mon, Nov 16, 2009 at 1:34 PM, D

Re: [R] pairs

2009-11-16 Thread cls59
David Winsemius wrote: > > ?order > cindy Guo wrote: > > Do you mean if the numbers in each row are ordered? They are not, but if > it's needed, we can order them. The matrix only has 5000 rows. > No, he's suggesting you check out the order() function by calling it's help page: ?order o

[R] extracting the last row of each group in a data frame

2009-11-16 Thread Hao Cen
Hi, I would like to extract the last row of each group in a data frame. The data frame is as follows Name Value A 1 A 2 A 3 B 4 B 8 C 2 D 3 I would like to get a data frame as Name Value A 3 B 8 C 2 D 3 Thank you for your suggestions in advance Jeff __

Re: [R] pairs

2009-11-16 Thread cindy Guo
Do you mean if the numbers in each row are ordered? They are not, but if it's needed, we can order them. The matrix only has 5000 rows. On Mon, Nov 16, 2009 at 1:34 PM, David Winsemius wrote: > > On Nov 16, 2009, at 2:32 PM, cindy Guo wrote: > > I forgot to say that there are no ties in each ro

Re: [R] Sum over indexed value

2009-11-16 Thread cls59
Gunadi wrote: > > I am sure this is easy but I am not finding a function to do this. > > I have two columns in a matrix. The first column contains multiple entries > of numbers from 1 to 100 (i.e. 10 ones, 8 twos etc.). The second column > contains unique numbers. I want to sum the numbers in

Re: [R] pairs

2009-11-16 Thread David Winsemius
On Nov 16, 2009, at 2:32 PM, cindy Guo wrote: > I forgot to say that there are no ties in each row. So any number > can occur only once in each row. Also as I mentioned earlier, > actually I only need the top 50 most frequent pairs, is there a more > efficient way to do it? Because I have 1

Re: [R] No Visible Binding for global variable

2009-11-16 Thread Duncan Murdoch
On 11/16/2009 1:54 PM, William Dunlap wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Doran, Harold Sent: Monday, November 16, 2009 10:45 AM To: r-help@r-project.org Subject: [R] No Visible Binding for global variable Whil

Re: [R] pairs

2009-11-16 Thread cindy Guo
I forgot to say that there are no ties in each row. So any number can occur only once in each row. Also as I mentioned earlier, actually I only need the top 50 most frequent pairs, is there a more efficient way to do it? Because I have 15000 numbers, output of all the pairs would be too long. Than

Re: [R] fitting a logistic regression with mixed type of variables

2009-11-16 Thread David Winsemius
On Nov 16, 2009, at 2:22 PM, Jack Luo wrote: Hi, I am trying to fit a logistic regression using glm, but my explanatory variables are of mixed type: some are numeric, some are ordinal, some are categorical, say If x1 is numeric, x2 is ordinal, x3 is categorical, is the following formula

[R] object not found inside step() function

2009-11-16 Thread shuai yuan
Hi, there, My appologize if someone ask the same question before. I searched the mailing list and found one similar post, but not what i want. The problem for me is, I use the step( glm()) to do naive forward selection for logistic regression. My code is functional in the open environment. B

[R] fitting a logistic regression with mixed type of variables

2009-11-16 Thread Jack Luo
Hi, I am trying to fit a logistic regression using glm, but my explanatory variables are of mixed type: some are numeric, some are ordinal, some are categorical, say If x1 is numeric, x2 is ordinal, x3 is categorical, is the following formula OK? *model <- glm(y~x1+x2+x3, family=binomial(link="l

Re: [R] Data source name not found and no default driver specified

2009-11-16 Thread helpme
I forgot to mention that it's running Windows Server 2003 x64 OS version On Mon, Nov 16, 2009 at 11:22 AM, helpme wrote: > I'm stumped. When trying to connect to Oracle using the RODBC package I get > an error: > *[RODBC] Data source name not found and no default driver specified. > ODBC connect

Re: [R] in excel i can sort my dataset, what do i use in R

2009-11-16 Thread baptiste auguie
?order ?sort 2009/11/16 frenchcr : > > > > In excel a handy tool is the sort data by column ...i.e. i can highlight the > whole dataset and sort it according to a particular column...like sort the > data in a column in acending or decending order where all the other columns > change aswell. > > I

[R] in excel i can sort my dataset, what do i use in R

2009-11-16 Thread frenchcr
In excel a handy tool is the sort data by column ...i.e. i can highlight the whole dataset and sort it according to a particular column...like sort the data in a column in acending or decending order where all the other columns change aswell. I need to do this in R now but dont know how. ...he

Re: [R] Sum over indexed value

2009-11-16 Thread Henrique Dallazuanna
Try this: with(DF, rowsum(Col2, Col1)) On Mon, Nov 16, 2009 at 3:49 PM, Gunadi wrote: > > I am sure this is easy but I am not finding a function to do this. > > I have two columns in a matrix. The first column contains multiple entries > of numbers from 1 to 100 (i.e. 10 ones, 8 twos etc.). The

Re: [R] extracting estimated covariance parameters from lme fit

2009-11-16 Thread Kingsford Jones
The VarCorr function will extract the components of the random effects covariance matrix, but note the quirk that it returns values as characters: library(nlme) f1 <- lme(distance ~ age, data = Orthodont, random = ~1 + age|Subject) (vc <- VarCorr(f1)) # Subject = pdLogChol(1 + age) # V

Re: [R] No Visible Binding for global variable

2009-11-16 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Doran, Harold > Sent: Monday, November 16, 2009 10:45 AM > To: r-help@r-project.org > Subject: [R] No Visible Binding for global variable > > While building a package, I see the

Re: [R] printing a single row, but dont know which row to print

2009-11-16 Thread David Winsemius
On Nov 16, 2009, at 1:38 PM, baptiste auguie wrote: Hi, Try this, set.seed(2) # reproducible d = matrix(sample(1:20,20), 4, 5) d d[ d[ ,2] == 18 , ] You may need to test with all.equal if your values are subject to rounding errors. HTH, baptiste 2009/11/16 frenchcr : I have 20 columns

[R] No Visible Binding for global variable

2009-11-16 Thread Doran, Harold
While building a package, I see the following: * checking R code for possible problems ... NOTE cheat.fit: no visible binding for global variable 'Zobs' plot.jml: no visible binding for global variable 'Var1' I see the issue has come up before, but I'm having a hard time discerning how solutions

Re: [R] printing a single row, but dont know which row to print

2009-11-16 Thread baptiste auguie
Hi, Try this, set.seed(2) # reproducible d = matrix(sample(1:20,20), 4, 5) d d[ d[ ,2] == 18 , ] You may need to test with all.equal if your values are subject to rounding errors. HTH, baptiste 2009/11/16 frenchcr : > > > I have 20 columns of data, and in column 5 I have a value of 17600 but

Re: [R] Sum over indexed value

2009-11-16 Thread smu
P=data.frame(x=c(1,1,2,3,2,1),y=rnorm(6)) tapply(P$y,P$x,sum) regards, stefan On Mon, Nov 16, 2009 at 09:49:17AM -0800, Gunadi wrote: > > I am sure this is easy but I am not finding a function to do this. > > I have two columns in a matrix. The first column contains multiple entries > of n

Re: [R] Discontinuous graph

2009-11-16 Thread baptiste auguie
Hi, An alternative with ggplot2, library(ggplot2) ggplot(data=coords) + geom_segment(aes(x=a, xend=b, y=c, yend=c)) HTH, baptiste 2009/11/16 David Winsemius : > > On Nov 16, 2009, at 12:40 PM, Tim Smith wrote: > >> Hi, >> I wanted to make a graph with the following table (2 rows, 3 columns

[R] printing a single row, but dont know which row to print

2009-11-16 Thread frenchcr
I have 20 columns of data, and in column 5 I have a value of 17600 but I dont know which row this value is in (i have over 300,000 rows). I'm trying to do 2 things: 1) I want to find out which row in column 5 has this number in it. 2) Then I want to print out that row with all the column heade

[R] Sum over indexed value

2009-11-16 Thread Gunadi
I am sure this is easy but I am not finding a function to do this. I have two columns in a matrix. The first column contains multiple entries of numbers from 1 to 100 (i.e. 10 ones, 8 twos etc.). The second column contains unique numbers. I want to sum the numbers in column two based on the inde

Re: [R] Error on reading an excel file

2009-11-16 Thread cls59
Gabor Grothendieck wrote: > > You could try one of the other methods of reading Excel files and see > if they are affected: > I would guess that since Excel includes the blank rows when exporting to CSV, then blank cells are being stored by Excel in the data files-- therefore any method of ext

Re: [R] Error on reading an excel file

2009-11-16 Thread Gabor Grothendieck
You could try one of the other methods of reading Excel files and see if they are affected: http://wiki.r-project.org/rwiki/doku.php?id=tips:data-io:ms_windows On Mon, Nov 16, 2009 at 8:19 AM, anna_l wrote: > > Hello everybody, here is the code I use to read an excel file containing two > rows,

Re: [R] Discontinuous graph

2009-11-16 Thread Steve Lianoglou
On Nov 16, 2009, at 12:58 PM, David Winsemius wrote: On Nov 16, 2009, at 12:40 PM, Tim Smith wrote: Hi, I wanted to make a graph with the following table (2 rows, 3 columns): a b c x 1 3 5 y 5 8 6 The first column represents the start cordinate, and the second column contains the end cor

Re: [R] Error on reading an excel file

2009-11-16 Thread anna_l
Thanks Charlie, well yes it included one row with two NA datas. I guess there is an explanation, let´s wait and see if someone knows more about it :) cls59 wrote: > > > anna_l wrote: >> >> Hello everybody, here is the code I use to read an excel file containing >> two rows, one of date, the o

Re: [R] Error on reading an excel file

2009-11-16 Thread cls59
anna_l wrote: > > Hello everybody, here is the code I use to read an excel file containing > two rows, one of date, the other of prices: > library(RODBC) > z <- odbcConnectExcel("SPX_HistoricalData.xls") > datas <- sqlFetch(z,"Sheet1") > close(z) > It works pretty well but the

Re: [R] Discontinuous graph

2009-11-16 Thread David Winsemius
On Nov 16, 2009, at 12:40 PM, Tim Smith wrote: Hi, I wanted to make a graph with the following table (2 rows, 3 columns): a b c x 1 3 5 y 5 8 6 The first column represents the start cordinate, and the second column contains the end cordinate for the x-axis. The third column contains the y-a

Re: [R] Discontinuous graph

2009-11-16 Thread Steve Lianoglou
Hi Tim, On Nov 16, 2009, at 12:40 PM, Tim Smith wrote: Hi, I wanted to make a graph with the following table (2 rows, 3 columns): a b c x 1 3 5 y 5 8 6 The first column represents the start cordinate, and the second column contains the end cordinate for the x-axis. The third column contains

[R] Discontinuous graph

2009-11-16 Thread Tim Smith
Hi, I wanted to make a graph with the following table (2 rows, 3 columns): a b c x 1 3 5 y 5 8 6 The first column represents the start cordinate, and the second column contains the end cordinate for the x-axis. The third column contains the y-axis co-ordinate. For example, the first row in the m

Re: [R] (Parallel) Random number seed question...

2009-11-16 Thread Torsten Hothorn
On Mon, 16 Nov 2009, Blair Christian wrote: Hi All, I have k identical parallel pieces of code running, each using n.rand random numbers.  I would like to use the same RNG (for now), and set the seeds so that I can guarantee that there are no overlaps in the random numbers sampled by the k pie

Re: [R] Step Function Freezing R

2009-11-16 Thread Jgabriel
Can you think of any systemic changes that might interefere with R besides Symantec EndPoint and LiveUpdate? I have removed those programs and allocated more memory to R, but it is still way too slow. On Nov 13, 10:45 pm, J Dougherty wrote: > On Friday 13 November 2009 07:17:28 am Jgabriel wrote:

[R] R-help

2009-11-16 Thread Lloyd Barcza
I have been trying to write a function for the following problem: Suppose I have three vectors a,b,c of different lengths: e.g. a=c(a1,a2,a3,...) where a[i] form the basis of our function variables: if we define a table for example: and define the fn(x) <-function{..

[R] test for causality

2009-11-16 Thread tobiasfa
Hi useRs.. I cant figure out how to test for causality using causality() in vars package I have two datasets (A, B) and i want to test if A (Granger)cause B. How do I write the script? I dont understand ?causality. How do I get x to "contain" A and B. Further using the command VAR() to specify x

[R] R-help

2009-11-16 Thread Lloyd Barcza
I have been trying to write a function for the following problem: Suppose I have three vectors a,b,c of different lengths: e.g. a=c(a1,a2,a3,...) where a[i] form the basis of our function variables: if we define a table for example: and define the fn(x) <-function{..

[R] specifying group plots using panel.groups

2009-11-16 Thread wintere
Hi, I am trying to plot two types of data on the same graph: points and distributions. I am attempting to use the panel.groups function, but cannot seem to get it to work. I have a melted data set and put in a FLAG column to separate my data into the two groups that I would like to plot, point d

Re: [R] Cluster analysis: hclust manipulation possible?

2009-11-16 Thread Charles C. Berry
On Mon, 16 Nov 2009, Jopi Harri wrote: I am doing cluster analysis [hclust(Dist, method="average")] on data that potentially contains redundant objects. As expected, the inclusion of redundant objects affects the clustering result, i.e., the data a1, = a2, = a3, b, c, d, e1, = e2 is likely to cl

Re: [R] extracting values from correlation matrix

2009-11-16 Thread jim holtman
Assuming that your data is in a dataframe 'cordata' , then following should work: cordata$cor2_value <- sapply(1:nrow(cordata), function(.row){ cor2[cordata$rowname[.row], cordata$colname[.row]] } On Mon, Nov 16, 2009 at 11:44 AM, Lee William wrote: > Hi! All, > > I have 2 correlation matric

[R] extracting values from correlation matrix

2009-11-16 Thread Lee William
Hi! All, I have 2 correlation matrices of 4000x4000 both with same row names and column names say cor1 and cor2. I have extracted some information from 1st matrix cor1 which is something like this: rowname colname cor1_value a b0.8 b a0.8 c

[R] (Parallel) Random number seed question...

2009-11-16 Thread Blair Christian
Hi All, I have k identical parallel pieces of code running, each using n.rand random numbers.  I would like to use the same RNG (for now), and set the seeds so that I can guarantee that there are no overlaps in the random numbers sampled by the k pieces of code.  Another side goal is to have repro

Re: [R] violin - like plots for bivariate data

2009-11-16 Thread Liaw, Andy
sounds like bivariate density contours may be what you're looking for. Andy From: Eric Nord > > I'm attempting to produce something like a violin plot to > display how y > changes with x for members of different groups (My specific > case is how > floral area changes over time for several spe

  1   2   >