Re: [R] Writing a data frame in an excel file
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 output CSV using write.csv(): write.csv( dataFrame, file = 'results.csv' ) If you are using R on windows, then the RODBC package provides a mechanism for dumping data frames directly to Excel files, possibly with multiple sheets: require( RODBC ) xlsFile - odbcConnectExcel( 'results.xls', readOnly = F ) sqlSave( xlsFile, dataFrame, tablename = 'R Results', rownames = F ) odbcCloseAll() The tablename argument to sqlSave allows you to assign a name to the excel sheet that will contain the data.frame. -Charlie - Charlie Sharpsteen Undergraduate Environmental Resources Engineering Humboldt State University -- View this message in context: http://old.nabble.com/Writing-a-data-frame-in-an-excel-file-tp26378240p26378547.html Sent from the R help mailing list archive at Nabble.com. __ 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, reproducible code.
Re: [R] Writing a data frame in an excel file
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 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 questions!:teeth: -- View this message in context: http://old.nabble.com/Writing-a-data-frame-in-an-excel-file-tp26378240p26378240.html Sent from the R help mailing list archive at Nabble.com. __ 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, reproducible code. __ 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, reproducible code.
Re: [R] fitting a logistic regression with mixed type of variables
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+factors%22max=100result=normalsort=scoreidxname=functionsidxname=Rhelp08idxname=views In addition, I did not pay much attention to the na.action, probably I should use na.action = na.omit instead of na.pass. Or just accept the default. -Jack On Mon, Nov 16, 2009 at 2:32 PM, David Winsemius dwinsem...@comcast.net wrote: 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 OK? The formula's certainly OK. What may be non-OK will be your understanding of the output. The default handling of ordinal factors is a common source of questions to R-help, so read up first. *model - glm(y~x1+x2+x3, family=binomial(link=logit), na.action=na.pass)* Why have you chosen that na.action option? -- David Winsemius, MD Heritage Laboratories West Hartford, CT David Winsemius, MD Heritage Laboratories West Hartford, CT [[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-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Writing a data frame in an excel file
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 lt of questions!:teeth: Excel can read CSV files, so why not just use either write.csv() or write.table() with sep=,? -Peter Ehlers __ 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, reproducible code.
Re: [R] Writing a data frame in an excel file
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(yourdataframe, file=dataout.xls, sep=\t) 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 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 -- David Winsemius, MD Heritage Laboratories West Hartford, CT __ 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, reproducible code.
Re: [R] fitting a logistic regression with mixed type of variabl
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? model - glm(y~x1+x2+x3, family=binomial(link=logit), na.action=na.pass) Thanks, -Jack Speaking rather generally (the details will depend on the nature of your variables, and of what you want to find out), the formula itself is OK. What *is* important is to define your variables so as to respect their nature, so that the regression can handle them appropriately. For the quantitative variable x1, there should be no problem; you can leave it as it is (though in some applications a transform of it, such as log(x1) or sqrt(x1) may be better, of course). For the categorical variable x3, this should be treated as a factor whose levels are the categories. If the categories are represented alphabetically in the data (e.g. the values of x3 are A,B,C) then x3 will be converted into a factor when the data are read in. Then it is only a matter of specifying what system of contrasts you want (see below). However, if the values of x3 are represented numerically (e.g. 1,2,3) then x3 should be explicitly converted into a factor: x3 - factor(x3) with possible additional argument depending on whether you want to consider the levels as ordered. You should use ordered=TRUE if you want x3 to be treated as an ordered factor, ordered=FALSE if unordered: x3 - factor(x3,ordered=TRUE) x3 - factor(x3,ordered=FALSE) In the case that x3 was read in as a factor in the first place, you may still want to apply tghe above in order to force ordering or non-ordering. Read ?factor for more detail. Then there is the question of contrasts for x3. For unordered factors, probably treatment contrasts (which compare each level of the factor with a reference) may be most appropriate. For ordered factors, you may want to use either Helmert contrasts or successive difference contrasts. For treatment contrasts use contrasts(x3) - contr.treatment(N) where n is the number of levels of x3 (see ?contrasts). For Helmert contrasts, similarly contrasts(x3) - contr.helmert(n) For successive difference contrasts, there is a function contr.diffe which, however, is not available in the standard packages. However, there is a contr.diff() on package Epi, and an implementation is also developed in the MASS book. In that case contrasts(x3) - contr.diff(n) Now for the ordinal variable, x2. Attitudes differ, in different applications, as to whether to use such a variable as if it were a numerical variable or as an ordered factor. If it can be considered meaningful to treat the ordered values as if they were numerical measure (i.e. the difference between x2=1 and x2=2 can be considered as effectively equivalent to the difference between x2=2 and x2=3, etc.) then it can be meaningful to simply treat x2 on the same footing as x1. On the other hand, you may only want to go as far as treating x2 as if it were an ordered factor, in which case you can treat it on the same lines as x3 above. However, an ordinal variable is often treated as if it were the index of a subdivision of a latent continuum. For example, a question might ask the respondent if he is Strongly against, Somewhat against Indifferent, Somewhat in favour Strongly in favour some proposal. This forces the respondent to decide which of these categories best represents their inner intensity of attitude towards the issue, which is the latent continuum. Such things can be treated by methods which fit latent variables to ordered responses, but this goes beyond what can be represented in a simple linear model such as you give above. I prefer to leave others, who really know about such things, to advise on how to proceed in such a case! Hoping this helps, Ted. E-Mail: (Ted Harding) ted.hard...@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 16-Nov-09 Time: 20:14:52 -- XFMail -- __ 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, reproducible code.
Re: [R] extracting the last row of each group in a data frame
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 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 __ 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, reproducible code. __ 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, reproducible code.
Re: [R] Writing a data frame in an excel file
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 some sense) tab delimited files, so: write.table(yourdataframe, file=dataout.xls, sep=\t) Neither one of those methods will deal with the problem that no separator is put in the file on the first row before the colnames. To keep the names registered with the columns you would need to set row.names=F write.table(yourdataframe, file=dataout.xls, sep=\t, row.names=FALSE) -- David. 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 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 -- __ 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, reproducible code.
Re: [R] test for causality
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 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, I dont either understand. Kind regards Tobias -- View this message in context: http://old.nabble.com/test-for-causality-tp26373931p26373931.html Sent from the R help mailing list archive at Nabble.com. __ 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, reproducible code. [[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-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] (Parallel) Random number seed question...
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 k pieces of code. Another side goal is | to have reproducibility of my results. In the past I have used C with | SPRNG for this task, but I'm hoping that there is an easy way to do | this in R with poor man's parallelization (eg running multiple Rs on | multiple processors without the overhead of setting up any mpi or | using snow(fall)). It is not clear from the documentation if set.seed Are you aware of the CRAN packages 'rsprng' by Li and 'rlecuyer' by Sevcikova and Rossini ? Dirk -- Three out of two people have difficulties with fractions. __ 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, reproducible code.
[R] Error using 32-bit R and RODBC package on 64-bit Windows Server OS with R version 2.10
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 Windows Server 2003 with R 2.81. and the latest downloadable RODBC package. The Oracle SID/DSN is mfopdw. I made sure to add it to Control Panel-Administrative Priviledges-Microsoft ODBC system/user DNS. I've also tried the following in no particular order: 1.) Turn on all oracle services in control panel-administrative priviledges. 2.) Checked tsnnames.ora for SID. 3.) Add microsoft ODBC service to Control Panel services for SID 4.) Use Sqldeveler to test connection another way besides R (It was successful) 5.) channel-odbcDriverConnect( connection=Driver={Microsoft ODBC for Oracle}; DSN=abc,UID=abc;PWD=abc;case=oracle) received error drivers SQLAllocHandle on SQL_HANDLE_ENV failed one time; another time I got the error that Oracle client and networking components 7.3 or greater is not found. 6.) tnsping mfopdw lsnrctl start mfopdw tried to add oracle/bin to path Nothing is working. -Melanie [[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-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] object not found inside step() function
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 dwinsem...@comcast.netwrote: 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. My code is functional in the open environment. But if I wrap it up as a function, then R keeps saying object 'a' not found. Actually, data frame a is inside the function. I did some search online. i guess the reason may be R did not keep the data in glm() output after building the model but not sure. Can anyone please tell me how to work around this problem? Thanks a lot in advance. I am using R 2.9.0. Here is the sample code: # naivelr-function(x,y){ : : : a-data.frame(x) form-paste(y~1+,paste(grep(X.*,names(a),value=T),collapse=+),sep=) if(is.null(force.in)!=T){ lowmo-paste(y~1+,paste(grep(X.*,names(a)[force.in ],value=T),collapse=+),sep=) } else {lowmo-y~1} lower1-glm(lowmo,family=binomial,data=data.frame(a,y)) upper1-glm(form,family=binomial,data=data.frame(a,y)) You are sticking data.frame= a inside another data.frame stepout-step(lower1,scope=list(lower=lower1,upper=upper1),direction=forward,k=0,trace=100) Thats not the way I remember step-ping. I thought you made a fit and then stepped the formulas (using the same data), rather putting the whole glm object into a lower and an upper. I could be wrong about that since I try to avoid using stepwise methods. # here is the error:Start: #AIC=689.62 #y ~ 1 #Error in data.frame(a, y) : object 'a' not found---but a is there! But it's probably not in a form that can be interpreted. Consider adding y as a column in a. David Winsemius, MD Heritage Laboratories West Hartford, CT [[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-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how can one break or stop or return from a script?
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 --- #hack to enable setting of breakpoint repeat { ... if (condition) { break; } ... # remember to break !! break; } #end repeat EOF Thanks, - Stu __ 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, reproducible code.
Re: [R] Error using 32-bit R and RODBC package on 64-bit Windows Server OS with R version 2.10
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 the posts and documentation manuals. The system is Windows Server 2003 with R 2.81. and the latest downloadable RODBC package. The Oracle SID/DSN is mfopdw. I made sure to add it to Control Panel-Administrative Priviledges-Microsoft ODBC system/ user DNS. I've also tried the following in no particular order: 1.) Turn on all oracle services in control panel-administrative priviledges. 2.) Checked tsnnames.ora for SID. 3.) Add microsoft ODBC service to Control Panel services for SID 4.) Use Sqldeveler to test connection another way besides R (It was successful) 5.) channel-odbcDriverConnect( connection=Driver={Microsoft ODBC for Oracle}; DSN=abc,UID=abc;PWD=abc;case=oracle) received error drivers SQLAllocHandle on SQL_HANDLE_ENV failed one time; another time I got the error that Oracle client and networking components 7.3 or greater is not found. 6.) tnsping mfopdw lsnrctl start mfopdw tried to add oracle/bin to path Nothing is working. Three quick comments: 1. A better place to post these types of queries would be on the R-SIG- DB e-mail list, which is focused in this domain. More info here: https://stat.ethz.ch/mailman/listinfo/r-sig-db 2. Prof. Ripley will be a more definitive resource, so I would wait until he might respond. 3. If you have not yet, be sure to read the RODBC vignette, which is available either via: vignette(ROBDC) or online at: http://cran.r-project.org/web/packages/RODBC/vignettes/RODBC.pdf That all being said, since you have now posted what may be the root cause of your problem, which is the 64/32 bit details, I will venture a guess to say that this may be the problem. Since there is not a 64 bit version of R for Windows (save I believe the Revolution commercial release), if you are using 64 bit Oracle client binaries and ODBC drivers (if they exist), they will not be compatible with 32 bit R/ RODBC. I know that on OSX, with 64 bit R/RODBC and 32 bit ODBC drivers for Oracle, the connectivity would not work, so it seems reasonable that the reverse configuration would not be compatible either. So, first, I would be sure that you are using 32 bit ODBC drivers for Oracle on Windows and not 64 bit. If you installed any other Oracle client related software, that likely also needs to be 32 bit as well. Then I would review the above vignette document and be sure that any general installation references and those specifically pertaining to Windows have been followed consistently, especially configuring $PATH and other environmental configuration items required for Oracle itself, which on some platforms usually include things like $ORACLE_HOME, $TNS_ADMIN and so forth. You indicate above: tried to add oracle/bin to path which does not definitively indicate that you actually did so. Did you? Also, check the capitalization, as the path is normally something like c:\Oracle\bin. If you can connect to the Oracle server using Oracle's own clients such as the InstantClient, that typically means that most of the system configuration issues are correctly set up. If that connection is successful, then it may bring us back to the 32/64 bit conflict. HTH, Marc Schwartz __ 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, reproducible code.
Re: [R] simulated correlated vectors
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) x.new[,1] - x.new[,1]*attr(xp, 'scaled:scale') + attr(xp, 'scaled:center') all.equal( x.new[,1], x ) cor(x.new) pairs(x.new) you can generate the data from other distributions than the normal, and you can add and multiply constants in the columns of x.new to give different means/sd's. This will set the correlations, but the exact distributions of the columns is not guaranteed. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of carol white Sent: Thursday, November 12, 2009 9:10 AM To: r-h...@stat.math.ethz.ch Subject: [R] simulated correlated vectors Hi, Having a vector x of float type without any assumption of its distribution (mean, variance etc), how to generate another vector that is correlated with x? Extensibility: how to simulate more than two correlated vectors (again float type and no preference for their distribution and without having vector x)? Cheers, Carol __ 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, reproducible code. __ 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, reproducible code.
Re: [R] Question about simulation design...
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 can now be done using lapply or sapply. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Jeff Harring Sent: Thursday, November 12, 2009 6:22 AM To: r-help@r-project.org Subject: [R] Question about simulation design... Help R list servers, I have 500 external data sets for a simulation study that I would like to bring into R to analyze. They have the names data1.dat, data2.dat, ..., dataN.dat Is there a way to automatize the bringing in of these data sets in R using the read.table function within a looping cycle? For example... for (j in 1:N){ data_j = read.table(dataj.dat, header=F) executable code . . . } bring in the next data set. SAS uses a ampersand to automatize the process. Example code: data _NULL_; set final; filename out C:\datak..dat; file out; put variables; run; I would welcome any insight into how to address this issue. Thank you. Jeff Harring -- ** Jeffrey R. Harring, Assistant Professor Department of Measurement, Statistics Evaluation (EDMS) 1230 Benjamin Building University of Maryland College Park, MD 20742-1115 Phone:301.405.3630 Fax: 301.314.9245 Email:harr...@umd.edu Web: http://www.education.umd.edu/EDMS/fac/Harring/webpage.html __ 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, reproducible code. __ 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, reproducible code.
Re: [R] p-value calculation on a joint distribution
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 Do you have the definition of the density? Or is the data frame a representation of the heights of the distribution at given x and y coordinates? If the second, do they x and y coordinates form a grid? Or some random pattern? Etc.? -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Leon Yee Sent: Tuesday, November 10, 2009 11:23 PM To: R help Subject: [R] p-value calculation on a joint distribution Dear R users, For a uni-variable distribution represented in a numerical vector, we can obtain a distribution function using 'ecdf', and then calculate corresponding p-values. But if I have a 2-column dataframe representing a bi-variable joint distribution, given a pair of values, how can I get the p-value? And how can I plot out the density of the joint distribution? Best wishes, Leon __ 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, reproducible code. __ 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, reproducible code.
Re: [R] Models
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). Allowing gam to fit a non-linear function could easily lead to a different set being significant. My guess is that the question that you are interested in and the question that is answered by looking at the p-values are not as similar as you had hoped. If you tell us what question you are trying to answer is, then we may be more helpful. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Val Sent: Monday, November 09, 2009 4:08 PM To: r-help@r-project.org Subject: [R] Models Hi all, I hope that there might be some statistician out there to help me for a possible explanation for the following simple question. Y1~ lm(y~ t1 + t2 + t3 + t4 + t5,data=temp) # oridnary linear model library(gam) Y2~ gam(y~ lo(t1) +lo(t2) +lo(t3) +lo(t4) +lo(t5),data=temp) # additive model In the first model t1, t2 and t3 found to be significant,. However, in the second model (using gam package) t1, t4 and t5 are significant. I was hopping to expect nearly similar results from both models but I found the opposite results. Is there any possible explanation for that? Thanks Val [[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- guide.html and provide commented, minimal, self-contained, reproducible code. __ 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, reproducible code.
[R] Poly()
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 polynomials based on the method described in Kennedy and Gentle (1980:342-347). I understand that the aforementioned reference is the source for the recursion used in predict.poly(), but I was a bit confused by the documentation regarding how the orthogonal polynomial series was constructed in the first place. If any of the developers are reading - it would be handy to have the orthogonal polynomial series available as an output of poly(), in addition to the coefficients, if that function is generating a unique series based on the dataset used for the approximation. Thanks to everyone for your time, Chris _ [[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-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error running lda example from Help File (MASS library )
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 ~ ., Iris, prior = c(1,1,1)/3, subset = train) Error in if (targetlist[i] == stringname) { : argument is of length zero System: MacOSX 10.5.8 R: 2.10.0 -- Gregory Riddick, PhD. CRTA Research Fellow National Institutes of Health National Cancer Institute, Neuro-Oncology Branch http://home.ccr.cancer.gov/nob/ 37 Convent Drive Building 37, Room 1142 Bethesda, MD 20892-8202 Phone: 301-443-2490 Fax: 240-396-5920 [[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-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Where are usages like == 2L documented?
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, Greencastle IN USA __ 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, reproducible code.
Re: [R] extracting the last row of each group in a data frame
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 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 __ 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, reproducible code. __ 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, reproducible code.
Re: [R] Where are usages like == 2L documented?
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 you learned R. The integer data type information and notation should have been found among the material where you learned about numeric, character, logical, that sort of basic notion. -- David Winsemius, MD Heritage Laboratories West Hartford, CT __ 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, reproducible code.
Re: [R] Where are usages like == 2L documented?
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, Constants. Duncan Murdoch Thanks, Bryan * Bryan Hanson Acting Chair Professor of Chemistry Biochemistry DePauw University, Greencastle IN USA __ 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, reproducible code. __ 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, reproducible code.
Re: [R] Error on reading an excel file
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: 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 extracting data from those files will also pick up the empty cells. I think the crux of this issue lies with Excel and you will probably have to look for a fix there. -Charlie - Charlie Sharpsteen Undergraduate Environmental Resources Engineering Humboldt State University -- View this message in context: http://old.nabble.com/Error-on-reading-an-excel-file-tp26371750p26376915.html Sent from the R help mailing list archive at Nabble.com. __ 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, reproducible code. __ 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, reproducible code.
[R] lmomco package and confidence limits?
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 parameters to fill-in the table below? Xi (location) = 35.396 Alpha (scale) = 1.726 Kappa (shape) = 0.397 Year, Return value, CI_u, CL_l 2, 36.0, 5, 37.3, 10, 38.0, 25, 38.5, 50, 38.8, 100, 39.0, Thank you for your help/suggestions, Doug -- - Douglas M. Hultstrand, MS Senior Hydrometeorologist Metstat, Inc. Windsor, Colorado voice: 970.686.1253 email: dmhul...@metstat.com web: http://www.metstat.com __ 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, reproducible code.
Re: [R] Where are usages like == 2L documented?
?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 (and with a warning if it contains a .). but I haven't found discussion of it anywhere else in the help pages. Others may know what other help pages discuss this. I'm surprised that the help page invoked from ?integer does not discuss this. Anyone know why not? Best Steve McKinney -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Bryan Hanson Sent: Monday, November 16, 2009 3:23 PM To: R Help Subject: [R] Where are usages like == 2L documented? 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, Greencastle IN USA __ 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, reproducible code. __ 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, reproducible code.
[R] Paper on data exploration
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 - Dr. Alain F. Zuur First author of: 1. Analysing Ecological Data (2007). Zuur, AF, Ieno, EN and Smith, GM. Springer. 680 p. 2. Mixed effects models and extensions in ecology with R. (2009). Zuur, AF, Ieno, EN, Walker, N, Saveliev, AA, and Smith, GM. Springer. 3. A Beginner's Guide to R (2009). Zuur, AF, Ieno, EN, Meesters, EHWG. Springer Statistical consultancy, courses, data analysis and software Highland Statistics Ltd. 6 Laverock road UK - AB41 6FN Newburgh Email: highs...@highstat.com URL: www.highstat.com -- View this message in context: http://old.nabble.com/Paper-on-data-exploration-tp26382087p26382087.html Sent from the R help mailing list archive at Nabble.com. __ 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, reproducible code.
[R] Fwd: dendrogram
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, both of which I found by looking at the example for pltree.twins() in the cluster package. Method 1: Adjust the graphical parameters to add more space on the right: op - par(mar = par(mar) + c(0,0,0, 2)) plot(as.dendrogram(TestAgnes), horiz = TRUE, center = TRUE) par(op) # returns graphical parameters to their original state Method 2: Reduce the font size of the labels (very useful if the dendrogram has a large number of labels. plot(as.dendrogram(TestAgnes), horiz = TRUE, center = TRUE, nodePar = list(lab.cex = 0.7, pch = NA)) Why did I look at pltree.twins? class(TestAgnes) [1] agnes twins HTH. DM __ 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, reproducible code.
Re: [R] Where are usages like == 2L documented?
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 regarded as an integer number when possible (and with a warning if it contains a .). but I haven't found discussion of it anywhere else in the help pages. Others may know what other help pages discuss this. I'm surprised that the help page invoked from ?integer does not discuss this. Anyone know why not? This is part of the syntax of the language. It has nothing to do with the integer() function, which is what ?integer is asking about. Duncan Murdoch Best Steve McKinney -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Bryan Hanson Sent: Monday, November 16, 2009 3:23 PM To: R Help Subject: [R] Where are usages like == 2L documented? 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, Greencastle IN USA __ 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, reproducible code. __ 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, reproducible code. __ 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, reproducible code.
Re: [R] Where are usages like == 2L documented?
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 optionally followed by L. and An numeric constant immediately followed by L is regarded as an integer number when possible (and with a warning if it contains a .). but I haven't found discussion of it anywhere else in the help pages. Others may know what other help pages discuss this. I'm surprised that the help page invoked from ?integer does not discuss this. Anyone know why not? This is part of the syntax of the language. It has nothing to do with the integer() function, which is what ?integer is asking about. It might be useful to have a SeeAlso to NumericConstants on that help page for those who looked up ?integer thinking it might be about integer constants. __ 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, reproducible code.
Re: [R] Where are usages like == 2L documented?
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 this is one of the better hidden pieces of information. I had looked at the R Lang document, and probably should again for some additional ideas, but that was a long time ago. I did an RSiteSearch(1L) but not surprisingly this returns many uses of the feature, not the definition, at least not in the first few pages. Thanks for the tips. Bryan * Bryan Hanson Acting Chair Professor of Chemistry Biochemistry DePauw University, Greencastle IN USA On 11/16/09 7:52 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: 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 optionally followed by L. and An numeric constant immediately followed by L is regarded as an integer number when possible (and with a warning if it contains a .). but I haven't found discussion of it anywhere else in the help pages. Others may know what other help pages discuss this. I'm surprised that the help page invoked from ?integer does not discuss this. Anyone know why not? This is part of the syntax of the language. It has nothing to do with the integer() function, which is what ?integer is asking about. It might be useful to have a SeeAlso to NumericConstants on that help page for those who looked up ?integer thinking it might be about integer constants. __ 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, reproducible code. __ 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, reproducible code.
Re: [R] how can one break or stop or return from a script?
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, else blocks. -Don At 1:37 PM -0800 11/16/09, Stu wrote: 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 --- #hack to enable setting of breakpoint repeat { ... if (condition) { break; } ... # remember to break !! break; } #end repeat EOF Thanks, - Stu __ 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, reproducible code. -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA 925-423-1062 __ 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, reproducible code.
Re: [R] Where are usages like == 2L documented?
-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 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 optionally followed by L. and An numeric constant immediately followed by L is regarded as an integer number when possible (and with a warning if it contains a .). The word integer in the above sentence of the NumericConstants help page is hyperlinked to the integer() function page. There is then no example or discussion of L there. but I haven't found discussion of it anywhere else in the help pages. Others may know what other help pages discuss this. I'm surprised that the help page invoked from ?integer does not discuss this. Anyone know why not? This is part of the syntax of the language. It has nothing to do with the integer() function, which is what ?integer is asking about. It might be useful to have a SeeAlso to NumericConstants on that help page for those who looked up ?integer thinking it might be about integer constants. Yes, additional discussion of L would be very valuable. I've had several people ask me about usages, as this original poster did. I think that increased use of L has outpaced updating of help entries. Given that L is appearing in more places, I'd like to request additional discussion of it and examples using it in help pages. class(1L) [1] integer storage.mode(1L) [1] integer Since integer is the term often associated with this language construct, that seems a natural place to say something about it, and direct users to other appropriate help pages. The help page for storage.mode() shows an example with 1i in it, could 1L please also be added? (1.0 or 1. would also be useful.) cex3 - c(NULL,1,1:1,1i,list(1),data.frame(x=1), pairlist(pi), c, lm, formals(lm)[[1]], formals(lm)[[2]], y~x,expression((1))[[1]], (y~x)[[1]], expression(x - pi)[[1]][[1]]) The L language construct is often used in length checks such as in the sample() function if (length(x) == 1L ... The length() function help page discusses The default method currently returns an integer of length 1. again with the integer hyperlinked to the integer() help page. Since length() therefore can only assess integer lengths from 0 to about 2^31 - 1 it would be helpful to discuss this integer L construct and the range of values that can be expressed with mode integer more fully somewhere in one of these help topics. sample function (x, size, replace = FALSE, prob = NULL) { if (length(x) == 1L is.numeric(x) x = 1) { if (missing(size)) size - x .Internal(sample(x, size, replace, prob)) } else { if (missing(size)) size - length(x) x[.Internal(sample(length(x), size, replace, prob))] } } environment: namespace:base Best Steve McKinney __ 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, reproducible code.
Re: [R] Error on reading an excel file
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 Docs spreadsheets that were created from .xls files. My point is that Excel, not R, may be the common denominator in this problem. -Charlie - Charlie Sharpsteen Undergraduate Environmental Resources Engineering Humboldt State University -- View this message in context: http://old.nabble.com/Error-on-reading-an-excel-file-tp26371750p26383479.html Sent from the R help mailing list archive at Nabble.com. __ 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, reproducible code.
Re: [R] Error on reading an excel file
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: 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 Docs spreadsheets that were created from .xls files. My point is that Excel, not R, may be the common denominator in this problem. -Charlie -- View this message in context: http://old.nabble.com/Error-on-reading-an-excel-file-tp26371750p26383821.html Sent from the R help mailing list archive at Nabble.com. __ 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, reproducible code.
Re: [R] How to generate dependency file that can be used by gnu make?
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 script test.R #test.R load('input.RData') save.image('output.RData') I want to generate a dependence file like the following. Is there a tool to do so? output.RData:test.R input.RData Is there a way to automatically generate the output files that depends on an R script and the input files and sourced files that are depended by an R script? I don't see this option in R. But I wish this can be implemented in future version of R. __ 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, reproducible code.
Re: [R] extracting the last row of each group in a data frame
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 frame 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 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 __ 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, reproducible code. __ 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, reproducible code.
[R] Biometric Summit - 2010
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 February 22-25, 2010 - Miami, FL http://www.aliconferences.com/conf/biometrics_summit_winter10/index.htm [http://www.cuemails.com/cu2008/_links.php?id=884] *** EARLY BIRD DISCOUNT: Register by DECEMBER 8th to save $400! *** *** Mention priority code E-BD to receive a $200 discount! *** Attend this leading industry forum to meet, question and hear the details behind several real-life implementations of a variety of biometric systems, including SPEAKERS from: 1. Children's Hospital Boston 2. ATT Consumer Product Division 3. Federal Bureau of Investigation 4. Cisco 5. State of Israel 6. International Biometric Group (IBG) 7. L-1 Identity Solutions, Inc. 8. Identification Technology Partners (IDTP) 9. Daon 10. National Supermarket 11. Omnicell, Inc. 12. National Biometric Security Project 13. Unisys 14. BIO-Key International 15. Delfigo Security 16. Identica 17. Cogent Systems, Inc. 18. Aware, Inc. 19. AllTrust Networks Featuring Keynote Presentation by Dr. Joseph Atick To register or for more information: -- CALL: Toll Free within the U.S. 888-362-7400, ext. 1 --or-- 773-695-9400, ext. 1 ONLINE: http://www.aliconferences.com/conf/biometrics_summit_winter10/index.htm [http://www.cuemails.com/cu2008/_links.php?id=884] EMAIL: meli...@aliconferences.com [mailto:meli...@aliconferences.com] *** Please mention email code E-BD to receive a $200 discount. *** Exhibit and Sponsorship opportunities are also available, please contact amy.gerst...@aliconferences.com [mailto:amy.gerst...@aliconferences.com], or 773-695-9400, ext. 20, for more information. CONFERENCE DISCOUNTS: 1. TEAM Discount: Train 4 for the price of 3! 2. EARLY BIRD Discount: Register by December 8th to save $400! 3. BIOMETRIC DIGEST Discount: Mention E-BD to get $200 off! 4. PAST ATTENDEE Discount: Receive $200 off your next conference! KEY TAKE AWAYS: - - - - - - - Through several new and updated case studies from a variety of real-life applications of biometrics, you will learn strategies, approaches and systems for: 1. Understanding the key biometrics technologies - how they work, costs and benefits, strengths and weaknesses - through several real end-user applications and case study examples 2. Incorporating biometrics into an integrated solution for identity management 3. Testing and evaluating the performance of a biometrics system to ensure security 4. Making the business case for biometrics 5. Combining multiple biometric technologies in the same application 6. Applying the latest standards to your application 7. Overcoming common pitfalls during biometric deployment 8. Achieving cost savings, increased efficiency and/or improved security by implementing biometric applications 9. Overcoming ethical and privacy issues RAVE REVIEWS FROM PAST BIOMETRICS CONFERENCE ATTENDEES: - - - - - - - Very interesting topics presented - will definitely consider attending again! Nice mix of backgrounds/industries; the speakers were good at addressing all of them. K. Davis, IT Specialist, U.S. DEPARTMENT OF COMMERCE I really appreciate hearing about real world projects from both the user/customer and integrator/vendor perspectives. C. Tilton, VP, Standards Emerging Technology, DAON The conference provided information on biometrics that will now enable me and my colleagues to make an informed decision on the use of biometrics. G. Williams, Program Manager, U.S. DEPARTMENT OF HOMELAND SECURITY * * * * * * * * * * CONFERENCE AGENDA: * * * * * * * * * * The Winter 2010 BIOMETRICS SUMMIT: Practical Deployment Strategies, Market Trends Best Practices in Government, Healthcare And Business ** GENERAL SESSIONS February 23-24, 2010, Miami, FL http://www.aliconferences.com/conf/biometrics_summit_winter10/index.htm [http://www.cuemails.com/cu2008/_links.php?id=884] DAY ONE, Tuesday, February 23, 2010 8:30 Chairperson's Welcome Opening Remarks -- Samir Nanavati, Partner INTERNATIONAL BIOMETRIC GROUP (IBG) 8:40 Global And Mobile Identity Management: Business Processes And Technical Innovations To Ensure The Secure Flow Of Identities -- Dr. Joseph Atick, Executive Vice President, Chief Strategic Officer L-1 IDENTITY SOLUTIONS, INC. 9:40 Speed Networking: Become acquainted with your fellow attendees in this fun and fast-paced forum! 10:10 Morning Networking Break Exhibits 10:40 Deploying Biometrics Under Challenging Conditions And Cost Restrictions -- Andrew Chai, Engineering Manager OMNICELL, INC. -- -- Samir Nanavati, Partner INTERNATIONAL BIOMETRIC GROUP (IBG) 11:30 How A Major Retailer Streamlined The
[R] non homogeneous poisson process
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 mailing list archive at Nabble.com. __ 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, reproducible code.
[R] parsing Google search results
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 Philip -- Philip Leifeld Max Planck Institute for | +49 (0) 1577 6830349 (mobile) Research on Collective Goods | +49 (0) 228 91416-73 (phone) MaxNetAging Doctoral Fellow | +49 (0) 228 91416-62 (fax) Kurt-Schumacher-Str. 10 | 53113 Bonn, Germany | http://www.philipleifeld.de __ 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, reproducible code.
Re: [R] Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP
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 png(paste(hist,i,.png,sep=) instead. -- Karl Ove Hufthammer __ 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, reproducible code. -- View this message in context: http://old.nabble.com/Plotting-Histogram-using-histogram%28%29-and-for-loop-and-I-want-to-save-the-histogram-individually-...-HELP-tp26328734p26383915.html Sent from the R help mailing list archive at Nabble.com. __ 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, reproducible code.
[R] Plotting graphs using FOR loop
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) dev.off() par(mfrow=c(2,4)) for(i in 24:31){ hist(data[,i],main=paste(colnames(data)[i],sep=),ylab=Frequency,xlim=c(1,5),xlab=Score,ylim=c(0,100)) } png(histogram.png) dev.off() par(mfrow=c(2,4)) for(i in 32:39){ hist(data[,i],main=paste(colnames(data)[i],sep=),ylab=Frequency,xlim=c(1,5),xlab=Score,ylim=c(0,100)) } png(histogram.png) dev.off() par(mfrow=c(2,4)) for(i in 40:47){ hist(data[,i],main=paste(colnames(data)[i],sep=),ylab=Frequency,xlim=c(1,5),xlab=Score,ylim=c(0,100)) } png(histogram.png) dev.off() -- View this message in context: http://old.nabble.com/Plotting-graphs-using-FOR-loop-tp26383926p26383926.html Sent from the R help mailing list archive at Nabble.com. __ 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, reproducible code.
Re: [R] Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP
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: 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 } dev.off() Error in dev.off() : cannot shut down device 1 (the null device) ychu066 wrote: 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 png(paste(hist,i,.png,sep=) instead. -- Karl Ove Hufthammer __ 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, reproducible code. -- View this message in context: http://old.nabble.com/Plotting-Histogram-using-histogram%28%29-and-for-loop-and-I-want-to-save-the-histogram-individually-...-HELP-tp26328734p26384035.html Sent from the R help mailing list archive at Nabble.com. __ 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, reproducible code.
[R] How to do band-pass filters, low-pass filters, high-pass filters in R?
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 http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to do Hodrick-Prescott Filter in R?
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-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [Rd] How to generate dependency file that can be used by gnu make?
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 yourself to parse the R syntax to resolve your problem. On Tue, Nov 17, 2009 at 11:51 AM, Peng Yu pengyu...@gmail.com wrote: 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 script test.R #test.R load('input.RData') save.image('output.RData') I want to generate a dependence file like the following. Is there a tool to do so? output.RData:test.R input.RData Is there a way to automatically generate the output files that depends on an R script and the input files and sourced files that are depended by an R script? I don't see this option in R. But I wish this can be implemented in future version of R. __ r-de...@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel __ 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, reproducible code.
Re: [R] Weighted descriptives by levels of another variables
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 functions like describe {Hmisc}. 'describe' outputs a list, not just a vector. To get the actual values as vectors, you have to extract them, e.g.: describe(x)$counts describe(x)$values -- Karl Ove Hufthammer __ 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, reproducible code.
Re: [R] Plotting Histogram using histogram() and for loop and I want to save the histogram individually ... HELP
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 you use an editor with syntax highlighting, it is easy to spot these types of errors. -- Karl Ove Hufthammer __ 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, reproducible code.