Re: [R] How to choose data from two sets of data to ensure that the choosed data has a better normal feature?

2013-12-16 Thread Jeff Newmiller
Your question as posed is incomplete, because you have not specified what the mean and standard deviation are of the distribution that you wish to use as the target. Two histograms may each have an excellent fit to different distributions, such that neither can be faulted as a poor fit to a

Re: [R] how to fit exponential curve such as a*b^t in r?

2013-12-16 Thread Berend Hasselman
On 16-12-2013, at 08:52, 水静流深 1248283...@qq.com wrote: input - ty 1 5.3 2 7.2 3 9.6 4 12.9 5 17.1 6 23.2 dat-read.table(textConnection(input),header=TRUE,sep=) t-dat[,1] y-dat[,2]

Re: [R] how to fit exponential curve such as a*b^t in r?

2013-12-16 Thread Jeff Newmiller
Read the examples section of ?nls You probably need to provide a start list of values. There are some points you should note from the Posting Guide mentioned in the footer of emails on this list: this is not a homework help forum, you should provide a reproducible example, and you should not

[R] log transforming predictor variables in a binomial GAM?

2013-12-16 Thread PETER MITCHELL
Hi all, I am applying a Presence/absence Generalized additive model to model the distribution of marine algae species in R. I have found that log transforming the environmental variables improves the explained deviance of the model considerably. While log transforming is common practice in

Re: [R] Rows to Column

2013-12-16 Thread arun
Hi, Try: dat1 - read.table(text=id cat val 1  A  2 1  C  4 3  B  1 5  A  2 6  A  3 6  B  5 6  C  2 8  B  5 8  D  2 9  D  3,sep=,header=TRUE,stringsAsFactors=FALSE) library(reshape2)  res1 - dcast(dat1,id~cat,value.var=val,fill=0) colnames(res1)[-1] - paste0(cat,colnames(res1)[-1]) #or  

Re: [R] log transforming predictor variables in a binomial GAM?

2013-12-16 Thread Simon Wood
It doesn't break anything - you can transform the predictors pretty much any way you like, and it is often sensible as a way of tackling very uneven leverage. By transforming predictors, all you are changing in the model is what smooth means. e.g. smooth w.r.t. log(x) is somewhat different to

Re: [R] why there is no quarters?

2013-12-16 Thread Pancho Mulongeni
Hi, I also would like to use quarters. I think a work around would be to just label each record in the dataframe by its quarter. i.e. you add a factor called 'Quarter' with four levels (Q1 to Q4) for each row and you assign the level based on the month of the date. You can easily do this with

Re: [R] why there is no quarters?

2013-12-16 Thread Dániel Kehl
Hi, try x - seq(as.Date(2001/1/1),as.Date(2010/1/1),3 months) best, daniel Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ; meghatalmaz#243;: Pancho Mulongeni [p.mulong...@namibia.pharmaccess.org] Küldve: 2013. december 16. 13:05

Re: [R] why there is no quarters?

2013-12-16 Thread Marc Schwartz
On Dec 15, 2013, at 6:11 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 13-12-15 6:43 AM, 水静流深 wrote: seq(as.Date(2001/1/1),as.Date(2010/1/1),years) seq(as.Date(2001/1/1),as.Date(2010/1/1),weeks) seq(as.Date(2001/1/1),as.Date(2010/1/1),days) why there is no

Re: [R] why there is no quarters?

