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 should

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 the

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

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

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:

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] 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

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] 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 tobias.farnly...@gmail.comwrote: Hi useRs.. I cant figure out how to test for causality using causality() in vars package I have

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

[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

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

[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] 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

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.mat)

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 dataset

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 others

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).

[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

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] 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] 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 h...@andrew.cmu.edu wrote: Hi, I would like to extract the last row of each group in a data frame. The data frame is as follows Name

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

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,

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 ch...@sharpsteen.net wrote: Gabor Grothendieck wrote: You could try one of the other methods of reading Excel files and see if they are affected:

[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

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] 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=feedburnerutm_medium=feedutm_campaign=Feed%3A+wordpress%2Fmethodsblog+(methods.blog) All data and R code is available. Alain -

[R] Fwd: dendrogram

2009-11-16 Thread joris meys
I was missing something. Thx Dennis. -- Forwarded message -- From: Dennis Murphy djmu...@gmail.com 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,

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 is

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 murd...@stats.uwo.ca 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

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

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,

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] 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 Google

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] 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 pengyu...@gmail.com 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

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

[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

[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

[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]) Thanks

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 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

[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
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: unexpected ')' in:

[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

[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

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

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 rstuff.mi...@gmail.com 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

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 ychu066 @aucklanduni.ac.nz 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

<    1   2