2013-12-16 Thread Marc Schwartz
That will only work if your starting date happens to be the first day of the year: x - seq(as.Date(2001/1/1), as.Date(2010/1/1), 3 months) head(x) [1] 2001-01-01 2001-04-01 2001-07-01 2001-10-01 2002-01-01 [6] 2002-04-01 Compare that to: x2 - seq(as.Date(2001/2/3), as.Date(2010/1/1), 3

Re: [R] why there is no quarters?

2013-12-16 Thread arun
Hi, Also, library(zoo) format.yearqtr(x) identical(gsub(\\-, ,xqq),format.yearqtr(x)) #[1] TRUE A.K. On Monday, December 16, 2013 8:01 AM, Marc Schwartz marc_schwa...@me.com wrote: On Dec 15, 2013, at 6:11 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 13-12-15 6:43 AM, 水静流深

Re: [R] Converting decimal to binary in R

2013-12-16 Thread Earl F Glynn
水静流深 wrote: i have write a function to convert decimal number into binary number in R. dectobin can get right result ,it is so long ,is there a build-in function to do ? Try the R.utils package: library(R.utils) intToBin(12) [1] 1100 intToBin(255) [1] intToBin(65535) [1]

Re: [R] Exporting R graphics into Word without losing graph quality

2013-12-16 Thread David Carlson
This will create a simple plot using Windows enhanced metafile format: win.metafile(TestFigure.emf) plot(rnorm(25), rnorm(25)) dev.off() null device 1 Windows does not read pdf. It will offer to import an eps (encapsulated postscript) file, but it only imports the bitmap

[R] Question

2013-12-16 Thread Rasool Asoodeh
Hello Dears. I have a 2 questions about Discriminant Analysis in R. 1- In ade4 package I perform this analysis for both quantitative and qualitative variables using discrimin function. R gives me Canonical weights/ Loadings and Canonical scores but doesn't give *F* or *t *or *X-square

Re: [R] Rows to Column

2013-12-16 Thread David Carlson
Also tbl - xtabs(val~id+cat, dat1) tbl cat id A B C D 1 2 0 4 0 3 0 1 0 0 5 2 0 0 0 6 3 5 2 0 8 0 5 0 2 9 0 0 0 3 To get your column names dimnames(tbl)$cat - paste0(cat, dimnames(tbl)$cat) tbl cat id catA catB catC catD 12040 30100 5

[R] convergence=0 in optim and nlminb is real?

2013-12-16 Thread Adelchi Azzalini
It must be the case that this issue has already been rised before, but I did not manage to find it in past posting. In some cases, optim() and nlminb() declare a successful convergence, but the corresponding Hessian is not positive-definite. A simplified version of the original problem is given

[R] How to plug in characters as object names in a formula (recast from package reshape2 specifically)

2013-12-16 Thread Jun Shen
Hi everyone, This may be very simple but I couldn't figure it out. I have this function rsm.lm-function(data,xvar='xCmin',yvar='yCmin') { #some calculation.. recast(df, xvar~yvar, id.var=1:2, measure.var=3) #some other operations } df is a dataframe defined internally within the

Re: [R] Invalid connection error message when trying to write a file

2013-12-16 Thread Uwe Ligges
I guess your problem is that you cannot write toplevel into c:\ with your permissions? Best, Uwe Ligges On 16.12.2013 16:40, John Karon wrote: Thanks for pointing out my error after specifying the destination in the file( ) function. What you proposed also did not work. It turns out the

Re: [R] Invalid connection error message when trying to write a file

2013-12-16 Thread John Karon
Thanks for pointing out my error after specifying the destination in the file( ) function. What you proposed also did not work. It turns out the solution is to give the file name but not include the path; the resulting file is written in the working directory. The mystery is that including

Re: [R] how to add a line in the graph?

2013-12-16 Thread David Winsemius
On Dec 15, 2013, at 4:46 AM, 水静流深 wrote: t--4:4 y-c(5,7,10,13,15,16,14,12,11) plot(t,y,type=l) how can i add a curve y=0.83*t-0.44*t^2 in the graph? [[alternative HTML version deleted]] t--4:4 y-c(5,7,10,13,15,16,14,12,11) plot(t,y,type=l, ylim=c(-4,16)) curve( 0.83*x-0.44*x^2 ,

Re: [R] Using assign with mapply

2013-12-16 Thread Julio Sergio Santana
Julio Sergio Santana juliosergio at gmail.com writes: I have a data frame whose first colum contains the names of the variables and whose second colum contains the values to assign to them: : kkk - data.frame(vars=c(var1, var2, var3), vals=c(10, 20, 30),

Re: [R] Exporting R graphics into Word without losing graph quality

2013-12-16 Thread Marc Schwartz
On Dec 16, 2013, at 8:39 AM, David Carlson dcarl...@tamu.edu wrote: This will create a simple plot using Windows enhanced metafile format: win.metafile(TestFigure.emf) plot(rnorm(25), rnorm(25)) dev.off() null device 1 Windows does not read pdf. This is correct for

[R] Power calculations for Wilcox.test

2013-12-16 Thread Collin Lynch
Greetings, I'm working on some analyses where I need to calculate wilcox tests for paired samples. In my current literature search I've found a few papers on sample size determination for the wilcox test notably: Sample Size Determination for Some Common Nonparametric Tests Gottfried E. Noether

[R] history ?? 2 no readline ?

2013-12-16 Thread Christian Hoffmann
Hi, What could the cause of history() Error in savehistory(file) : no history available to save savehistory(file=myhist) Error in savehistory(file) : no history available to save save.image() be? I have the information in the attached gif Cheers Christian -- Christian W. Hoffmann, CH

[R] error with as.factor raster

2013-12-16 Thread Lauria, Valentina
Dear List members, I am trying to map the habitat suitability of Nephrops and one of my predictor is a categorical variable. However when I utilised the command as.factor (before to create my rasters stack) I get the error message Error in 1:ncol(r) : argument of length 0. Could anyone help

Re: [R] error with as.factor raster

2013-12-16 Thread Prof Brian Ripley
On 16/12/2013 15:14, Lauria, Valentina wrote: Dear List members, I am trying to map the habitat suitability of Nephrops and one of my predictor is a categorical variable. However when I utilised the command as.factor (before to create my rasters stack) I get the error message Error in

[R] Assigning default function arguments to themselves: Why?

2013-12-16 Thread Andrew Hoerner
Let us suppose that we have a function foo(X) which is called inside another function, bar(). Suppose, moreover, that the name X has been assigned a value when foo is called. I have noticed that many functions contain arguments with defaults of the form X=X. Call this reflexive assignment. How is

Re: [R] Assigning default function arguments to themselves: Why?

2013-12-16 Thread William Dunlap
I have noticed that many functions contain arguments with defaults of the form X=X. Can you show us one (one that 'works')? Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf

Re: [R] 3-D interpretation

2013-12-16 Thread Shane Carey
Hey, I have had another idea since. Is it possible to join these points together (by lines) and then created a polygon from them? Thanks On Wed, Dec 11, 2013 at 10:43 PM, Shane Carey careys...@gmail.com wrote: Hey, Thanks for this. I think I need some way of transposing the data onto a

Re: [R] Power calculations for Wilcox.test

2013-12-16 Thread David Winsemius
On Dec 16, 2013, at 8:27 AM, Collin Lynch wrote: Greetings, I'm working on some analyses where I need to calculate wilcox tests for paired samples. In my current literature search I've found a few papers on sample size determination for the wilcox test notably: Sample Size Determination

Re: [R] extracting non-NA entries from a two-way frequency table

2013-12-16 Thread rmailbox
Sorry about omitting library(plyr). It's really thanks to Hadley, of course. His contributions make us all (capable of being) better. Eric - Original message - From: Michael Friendly frien...@yorku.ca To: rmail...@justemail.net, r-help@r-project.org Subject: Re: extracting non-NA

Re: [R] Chinese Garbled

2013-12-16 Thread yuanzhi
Ista Zahn wrote This is the R-help mailing list. If your problem persists when using R from the command line or with the GUI shipped with R on your (unspecified) platform post back here. Otherwise the RStudio support forum is at https://support.rstudio.com Best, Ista On Sat, Dec 14,

Re: [R] Chinese Garbled

2013-12-16 Thread William Dunlap
columns are 处理水平,“组别”,物种数。 But when I read this file with function read.csv and displayed, these Chinese characters are garbled like the followings: x-read.csv(richness.csv) x[1:5,] X..理?? X.?? 物种数 1CK总 34 You have to, at least, use the check.names=FALSE argument to

[R] read .slk file

2013-12-16 Thread Santosh
Dear Rxperts.. I recently received a data file with the extension .slk. If I save the file as MS Excel file, I am able to read in R without issues. Is it possible to read this .slk file without converting into another R-readable data format? Regards, Santosh [[alternative HTML version

Re: [R] Invalid connection error message when trying to write a file

2013-12-16 Thread J Karon
Indeed, I presume something changed. I would get an error message with the file(description=.) command. The mystery is that everything worked fine before. Thanks for your comments. john karon From: Uwe Ligges-3 [via R] Sent: Monday, December 16, 2013 8:44 AM To: J Karon Subject: Re:

Re: [R] How to choose data from two sets of data to ensure that the choosed data has a better normal feature?

2013-12-16 Thread Rolf Turner
On 16/12/13 20:59, Jeff Newmiller wrote: SNIP This is not a statistics theory forum, but posting a solution to this nonsensical problem would be irresponsible. Fortune? cheers, Rolf __ R-help@r-project.org mailing list

Re: [R] Exporting R graphics into Word without losing graph quality

2013-12-16 Thread Steve Taylor
Unfortunately the win.metafile() device does not support semi-transparent colours, which I like using. In my experience, the best way to get R graphics into Word is to use compressed high-resolution tiff, like this: word.tif = function(filename=Word_Figure_%03d.tif, zoom=4, width=17,

Re: [R] Exporting R graphics into Word without losing graph quality

2013-12-16 Thread Steve Taylor
From: Duncan Murdoch... Don't use a bitmap format (png). I disagree. Each vector format comes with its own problems. Don't produce your graph in one format (screen display), then convert to another (png). Open the device in the format you want for the final file. Agreed. Use a vector

Re: [R] Exporting R graphics into Word without losing graph quality

2013-12-16 Thread david hamer
Thanks to everyone for the helpful suggestions. -- David. On Mon, Dec 16, 2013 at 7:23 PM, Steve Taylor steve.tay...@aut.ac.nzwrote: From: Duncan Murdoch... Don't use a bitmap format (png). I disagree. Each vector format comes with its own problems. Don't produce your graph in one

Re: [R] How to choose data from two sets of data to ensure that the choosed data has a better normal feature?

2013-12-16 Thread Marino David
Anyway, thanks for all your response. These two sets of data are similar. let's assume them are obtained from two experimental setups but at the situation, so they are more similar but not the same because measure error may be involved. I hope I can chose a set of data with a better normal feature

[R] result

2013-12-16 Thread ????????
Mydata is as under. dat= salary ex + 1 1856 1799 + 2 1856 1800 + 3 1858 1800 + 4 1858 1801 + 5 1862 1803 + 6 1862 1805 + 7 1862 1810 + 8 1865 1805 + 9 1865 1808 + 10 1865 1815 + 11 1865 1820 + 12 1870 1810 + 13 1870 1830 + 14 1880 1840 + 15 1880 1845 + 16 1880 1851 + 17

Re: [R] result

2013-12-16 Thread David Winsemius
On Dec 16, 2013, at 10:50 PM, wrote: Mydata is as under. dat= salary ex + 1 1856 1799 + 2 1856 1800 + 3 1858 1800 + 4 1858 1801 snipped + data-read.table(text=dat,header=TRUE) I want to get the result(please see the attatchment),the header is salary,the

Re: [R] What is the formula of Pseudo-F statistic in capscale in vegan?

2013-12-16 Thread Kristen Ross
Dear R-help, We are conducting a distance-based redundancy analysis using capscale and then testing for statistical significance for six terms in the model for the constrained ordination using anova.cca in the vegan package. The significance test is sequential, i.e., testing for significance of a

[R] (no subject)

2013-12-16 Thread Mahboobe Akhlaghi
hello, I have a project in dose response and I should fit some models on my data. how can I fit linear and quadritic models on my data? many thanks, mahboobe [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] unable to install XML package on Windows7

2013-12-16 Thread Wasili Goutas
Hi, I try to install the XML package, but unfortunatelly I get an erroron uncompressing it 'Fehler in untar2(tarfile, files, list, exdir, restore_times) : incomplete block on file' I tried it manually using WinZip and tra in a Cygwin shell and get also errors there. gzip: stdin: unexpected