[R] how to use node info generated by rpart in mars?
I am working on rpart, mars and earth. they all work fine individually. but i want to use node information generated by rpart in earth or mars. (mars is sensitive to outliers. CART deals effectively with outliers.) is there any way to perform this? 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] Error while trying to save summary() output as csv
Thank you David, thank you Ista - as.matrix solves the problem. Best regards, Kamil Sijko +48.790.818.212 2010/3/22 David Winsemius dwinsem...@comcast.net: On Mar 22, 2010, at 3:06 PM, Ista Zahn wrote: Hi Kamil, You can use something like write.csv(t(as.matrix(object)), file=name.csv) -Ista On Mon, Mar 22, 2010 at 2:54 PM, Kamil Sijko kamil.si...@swps.edu.pl wrote: Hi, I need to save output of summary() procedure to a csv file. It's all OK when it's applied to a 'factor' class variable, but when I try to save a 'integer' class summary to csv it gives me : summary(rnorm(100, 10)) - object write.csv2(object, file='name.csv') Error in do.call(expand.grid, c(dimnames(x), stringsAsFactors = stringsAsFactors)) : second argument must be a list It's the same when I use write.csv instead of write.csv2 summary() produces a very simple table: structure(c(7.803, 9.633, 10.15, 10.17, 10.75, 12.41), .Names = c(Min., 1st Qu., Median, Mean, 3rd Qu., Max.), class = table) I have no idea, what to do... So Group, please help me: what does this error mean, and how to cope with it? Not sure why you got that error but if you convert that table into a matrix the writing proceeds as expected: write.csv(as.matrix(structure(c(7.803, 9.633, 10.15, 10.17, 10.75, 12.41), .Names = c(Min., 1st Qu., Median, Mean, 3rd Qu., Max.), class = table) ), file=test.csv) -- David. Thanks for your help. Kamil __ 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. -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org __ 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] package precedence question
Dear R help I am writing a package where I am intending to extend the png function of the grDevices package. When I load my package, my png function indeed substitutes the grDevices function, and everything seems OK. I am a little confused though at how function precedence is determined. I am concerned that when the package moves into production on a webserver that instances may occur when the precedence breaks and the grDevices function becomes the version. I wish to avoid the need for the explicit calling of the myPackage:::png function, is there a way to encourage or coerce the precedence with which packages are loaded and in which functions are evaluated. Some pointers as to where I might find the solution (or a more appropriate nomenclature) would be very gratefully received. Thanks Stephen __ 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] Problem installing package
Dear r-help users, I have just downloaded the package vegan and I have problems accessing the data to go through the examples in the tutorial. I can see the data when I type data() but I am told that the data doesn't exist when I type the name of one of the variables e.g.: varespec Error: object 'varespec' not found I suspect this could be a way I have my files organised or that I have not set a working directory? I am new to R so I suspect I have probably made a simple mistake. Thanks for your help, Craig. ___ [[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] If else statements
Hi everyone! May I request again for your help? I need to make some codes using if else statements... Can I do an if-else statement inside an if-else statement? Is this the correct form of writing it? Thank you.=) Example: for (v in 1:6) { for (i in 2:200) { if (v==1) (if max(x*v-y*v)1 break()) if (v==2) (if max(x*v-y*v)1.8 break()) if (v==3) (if max(x*v-y*v)2 break()) } } -- View this message in context: http://n4.nabble.com/If-else-statements-tp1678705p1678705.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] R script From PHP
Hello, I am having the same problem. My webmaster is not ready to install R on the web server. Is there a way to run R on a remote linux cluster and POST results from the remote server to my website? I am sorry if this is more of a PHP question. Thank you and Any help appreciated. S -- View this message in context: http://n4.nabble.com/R-script-From-PHP-tp931996p1678627.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 use node info generated by rpart in mars?
I am working on rpart, mars and earth. they all work fine individually. but i want to use node information generated by rpart in earth or mars. (mars is sensitive to outliers. CART deals effectively with outliers.) is there any way to perform this? 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] Linear Discriminant Analysis
Hi, I was wondering if you can show me how to plot the discriminant boundary lines for an LD analysis in R. I am curious as to perform this on a larger scale, so I was wondering if you can provide me an example on the infamous 'iris' data. Here's what I have so far: iris.lda=lda(Species ~., data=iris) iris.lda plot(iris.lda) col - rep(c(red, black, blue), each=50) pch - rep(1:3, each=50) plot(iris.lda, col=col, pch=pch) % This will not work to plot the coefficients. abline(lda(Species~.,data=iris)$scaling, col=black) Thanks, Lee _ [[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] Author R books- Packt Publishing.
Hi All, I am writing to you for Packt Publishing, the publishers of computer related books. We are planning to extend our catalogue of books based on Scientific Computing Tools and are currently inviting authors interested in writing for Packt. This doesn't need any previous writing experience. Just an expert knowledge of your subject and a passion to share it with others is all that we require. So, if you love R and are interested in authoring a book, here's an opportunity knocking your door. Write to us with your book ideas at aut...@packtpub.com. Even if you don't have a book idea and are simply interested in authoring a book, we are still keen to hear from you. More details about the opportunity are available at: http://authors.packtpub.com/content/scientific-compting-tools-write-Packt Thanks Kshipra Singh Author Relationship Manager Packt Publishing www.PacktPub.com Skype: kshiprasingh15 Twitter: http://twitter.com/kshipras Interested in becoming an author? Visit http://authors.packtpub.com for all the information you need about writing for Packt. [[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] printing text within if functions inside a for loop
Hi I am having a problem with outputting text inside an if function. I have the following code: for (j in 20:length(bb.up)) { if (up[j]==1 up[j-1]==0) { sprintf(Long on %s at a price of %f,dates[j],data[j]) } if (down[j]==1 down[j-1]==0) { sprintf(Short on %s at a price of %f,dates[j],data[j]) } } The loop runs fine and the sprintf function runs fine on its own, but the problem I am having is that there is no output if I run the loop with the sprintf inside it. Does anyone know what could be wrong? Is there a way for the code to output data within this loop? I can't seem to find anything on the internet for this problem. Thanks in advance. -- Tian Pan Tel: +27 (0)21 670 5295 [[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] printing text within if functions inside a for loop
Use: cat(sprintf(Long on %s at a price of %f\n,dates[j],data[j])) Hope it helps mario Tian Pan wrote: Hi I am having a problem with outputting text inside an if function. I have the following code: for (j in 20:length(bb.up)) { if (up[j]==1 up[j-1]==0) { sprintf(Long on %s at a price of %f,dates[j],data[j]) } if (down[j]==1 down[j-1]==0) { sprintf(Short on %s at a price of %f,dates[j],data[j]) } } The loop runs fine and the sprintf function runs fine on its own, but the problem I am having is that there is no output if I run the loop with the sprintf inside it. Does anyone know what could be wrong? Is there a way for the code to output data within this loop? I can't seem to find anything on the internet for this problem. Thanks in advance. -- Ing. Mario Valle Data Analysis and Visualization Group| http://www.cscs.ch/~mvalle Swiss National Supercomputing Centre (CSCS) | Tel: +41 (91) 610.82.60 v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax: +41 (91) 610.82.82 __ 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] maxNR - Error in p(a, b) : element 1 is empty; the part of the args list of '*' being evaluated was: (b, t)
On 22 March 2010 16:31, 4-real danielkjae...@gmail.com wrote: Hello everyone... We were trying to implement the Newton-Raphson method in R, and estimate the parameters a and b, of a function, F, however we can't seem to implement this the right way. Hope you can show me the right way to do this. I think what we want R to do is to read the data from the website and then peform maxNR on the function, F. Btw the version of R being used is RGui for Windows if it helps to know this. R-code below: library(maxLik) require(maxLik) x - read.table('http://www.math.ku.dk/kurser/2008-09/blok4/stat2/doku/data/Eksempel_6_3.txt', header = TRUE); t - log(x$Koncentration); X - x$Status; p - function(a,b) exp(a+b*t)/(1+exp(a+b*t)); S - sum(X); SP - sum(t*X); F - function(a,b) { + c(sum(p(a,b)) - S, + sum(t*p(a,b)) - SP) + } z - maxNR(F, start=1, print.level=2) Error in p(a, b) : element 1 is empty; the part of the args list of '*' being evaluated was: (b, t) You forgot to provide argument b for function F: R z - maxNR(F, start=1, b=1, print.level=2) - Initial parameters: - fcn value: -15.42843 parameter initial gradient free [1,] 1-22.490161 Condition number of the (active) hessian: 1 -Iteration 1 - -Iteration 2 - -Iteration 3 - -Iteration 4 - -Iteration 5 - -Iteration 6 - -- gradient close to zero. May be a solution 6 iterations estimate: -0.6288598 Function value: -1.536789 /Arne -- Arne Henningsen http://www.arne-henningsen.name __ 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] R script From PHP
Hello, You might like the php client to Rserve that is part of the next version of Rserve. see http://www.rforge.net/Rserve/svn.html install the last snapshot, and check the client/php/simple.php file If you decide to go this way, then I'd suggest you use the stats-rosuda-devel mailing list for further questions. Romain Le 23/03/10 04:27, sanchow a écrit : Hello, I am having the same problem. My webmaster is not ready to install R on the web server. Is there a way to run R on a remote linux cluster and POST results from the remote server to my website? I am sorry if this is more of a PHP question. Thank you and Any help appreciated. S -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/OIXN : raster images and RImageJ |- http://tr.im/OcQe : Rcpp 0.7.7 `- http://tr.im/O1wO : highlight 0.1-5 __ 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] Log linear model - Showing non-deviation form in glm()
Hey, Whenever I set up a log linear model using glm(Y~. , data=data, family=poisson) I get the parameters in the form of deviation from the first cell kombination. I find this to be hard to interpret when I for instance want to know if there is a difference between two factors in the first category since those parameters are not shown directly. Is there any way to get the summary() command, or equivalent, to show me all of the parameters in the model in non-deviation form? I can use loglin() to get the parameters, but it doesnt show significance of the parameters from what I can tell. Alternatively, can anyone give a brief explanation of how to interpret the model in deviation form? For example here I have the factors Gamla and Nya and the categories 0, 1-10, 11-50, 51-100 and 101+ The interpretation of the shown interaction terms are no problem, but how do I figure if there is a difference between Gamla and Nya when it comes to category 0? (Intercept)7.747600.02078 372.852 2e-16 *** typNya-2.349430.07040 -33.371 2e-16 *** kategori1-10 -1.889660.05735 -32.950 2e-16 *** kategori101+ -4.058720.15947 -25.451 2e-16 *** kategori11-50 -2.635610.08035 -32.802 2e-16 *** kategori51-100-4.612100.20955 -22.010 2e-16 *** typNya:kategori1-100.725610.14935 4.858 1.18e-06 *** typNya:kategori101+ -1.339451.01486 -1.3200.187 typNya:kategori11-50 0.181890.25221 0.7210.471 typNya:kategori51-100 -0.092910.74056 -0.1250.900 Thanks for any help, and sorry for the supposedly basic question! 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.
[R] S4: Multiple inheritance
Hi all, Working with S4 object, I definine two class foo1 and foo2. I define '[' (resp. '[-') for the two classes. Then I define a third class foo3 that inherit from both foo1 and foo2. Is there a way to make '[' (resp. '[-') for foo3 inherit from '[' (resp. '[-') for foo1 and foo2? Thanks Christophe __ 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] Changing content of column in data.frame + efficient join extraction between 2 data.frames
Dear R users, I have 2 SpatialPointsDataFrame's, pcs and East. The column str_1 in the first (pcs) is: pcs[0:4,] coordinates cat str_1 int_1 int_2dbl_1 dbl_2 1 (101000, 263000) 1 SM06B 101000 263000 4.978915 -4.293668 2 (101000, 265000) 2 SM06C 101000 265000 4.960478 -4.266742 3 (101000, 267000) 3 SM06D 101000 267000 4.912984 -4.246849 4 (101000, 269000) 4 SM06E 101000 269000 4.613309 -4.185405 The column str_1 in the second (East) is: East[0:4,] coordinates str_1 1 (489000, 215000) sp81x 2 (489000, 217000) sp81y 3 (493000, 209000) sp90j 4 (495000, 209000) sp90p I would like to do 2 things: 1) I would like to change the format of the column str_1 in the first to be the same that it is in the second, that is I need to remove the inverted commas and I need to make it lower case. 2) I would like to extract the rows from the first one (pcs) where pcs$str_1 is the same as East$str_1. I have even tried regexp, but cannot modify the content of pcs$str_1 to remove the inveretd commas and change the case to lowercase. How do I do that? Regards -- Corrado Topi PhD Researcher Global Climate Change and Biodiversity Area 18,Department of Biology University of York, York, YO10 5YW, UK Phone: + 44 (0) 1904 328645, E-mail: ct...@york.ac.uk __ 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] S4: Multiple inheritance
Dear Christophe, Could you please post some example code of what you are trying to achieve? Christophe Genolini wrote: Hi all, Working with S4 object, I definine two class foo1 and foo2. I define '[' (resp. '[-') for the two classes. Then I define a third class foo3 that inherit from both foo1 and foo2. Is there a way to make '[' (resp. '[-') for foo3 inherit from '[' (resp. '[-') for foo1 and foo2? Thanks Christophe __ 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. -- Corrado Topi PhD Researcher Global Climate Change and Biodiversity Area 18,Department of Biology University of York, York, YO10 5YW, UK Phone: + 44 (0) 1904 328645, E-mail: ct...@york.ac.uk __ 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 with survival package
I am trying use survfit function in survival package, but getting an error that Error in survfit: could not find function survfit.km This package was working fine previously. I am using R version 2.9.2 on Windows. Can anyone tell me if this is a bug in the function code or something is missing in the newer version of R. I appreciate any help regarding this. Thanks Uma __ 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] Changing content of column in data.frame + efficient join extraction between 2 data.frames
On Tue, 2010-03-23 at 09:37 +, Corrado wrote: Dear R users, I have 2 SpatialPointsDataFrame's, pcs and East. The column str_1 in the first (pcs) is: pcs[0:4,] coordinates cat str_1 int_1 int_2dbl_1 dbl_2 1 (101000, 263000) 1 SM06B 101000 263000 4.978915 -4.293668 2 (101000, 265000) 2 SM06C 101000 265000 4.960478 -4.266742 3 (101000, 267000) 3 SM06D 101000 267000 4.912984 -4.246849 4 (101000, 269000) 4 SM06E 101000 269000 4.613309 -4.185405 The column str_1 in the second (East) is: East[0:4,] coordinates str_1 1 (489000, 215000) sp81x 2 (489000, 217000) sp81y 3 (493000, 209000) sp90j 4 (495000, 209000) sp90p I would like to do 2 things: 1) I would like to change the format of the column str_1 in the first to be the same that it is in the second, that is I need to remove the inverted commas and I need to make it lower case. 2) I would like to extract the rows from the first one (pcs) where pcs$str_1 is the same as East$str_1. I have even tried regexp, but cannot modify the content of pcs$str_1 to remove the inveretd commas and change the case to lowercase. How do I do that? Regards Hi Corrado! First: tolower(pcs$str_1) change to lower case Second: try merge (East,pcs,by.x=str_1,by.y=str_1) to fusion data frames Third: I don't recreate your database East in my computer do you give a small part to I try solve your problem? -- Bernardo Rangel Tura, M.D,MPH,Ph.D National Institute of Cardiology Brazil __ 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] Extracting all members with a specific similarity value from a large similarity matrix
I have a large dataframe (1400x1400) containing a symmetric similarity matrix. Now I would like to extract subsets of elements where all elements have a specific similarity with all other elements of this subset. For example if the data looks like this Spl1Spl2Spl3Spl4Spl5[...] Spl11 0.125 0.000 0.000 0.125 Spl20.125 1 0.000 0.000 0.125 Spl30.000 0.000 1 0.000 0.500 Spl40.000 0.000 0.000 1 0.750 Spl50.125 0.125 0.500 0-750 1 [...] I am looking for a way to either like to extract, all elements that are mutually 0, e.g: Spl1Spl3Spl4[...] Spl11 0.000 0.000 Spl30.000 1 0.000 Spl40.000 0.000 1 [...] Or that mutually have similarity 0.125: Spl1Spl2Spl5[...] Spl11 0.125 0.125 Spl20.125 1 0.125 Spl50.125 0.125 1 [...] Or alternatively to sort the table so that this info can easily be obtained by looking for blocks around the diagonal, like this: Spl3Spl4Spl1Spl2Spl5[...] Spl31 0.000 0.000 0.125 0.500 Spl40.000 1 0.000 0.000 0.750 Spl10.000 0.000 1 0.125 0.125 Spl20.000 0.000 0.125 1 0.125 Spl50.500 0.750 0.125 0.125 1 [...] Any help is much appreciated! Helmut Bürgmann, Switzerland __ 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
Hello All, I am new to R and tried to install R in Linux system (OS: Open SUSE). After untar the source code, changed the directory, and typed the command ./configure, it was checking a list...finally it gave an error message. Here with i have enclosed the error message. Check-list goes like this: checking if g++ supports -c -o file.o... yes checking if g++ supports -c -o file.o... (cached) yes checking whether the g++ linker (/usr/i586-suse-linux/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no checking for gfortran option to produce PIC... -fPIC checking if gfortran PIC flag -fPIC works... yes checking if gfortran static flag -static works... yes checking if gfortran supports -c -o file.o... yes checking if gfortran supports -c -o file.o... (cached) yes checking whether the gfortran linker (/usr/i586-suse-linux/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking for cos in -lm... yes checking for sin in -lm... yes checking for dlopen in -ldl... yes checking readline/history.h usability... no checking readline/history.h presence... no checking for readline/history.h... no checking readline/readline.h usability... no checking readline/readline.h presence... no checking for readline/readline.h... no checking for rl_callback_read_char in -lreadline... no checking for main in -lncurses... yes checking for rl_callback_read_char in -lreadline... no checking for history_truncate_file... no configure: error: --with-readline=yes (default) and headers/libs are not available Can anyone help me in this regard? Expecting your reply and thanks in advance. Warm regards Fredrick. __ 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] help
Hi Fredrick, Is there a reason you need to compile the source code? If not, I recommend following the instillation instructions on CRAN. OpenSuse instructions are at http://cran.r-project.org/bin/linux/suse/ Best, Ista On Tue, Mar 23, 2010 at 7:43 AM, fredrick devadoss fredrick_i...@yahoo.com wrote: Hello All, I am new to R and tried to install R in Linux system (OS: Open SUSE). After untar the source code, changed the directory, and typed the command ./configure, it was checking a list...finally it gave an error message. Here with i have enclosed the error message. Check-list goes like this: checking if g++ supports -c -o file.o... yes checking if g++ supports -c -o file.o... (cached) yes checking whether the g++ linker (/usr/i586-suse-linux/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no checking for gfortran option to produce PIC... -fPIC checking if gfortran PIC flag -fPIC works... yes checking if gfortran static flag -static works... yes checking if gfortran supports -c -o file.o... yes checking if gfortran supports -c -o file.o... (cached) yes checking whether the gfortran linker (/usr/i586-suse-linux/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking for cos in -lm... yes checking for sin in -lm... yes checking for dlopen in -ldl... yes checking readline/history.h usability... no checking readline/history.h presence... no checking for readline/history.h... no checking readline/readline.h usability... no checking readline/readline.h presence... no checking for readline/readline.h... no checking for rl_callback_read_char in -lreadline... no checking for main in -lncurses... yes checking for rl_callback_read_char in -lreadline... no checking for history_truncate_file... no configure: error: --with-readline=yes (default) and headers/libs are not available Can anyone help me in this regard? Expecting your reply and thanks in advance. Warm regards Fredrick. __ 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. -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org __ 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] Mosaic plots
As pointed out by others, vcd supports mosaic plots on top of the grid engine (which is extremely helpful for those of us who love playing around with grid). The standard mosaicplot() function is directly available (it isn't clear if you knew this). The proper display of names is a real challenge faced by all of us with these plots, so you should try each version. I'm not sure what you intend to do with a legend, but if you want the ability to customize and hack code, I suggest you look at grid and a modification to vcd's version to suit your purposes. Jay Subject: [R] Mosaic Plots Message-ID: 1269256874432-1677468.p...@n4.nabble.com Content-Type: text/plain; charset=us-ascii Hello Everyone I want to plot Moasic Plots, I have tried them using iplots package (using imosaic). The problem is the names dont get alligned properly, is there a way to a align the names and provide legend in Mosaic plots using R? Also I would like to know any other packages using which I can plot Mosaic Plots Thank you in advance Sunita -- -- John W. Emerson (Jay) Associate Professor of Statistics Department of Statistics Yale University http://www.stat.yale.edu/~jay http://www.stat.yale.edu/%7Ejay -- John W. Emerson (Jay) Associate Professor of Statistics Department of Statistics Yale University http://www.stat.yale.edu/~jay [[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] rdcomclient issue - member not found when using borders
I wrote a procedure to create a spreadsheet using rdcomclient. It uses a function to do the writing and runs correctly in isolation. It gives errors, but it continues to completion. The error I receive is Error: Member not found. If I place it inside a for loop the loop fails after the first iteration, once it reaches the error. Has anyone had experience with this error? Here is the code that is causing the problem. library(RDCOMClient) source(http://www.omegahat.org/RDCOMClient/examples/excelUtils3.R;) xls - COMCreate(Excel.Application) xls[[Visible]] - TRUE wb = xls[[Workbooks]]$Add(1) sh = wb[[Worksheets]]$Add() sh[[Name]] - as.character(tabName) AnalyzeExport - function(sh,Data,Cell,Title1,Title2) { letters-c(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O, P,Q,R,S,T,U,V,W,X,Y,Z) print(Cell) exportDataFrame(Data, at = sh$Range(Cell)) B3R-sh$Range(Cell) B3R[[Formula]] - Title1 #B3R[[HorizontalAlignment]]-xlRight B3R-sh$Range(paste(letters[grep(substring(Cell,1,1),letters)+1],substri ng(Cell,2),sep=)) B3R[[Formula]] - Title2 #B3R[[HorizontalAlignment]]-xlLeft B3R-sh$Range(paste(substring(Cell,1,1), as.integer(substring(Cell,2))+1+nrow(Data),sep=)) B3R[[Formula]] - Total B3R-sh$Range(paste(letters[grep(substring(Cell,1,1),letters)+1], as.integer(substring(Cell,2))+1+nrow(Data),sep=)) Cell1-paste(letters[grep(substring(Cell,1,1),letters)], as.integer(substring(Cell,2))+1,sep=) Cell2-paste(letters[grep(substring(Cell,1,1),letters)+1], as.integer(substring(Cell,2))+nrow(Data),sep=) MyCell=paste(Cell1,:,Cell2,sep=) B3R[[Formula]] - paste(=sum(,MyCell,),sep=) print(MyCell) B3RB - sh$Range(MyCell) B3RB[[Borders]][[LineStyle]]-as.integer(1) #B3RB[[ColumnWidth]]-20 } AnalyzeExport(sh,ExcelCopy,B2,NDC,Unique Pats) The line that is causing the problem is : B3RB[[Borders]][[LineStyle]]-as.integer(1) On another note, I'd also love to learn how to change columnWidth and HorizontalAligment properly (the code commented out). Jason Baucom Ateb, Inc. 2600 Sumner Blvd. Suite 158 Raleigh, NC 27616 www.ateb.com http://www.ateb.com/ [[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] If else statements
Here are some references. Please read these first and post again if you are still stuck after reading them. If you do post again, we will need x and y. 1. Introduction to R : 9.2.1 Conditional execution: if statements. 2. R Language Definition : 3.2 Control structures. 3. R for beginners by E Paradis : 6.1 Loops and vectorization 4. Eric Raymond's essay How to Ask Questions The Smart Way http://www.catb.org/~esr/faqs/smart-questions.html. HTH Matthew tj girlm...@yahoo.com wrote in message news:1269325933723-1678705.p...@n4.nabble.com... Hi everyone! May I request again for your help? I need to make some codes using if else statements... Can I do an if-else statement inside an if-else statement? Is this the correct form of writing it? Thank you.=) Example: for (v in 1:6) { for (i in 2:200) { if (v==1) (if max(x*v-y*v)1 break()) if (v==2) (if max(x*v-y*v)1.8 break()) if (v==3) (if max(x*v-y*v)2 break()) } } -- View this message in context: http://n4.nabble.com/If-else-statements-tp1678705p1678705.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] Problem installing package
The inner components of object are not accessible by name. You need to use the proper functions to retrieve or modify them. You are asked by the PostingGuide to show your code and be more specific about problems. Until you do so, that is about all anyone will be able to say about your mistakes. -- David. On Mar 23, 2010, at 4:17 AM, Craig Woodward wrote: Dear r-help users, I have just downloaded the package vegan and I have problems accessing the data to go through the examples in the tutorial. I can see the data when I type data() but I am told that the data doesn't exist when I type the name of one of the variables e.g.: varespec Error: object 'varespec' not found I suspect this could be a way I have my files organised or that I have not set a working directory? I am new to R so I suspect I have probably made a simple mistake. -- David Winsemius, MD 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.
[R] caret package, how can I deal with RFE+SVM wrong message?
Hello, I am learning caret package, and I want to use the RFE to reduce the feature. I want to use RFE coupled Random Forest (RFE+FR) to complete this task. As we know, there are a number of pre-defined sets of functions, like random Forest(rfFuncs), however,I want to tune the parameters (mtr) when RFE, and then I write code below, but there is something wrong message, How can I deal with it? rfGrid-expand.grid(.mtry=c(1:2)) rfectrl-rfeControl(functions=caretFuncs,method=cv,verbose=F,returnResamp=final,number=10) subsets-c(3,4) set.seed(2) rf.RFE-rfe(trx,try,sizes=subsets,rfeControl=rfectrl,method=rf,tuneGrid=rfGrid) Loading required package: class Attaching package: 'class' The following object(s) are masked from package:reshape : condense Fitting: mtry=1 Fitting: mtry=2 Error in varImp.randomForest(object$finalModel, ...) : subscript out of bounds In addition: Warning message: package 'e1071' was built under R version 2.10.1 At the same time, If I want to use RFE+SVM, RFE+nnet, and so on ,how can I do? I have try RFE+SVM, also wrong message: set.seed(1) svmProfile-rfe(trx,try,sizes=c(1:3), + rfeControl=rfeControl(functions=caretFuncs,method=cv, + verbose=F,returnResamp=final,number=10), + method=svmRadial,tuneLength=5) Fitting: sigma=0.009246713, C=0.1 Fitting: sigma=0.009246713, C=1 Fitting: sigma=0.009246713, C=10 Fitting: sigma=0.009246713, C=100 Fitting: sigma=0.009246713, C=1000 Error in rfeControl$functions$rank(fitObject, .x, y) : need importance columns for each class thank you! -- View this message in context: http://n4.nabble.com/caret-package-how-can-I-deal-with-RFE-SVM-wrong-message-tp1678800p1678800.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] Transform data set
Dear R Experts, I am having some trouble creating a variable in R. I have data on self-placement of voters, their placement of parties, and which party they feel closest to. The data is structured like this: Party_Closelrplaceself lrplaceParty1 lrplaceParty2 ... party1 2 4 5 party2 5 6 4 party1 6 2 1 etc... I want to format the data set so it looks like this: Party_Close lrplacepartyclose lrplaceself party14 2 party24 5 party12 6 Any help is greatly appreciated! With kind regards, Thomas __ 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] information module Wilks' lambda criterion
Hi everybody, I was wondering if you can help me about a module. In fact, I'm looking for a package or module about Wilks' lambda criterion in R environment. I didn't find it in R website ( http://cran.cict.fr/web/packages/index.html#available-packages-W or http://search.cpan.org/faq.html). If this module exists, could you show me the command line. Thank you very much for your help, Miss Catherine ENG - Laboratoire de Génétique et Microbiologie UMR INRA 1128 - IFR 110 Université Henri Poincaré - Faculté des Sciences BP 239 54506 Vandoeuvre-lès-Nancy Tél. : 06.58.25.37.66 [[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] estimation of parameters with grofit
Hello again about grofit: I've been looking at the grofit explanatory pdf, but it seems to me that it's missing a little bit of commentary as to the multiplicity of 'experiments'. For example, what is the minimum number of data points(not time points) to obtain a model? Would it be similar to the approximately 12 that we read will give us a basic regression? regards, shfets On Mon, Mar 22, 2010 at 2:43 PM, alexander russell ssv...@gmail.com wrote: Hello, I'm trying to understand grofit's estimation of models, and fairly new to growth models generally. The data used by grofit consists of the vector of experiments, that is the growth values for a vector of individuals measured at different times. Can I understand correctly that the program estimates parameters for the growth model based on a regression(linear or non linear) analysis of the data at time 1 to time 2, then time 2 to time 3, building a curve piecewise? regards, shfets [[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] Embed R code in C++
No, I didnt install Rcpp but i have R 2.10.1 already installed. What's the difference with Rinside and Rcpp? Do i need both to embed R code in C++ file or just one of them ? Could you tell me where can i get Rcpp pkg? How can i Install it because i dont know how to compile a source file on the terminal. Thanks very much for your help. -- View this message in context: http://n4.nabble.com/Embed-R-code-in-C-tp1677784p1678986.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] R-installation regarding.
Hello All, I am new to R and tried to install R in Linux system (OS: Open SUSE). After untar the source code, changed the directory, and typed the command ./configure, it was checking a list...finally it gave an error message. Here with i have enclosed the error message. Check-list goes like this: checking if g++ supports -c -o file.o... yes checking if g++ supports -c -o file.o... (cached) yes checking whether the g++ linker (/usr/i586-suse-linux/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no checking for gfortran option to produce PIC... -fPIC checking if gfortran PIC flag -fPIC works... yes checking if gfortran static flag -static works... yes checking if gfortran supports -c -o file.o... yes checking if gfortran supports -c -o file.o... (cached) yes checking whether the gfortran linker (/usr/i586-suse-linux/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking for cos in -lm... yes checking for sin in -lm... yes checking for dlopen in -ldl... yes checking readline/history.h usability... no checking readline/history.h presence... no checking for readline/history.h... no checking readline/readline.h usability... no checking readline/readline.h presence... no checking for readline/readline.h... no checking for rl_callback_read_char in -lreadline... no checking for main in -lncurses... yes checking for rl_callback_read_char in -lreadline... no checking for history_truncate_file... no configure: error: --with-readline=yes (default) and headers/libs are not available Can anyone help me in this regard? Expecting your reply and thanks in advance. Warm regards Fredrick. __ 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] Calling R functions into C# or C++
Fayssal, This zip file appears to be corrupted - do you have another version? -- View this message in context: http://n4.nabble.com/Calling-R-functions-into-C-or-C-tp904267p1679002.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] Transform data set
I am not entirely sure what you are trying to do. Are you wanting to re-arrange the columns or apply some sort of transformation? On Tue, Mar 23, 2010 at 4:47 AM, Thomas Jensen thomas.jen...@eup.gess.ethz.ch wrote: Dear R Experts, I am having some trouble creating a variable in R. I have data on self-placement of voters, their placement of parties, and which party they feel closest to. The data is structured like this: Party_Close lrplaceself lrplaceParty1 lrplaceParty2 ... party1 2 4 5 party2 5 6 4 party1 6 2 1 etc... I want to format the data set so it looks like this: Party_Close lrplacepartyclose lrplaceself party1 4 2 party2 4 5 party1 2 6 Any help is greatly appreciated! With kind regards, Thomas __ 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. -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis __ 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] help with survival package
I am trying use survfit function in survival package, but getting an error that Error in survfit: could not find function survfit.km This package was working fine previously. I am using R version 2.9.2 on Windows. Can anyone tell me if this is a bug in the function code or something is missing in the newer version of R. I appreciate any help regarding this. Thanks Uma __ 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] Transform data set
Looks like this way, dat$lrplacepartyclose - NA dat$lrplacepartyclose[dat$Party_Close==party1] - dat$lrplaceParty1[dat$Party_Close==party1] dat$lrplacepartyclose[dat$Party_Close==party2] - dat$lrplaceParty2[dat$Party_Close==party2] and goes on and on. On 23 March 2010 17:47, Thomas Jensen thomas.jen...@eup.gess.ethz.ch wrote: Dear R Experts, I am having some trouble creating a variable in R. I have data on self-placement of voters, their placement of parties, and which party they feel closest to. The data is structured like this: Party_Close lrplaceself lrplaceParty1 lrplaceParty2 ... party1 2 4 5 party2 5 6 4 party1 6 2 1 etc... I want to format the data set so it looks like this: Party_Close lrplacepartyclose lrplaceself party1 4 2 party2 4 5 party1 2 6 Any help is greatly appreciated! With kind regards, Thomas __ 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. -- Wincent Ronggui HUANG Doctoral Candidate Dept of Public and Social Administration City University of Hong Kong http://asrr.r-forge.r-project.org/rghuang.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.
Re: [R] help with survival package
On Mar 23, 2010, at 6:13 AM, Shankavaram, Uma (NIH/NCI) [E] wrote: I am trying use survfit function in survival package, but getting an error that Error in survfit: could not find function survfit.km This package was working fine previously. I am using R version 2.9.2 on Windows. If you are using the current version of package survival with the prior version of R it should not be a surprise if there are incompatibilities. Can anyone tell me if this is a bug in the function code or something is missing in the newer version of R. No code, no comment. I appreciate any help regarding this. Thanks See that message at the bottom of every posting? Please read for meaning. -- David Winsemius, MD 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] R-installation regarding.
Hi Frederick, The development files for readline are not available. Install them to get this working. For debian/ubuntu the package to install is called libreadline-dev or something. SUSE's package manager might have a similar package. Alternatively you can skip installing R from source and use binary packages that are available in .dev, .rpm etc from CRAN [1]. This ensures you have the latest version of R and that upgrading is done through the package manager of SUSE, minimizing your work. cheers, Paul [1] http://cran.r-project.org/bin/linux/suse/ fredrick devadoss wrote: Hello All, I am new to R and tried to install R in Linux system (OS: Open SUSE). After untar the source code, changed the directory, and typed the command ./configure, it was checking a list...finally it gave an error message. Here with i have enclosed the error message. Check-list goes like this: checking if g++ supports -c -o file.o... yes checking if g++ supports -c -o file.o... (cached) yes checking whether the g++ linker (/usr/i586-suse-linux/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no checking for gfortran option to produce PIC... -fPIC checking if gfortran PIC flag -fPIC works... yes checking if gfortran static flag -static works... yes checking if gfortran supports -c -o file.o... yes checking if gfortran supports -c -o file.o... (cached) yes checking whether the gfortran linker (/usr/i586-suse-linux/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking for cos in -lm... yes checking for sin in -lm... yes checking for dlopen in -ldl... yes checking readline/history.h usability... no checking readline/history.h presence... no checking for readline/history.h... no checking readline/readline.h usability... no checking readline/readline.h presence... no checking for readline/readline.h... no checking for rl_callback_read_char in -lreadline... no checking for main in -lncurses... yes checking for rl_callback_read_char in -lreadline... no checking for history_truncate_file... no configure: error: --with-readline=yes (default) and headers/libs are not available Can anyone help me in this regard? Expecting your reply and thanks in advance. Warm regards Fredrick. __ 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. -- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +3130 274 3113 Mon-Tue Phone: +3130 253 5773 Wed-Fri http://intamap.geo.uu.nl/~paul __ 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] Embed R code in C++
Le 23/03/10 13:34, mans a écrit : No, I didnt install Rcpp but i have R 2.10.1 already installed. If you want to use RInside, you need Rcpp. This is what dependencies are for. you can install Rcpp from R : install.packages( Rcpp ) What's the difference with Rinside and Rcpp? Rcpp defines a set of classes to ease writing C++ code in R packages. you can think it as c++ inside R. RInside facilitates embedding R in a c++ application, you can think it as R inside c++. Do i need both to embed R code in C++ file or just one of them ? You don't __need__ any of them, but thy will make the process easier. Could you tell me where can i get Rcpp pkg? cran, but google knows and would have given you the answer more quickly. How can i Install it because i dont know how to compile a source file on the terminal. Thanks very much for your help. -- Romain Francois Professional R Enthusiast +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr |- http://tr.im/OIXN : raster images and RImageJ |- http://tr.im/OcQe : Rcpp 0.7.7 `- http://tr.im/O1wO : highlight 0.1-5 __ 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] If else statements
Thanks Matthew... I will read your suggested articles/files. I hope, i will be able to figure out what should be done with this. =) ~tj -- View this message in context: http://n4.nabble.com/If-else-statements-tp1678705p1679073.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] If else statements
The short answer is yes, you can, but your syntax is wrong. You need to make sure you wrap your conditions inside brackets, and use {, not (, to delineate your if statements. for (v in 1:6) { for (i in 2:200) { if (v==1){ if (max(x*v-y*v)1) break() } } } et cetera On Tue, Mar 23, 2010 at 3:32 AM, tj girlm...@yahoo.com wrote: Hi everyone! May I request again for your help? I need to make some codes using if else statements... Can I do an if-else statement inside an if-else statement? Is this the correct form of writing it? Thank you.=) Example: for (v in 1:6) { for (i in 2:200) { if (v==1) (if max(x*v-y*v)1 break()) if (v==2) (if max(x*v-y*v)1.8 break()) if (v==3) (if max(x*v-y*v)2 break()) } } -- View this message in context: http://n4.nabble.com/If-else-statements-tp1678705p1678705.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] Converting date format
R community: Hello, I would to like to convert a character date variable from %m/%d/%Y to %m/%d/%y. Any advice would be greatly appreciated. I have tried functions for changing the formatting and removing the unnecessary digits without success. Mike __ 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] no predict function in lme4 ?
Dear mixed effects modelers, I seem unable to find a predict method for mer objects in the package lme4. Am I not seeing the forest for the trees ? Any pointer would be very helpful. Thanks, Markus [[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] Converting date format
If x is your vector of character date variables: orig.date - as.Date(x, format=c(%m/%d/%Y)) new.date - format(x, format=c(%m/%d/%y)) -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Hosack, Michael Sent: Tuesday, March 23, 2010 10:11 AM To: R-help@r-project.org Subject: [R] Converting date format R community: Hello, I would to like to convert a character date variable from %m/%d/%Y to %m/%d/%y. Any advice would be greatly appreciated. I have tried functions for changing the formatting and removing the unnecessary digits without success. Mike __ 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. === P Please consider the environment before printing this e-mail Cleveland Clinic is ranked one of the top hospitals in America by U.S.News World Report (2009). Visit us online at http://www.clevelandclinic.org for a complete listing of our services, staff and locations. Confidentiality Note: This message is intended for use\...{{dropped:13}} __ 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] Solutions for memory problems (packages ff, bigmemory)?
Hello, I want to impute missing values using the package mi. My file has around 28 MB (50.000 observations, 120 variables). My computer is a Windows XP 32-bit machine, 4 GB Duo Core processor. When I run mi, already after some minutes during iteration 1, I get the message that a vector allocation fails. Even with a 10% sample of the dataset, it doesn't work. I've read about the packages ff and bigmemory. Can they help me that the mi package doesn't use the RAM for temporary files but the hard drive instead? Since I'm not a R expert, I don't understand completely how these packages work. Or are there other packages for a better memory management? Or is really a 64-bit OS the only solution for this problem? I hope that there are some suggestions for my problem since many R procedures seem to be very promising but they don't work on my machine because of the memory limitation. Thanks, Hans-Peter __ 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] multi-stage sampling and hierarchical models: which packages?
Dear wizaRds, I have a dataset to analyse which is causing me problems. It is a sample of parents in schools. First we had a population table of the schools in the country in question divided into five regions, and in each region we have an urban/rural split. The population Ns in these ten cells are known. Then three schools were drawn from each cell according to the Lahirie method, i.e with probability of being selected depending on school size. Students were then drawn randomly from the schools, again with probability proportional to school size. Details of this are below in case this is important. I have calculated the weights. So I have a weighting problem and a mixed levels problem at the same time. Even if I just use the survey package I am not sure how to specify the model, because I have clusters within strata rather than strata within clusters. I guess it would look something like dstrat-svydesign(id=~schoolC,strata=~region+urbanrural, weights=~newweight, data=mydataset,nest=T), but this gives the same results as dstrat-svydesign(id=~schoolC,strata=~region, weights=~newweight, data=mydataset,nest=T) And I can't see any way to look at the mixed levels effects using that package. Perhaps I am better advised to use nlme; I guess I can just use the weights as a covariate? My ultimate aims are to conduct various regressions in which I expect the school- and region-level effects to be strong. Ideally I would like to use sem as well, but then I am really stuck. If someone could put me on the right track I could be more specific with reproducible examples etc Best Wishes Steve Powell **details of Lahirie method as we used it: the schools were put into a list in order of ascending size (student population) and this list was divided into three bands containing 25%, 35% and 40% of all the students in the cell, respectively; and three schools were chosen randomly from each size band. Then samples of students were drawn randomly from lists of students at each school, so that more students were chosen from the larger schools: 20, 30 and 40 from each of the smaller, medium and large schools. So we have (20+30+40)*3 students per cell, for 10 cells = 2700 students in this country. www.promente.org | skype stevepowell99 | Thailand +66 8 4438 2667 [[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] glmpath and coxpath variables
Hi, I am analyzing a set of variables in order to create a survival model for a set of patients. I have checked the reference manual for glm path and coxpath in order to achieve it. However I have a doubt about the class of the covariates I can use with the last mentioned package. In the example, the package loads a list called lung.data. This object has a matrix with the covariate information x and two vectors about the censoring and the time to the event. The information in the x matrix seems to be numeric, but some of the covariates could be categorical (1st and 2nd columns) because they only have 2 or 4 different values. If we check their class they are numeric. Thus, the question is: can I use categorical and continuous covariates in this matrix (x)? Thanks a lot, Antoni. [[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] using a list to index elements of a list
I have a list of vectors, x, with x[[1]]=1:5, say. And I need to go through each element of each vector in a for loop. Something like: for (v in x[[1]]) print(v) However, I need to store this index v for later, and I have lots of other indices which we range over later in the code so thought I'd make a list of these indices, v-list(). But then when I try: for( v[[1]] in x[[1]] ) print(v[[1]]) I get errors: x-list() x[[1]]=1:5 v-list() for(v[[1]] in x[[1]]) Error: unexpected '[[' in for(v[[ print v[[1]] Error: unexpected symbol in print v Can you not use a list in this way, i.e. to store variables to range over in a for loop? Can anyone offer a solution? Thanks for any help! -- View this message in context: http://n4.nabble.com/using-a-list-to-index-elements-of-a-list-tp1679184p1679184.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] using a list to index elements of a list
if this was to work, wouldn't the object 'v' be identical to 'x'?... so, why not use 'x' itself? b On Tue, Mar 23, 2010 at 2:53 PM, Pj253 pj...@cam.ac.uk wrote: I have a list of vectors, x, with x[[1]]=1:5, say. And I need to go through each element of each vector in a for loop. Something like: for (v in x[[1]]) print(v) However, I need to store this index v for later, and I have lots of other indices which we range over later in the code so thought I'd make a list of these indices, v-list(). But then when I try: for( v[[1]] in x[[1]] ) print(v[[1]]) I get errors: x-list() x[[1]]=1:5 v-list() for(v[[1]] in x[[1]]) Error: unexpected '[[' in for(v[[ print v[[1]] Error: unexpected symbol in print v Can you not use a list in this way, i.e. to store variables to range over in a for loop? Can anyone offer a solution? Thanks for any help! -- View this message in context: http://n4.nabble.com/using-a-list-to-index-elements-of-a-list-tp1679184p1679184.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] using a list to index elements of a list
Thanks for your reply Ben! I don't think I want v to be identical to x... I guess I haven't put the question in the right context. What I'm actually trying to do is... (* indicates extra information, not necessarily relevant for my question, but to help put it in context) A, some matrix (*a traceless, symmetric matrix of 0's, 1's (representing a graph)*) x-list() x[[1]]-1:nrow(A) for (i in x[[1]]){ if (A[1,i]==1) { x[[2]]-x[[1]][!(x[[1]]==1)] for (j in x[[2]]){ if (A[i,j]==1){ path-c(1,i,j) print(path) } } } } So, here I have used i and j to range over the elements of x[[1]], x[[2]] respectively. (*This prints all the paths of length 2 starting at vertex 1. But I'm trying to generalise this for a path of length nrow(A), i.e. a Hamiltonian path)*) I want to iterate this process a certain number of times, so instead of i,j I thought to use a list of scalars, v. I don't want v to be identical to x... I want v to be a list of scalars which range (inside a for loop) over an elements of the list x. (so instead of for (i in x[[k]]) I have for (v[[k]] in x[[k]])). I can see how they look similar, but I do think they're different objects. Hope this is clear. If you still think using 'x' itself would work, can you explain how so? -- View this message in context: http://n4.nabble.com/using-a-list-to-index-elements-of-a-list-tp1679184p1679253.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] using a list to index elements of a list
can you also post an example of A and an example of the expected result? On Tue, Mar 23, 2010 at 3:36 PM, Pj253 pj...@cam.ac.uk wrote: Thanks for your reply Ben! I don't think I want v to be identical to x... I guess I haven't put the question in the right context. What I'm actually trying to do is... (* indicates extra information, not necessarily relevant for my question, but to help put it in context) A, some matrix (*a traceless, symmetric matrix of 0's, 1's (representing a graph)*) x-list() x[[1]]-1:nrow(A) for (i in x[[1]]){ if (A[1,i]==1) { x[[2]]-x[[1]][!(x[[1]]==1)] for (j in x[[2]]){ if (A[i,j]==1){ path-c(1,i,j) print(path) } } } } So, here I have used i and j to range over the elements of x[[1]], x[[2]] respectively. (*This prints all the paths of length 2 starting at vertex 1. But I'm trying to generalise this for a path of length nrow(A), i.e. a Hamiltonian path)*) I want to iterate this process a certain number of times, so instead of i,j I thought to use a list of scalars, v. I don't want v to be identical to x... I want v to be a list of scalars which range (inside a for loop) over an elements of the list x. (so instead of for (i in x[[k]]) I have for (v[[k]] in x[[k]])). I can see how they look similar, but I do think they're different objects. Hope this is clear. If you still think using 'x' itself would work, can you explain how so? -- View this message in context: http://n4.nabble.com/using-a-list-to-index-elements-of-a-list-tp1679184p1679253.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] If else statements
Thanks Sam for the short but very helpful answer. That's what I only want to know. Thanks.=) ~tj -- View this message in context: http://n4.nabble.com/If-else-statements-tp1678705p1679187.html Sent from the R help mailing list archive at Nabble.com. [[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] using a list to index elements of a list
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Pj253 Sent: Tuesday, March 23, 2010 7:54 AM To: r-help@r-project.org Subject: [R] using a list to index elements of a list I have a list of vectors, x, with x[[1]]=1:5, say. And I need to go through each element of each vector in a for loop. Something like: for (v in x[[1]]) print(v) However, I need to store this index v for later, and I have lots of other indices which we range over later in the code so thought I'd make a list of these indices, v-list(). But then when I try: for( v[[1]] in x[[1]] ) print(v[[1]]) I get errors: x-list() x[[1]]=1:5 v-list() for(v[[1]] in x[[1]]) Error: unexpected '[[' in for(v[[ The syntax of the for statement is for(name in values) expr where name must be a name object, not a call like v[[i]] or anything else. Will your code work as you wish if you replace the for(v[[1]] in x[[1]]) { ... } with the following? for(i in x[[1]]) { v[[2]] - i ... } Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com print v[[1]] Error: unexpected symbol in print v Can you not use a list in this way, i.e. to store variables to range over in a for loop? Can anyone offer a solution? Thanks for any help! -- View this message in context: http://n4.nabble.com/using-a-list-to-index-elements-of-a-list- tp1679184p1679184.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] Converting date format
try this: x - c('1/1/1970','12/13/2010', '2/3/2001') gsub((\\d+/\\d+/)\\d\\d(\\d\\d file://d+///d+/)//d//d(//d//d), \\1\\2file://0.0.0.1//2, x) [1] 1/1/70 12/13/10 2/3/01 On Tue, Mar 23, 2010 at 10:10 AM, Hosack, Michael mhos...@state.pa.uswrote: R community: Hello, I would to like to convert a character date variable from %m/%d/%Y to %m/%d/%y. Any advice would be greatly appreciated. I have tried functions for changing the formatting and removing the unnecessary digits without success. Mike __ 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.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[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] barplot (stacked)
Dear all, I want to draw a barplot with the following data: [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 110.0675 118.4167 117.16 109.735416 101.6312 104.0312 101.8263 99.38541670 114.2613 [2,] 0. 0. 0.00 1.658333 0. 0.6250 0. 0.05208333 0. [,10][,11][,12][,13][,14] [,15][,16][,17] [,18] [1,] 46.597917 108.5312 99.85833 104.3137 99.07917 95.5975 92.07292 108.6338 104.82917 [2,] 2.458333 0. 2.62500 0. 0.18750 0. 0.0 0. 0.40625 [,19] [,20] [1,] 48.90625 47.5 [2,] 0.0 0.0 The problem is: I want to group the data. I want to have ten groups. The first two bars should be [1,1] and [2,1] together in one bar and in the second bar of the first obervation should be [1,2] and [2,2] (stacked with beside =TRUE). Therefore the first observation is [1,1],[1,2],[2,1] and [2,2]. For a better understanding: I want to split the darkblue bar into a green and a blue bar (please see picture) per observation. Has anyone a suggestion how I can do this? Thank you very much in advane. http://n4.nabble.com/file/n1679227/Pic.jpg -- View this message in context: http://n4.nabble.com/barplot-stacked-tp1679227p1679227.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] caret package, how can I deal with RFE+SVM wrong message?
Kevin! I've sent 5 replies to your questions already off-list. The first question is easy (see below). The others will need more information on your data (via str(trx) abd str(try)) and you versions (sessionInfo()) as previously asked off-list. Sorry to out you, but this is bad form. Max I am learning caret package, and I want to use the RFE to reduce the feature. I want to use RFE coupled Random Forest (RFE+FR) to complete this task. As we know, there are a number of pre-defined sets of functions, like random Forest(rfFuncs), however,I want to tune the parameters (mtr) when RFE, and then I write code below, but there is something wrong message, How can I deal with it? rfGrid-expand.grid(.mtry=c(1:2)) rfectrl-rfeControl(functions=caretFuncs,method=cv,verbose=F,returnResamp=final,number=10) subsets-c(3,4) set.seed(2) rf.RFE-rfe(trx,try,sizes=subsets,rfeControl=rfectrl,method=rf,tuneGrid=rfGrid) Loading required package: class Attaching package: 'class' The following object(s) are masked from package:reshape : condense Fitting: mtry=1 Fitting: mtry=2 Error in varImp.randomForest(object$finalModel, ...) : subscript out of bounds In addition: Warning message: package 'e1071' was built under R version 2.10.1 You didn't pass importance = TRUE to randomForest At the same time, If I want to use RFE+SVM, RFE+nnet, and so on ,how can I do? I have try RFE+SVM, also wrong message: set.seed(1) svmProfile-rfe(trx,try,sizes=c(1:3), + rfeControl=rfeControl(functions=caretFuncs,method=cv, + verbose=F,returnResamp=final,number=10), + method=svmRadial,tuneLength=5) Fitting: sigma=0.009246713, C=0.1 Fitting: sigma=0.009246713, C=1 Fitting: sigma=0.009246713, C=10 Fitting: sigma=0.009246713, C=100 Fitting: sigma=0.009246713, C=1000 Error in rfeControl$functions$rank(fitObject, .x, y) : need importance columns for each class -- Max __ 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] Sample size for proportion, not binomial
Hello, I am looking for a sample size function for samples sizes, to test proportions that are not binomial proportions. The proportions represent a ratio of (final measure) / (baseline measure) on the same experimental unit. Searches using RSeek and such bring multiple hits for binomial proportions, but that doesn't seem to fit my situation. Perhaps there's some standard terminology from a different field that would provide better hits than deeming this a 'rate' or a 'proportion'. Of course, most sample size functions assume a normal distribution, while this data will be bounded between 0 and 1. The scientist I'm working with feels it's important to make fair comparisons, any weight loss must account for the baseline weight. A logistic transformation seems appropriate, but that term also didn't yield hits I recognized as useful. Loss of weight --- compare treatments: Treatment A: 1 - Final weight / Initial weight Treatment B: 1 - Final weight / Initial weight This appears to be a situation that would be common, but I'm not framing it in a way that matches an R package. Any guidance is appreciated. Regards, Paul Paul Prew ⪠Statistician 651-795-5942 ⪠fax 651-204-7504 Ecolab Research Center ⪠Mail Stop ESC-F4412-A 655 Lone Oak Drive ⪠Eagan, MN 55121-1560 CONFIDENTIALITY NOTICE: This e-mail communication and any attachments may contain proprietary and privileged information for the use of the designated recipients named above. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. [[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] using a list to index elements of a list
Thanks Bill, that sorted it out! And thank you too Ben! Bill and Ben. Are you familiar with the flowerpot men by any chance!? Thanks again! -- View this message in context: http://n4.nabble.com/using-a-list-to-index-elements-of-a-list-tp1679184p1679293.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] using a list to index elements of a list
and in addition to bill's suggestion, you may want to consider not growing a list. Instead of 'v - list()', use: v - vector(list, nrow(A)) b Will your code work as you wish if you replace the for(v[[1]] in x[[1]]) { ... } with the following? for(i in x[[1]]) { v[[2]] - i ... } Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.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] filled.contour formatting questions
Hmm yes that is what I'm looking for in terms of color scale control, but I need it for contoured plots. John. On Mon, Mar 22, 2010 at 10:32 PM, Jim Lemon j...@bitwrit.com.au wrote: On 03/23/2010 12:48 PM, John K. Williams wrote: Hello, I'm having some trouble getting things to look as I want with filled.contour. 1. My first issue is that I am unable to add line segments to my plot where I want them. Using the rug pattern example: x- y- seq(-4*pi, 4*pi, len = 27); r- sqrt(outer(x^2, y^2, +)); filled.contour(cos(r^2)*exp(-r/(2*pi))); segments(0.2,0.2,1,0.2); The line segment is not found in relation to the x-axis but is seemingly squished over by the color bar. If I try to achieve the line this way: filled.contour(cos(r^2)*exp(-r/(2*pi)),plot.axes={lines(c(0.2,1),c(0.2,0.2))}) Now when I add the axis back it is misaligned. axis(1). 2. Secondly I'm finding the literature difficult to understand on how to make a nice color scheme. Below is a nice scheme I found from an example, except I don't understand why the scale seems to cycle into blue again for larger values, even though I think I am setting the number of levels of colors and contour levels to be equal. Basically I want reds for the highest values and blues for the lowest: filled.contour(cos(r^2)*exp(-r/(2*pi)),nlevels=25,col=hsv(h=seq(from=.7,to=0,length=25))) 3. I'm used to working with matlab where it was simple to make the color scale the same on multiple figures using caxis(). However I don't see this option for filled.contour (possibly it exists for levelplot() but I was having even less success understanding that one). I only see the option to set the number of levels which doesn't really accomplish what I want for plots that are going to have widely varying limits. Hi John, I'm not sure that this is what you want, but the examples for the barp function in the plotrix package include one for a color scale that extends beyond the values that are to be plotted. That is, you can specify the range of the color scale regardless of the actual values. Jim [[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] Changing global variables from functions
Thanks for the help, I've fixed the problem. -Josh Elliott -- View this message in context: http://n4.nabble.com/Changing-global-variables-from-functions-tp1595002p1679330.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] Optim() Help, Unusual Error
Hello all, any help with the following would be appreciated. I am attempting to maximize 28 parameters similtaneously in Optim(). The follwoing is my code: Y-comp[,9] n-length(Y) e.1-.5 e.2-.5 e.3-.5 e.4-.5 e.5-.5 e.6-.5 e.7-.5 e.8-.5 e.9-.5 e.10-.5 e.11-.5 e.12-.5 e.13-.5 e.14-.5 e.15-.5 e.16-.5 e.17-.5 e.18-.5 e.19-.5 e.20-.5 e.21-.5 e.21-.5 e.22-.5 e.23-.5 e.24-.5 e.25-.5 e.26-.5 e.27-.5 e.28-.5 par-(e.1,e.2,e.3,e.4,e.5,e.6,e.7,e.8,e.9,e.10,e.11,e.12,e.13,e.14,e.15,e.16,e.17,e.18,e.19,e.20,e.21,e.22,e.23,e.24,e.25,e.26,e.27,e.28) # Define the objective function: objective.function - function(par,comp,Y,n) { e.1-par[1] e.2-par[2] e.3-par[3] e.4-par[4] e.5-par[5] e.6-par[6] e.7-par[7] e.8-par[8] e.9-par[9] e.10-par[10] e.11-par[11] e.12-par[12] e.13-par[13] e.14-par[14] e.15-par[15] e.16-par[16] e.17-par[17] e.18-par[18] e.19-par[19] e.20-par[20] e.21-par[21] e.22-par[22] e.23-par[23] e.24-par[24] e.25-par[25] e.26-par[26] e.27-par[27] e.28-par[28] residuals.squared - c() for (i in 1:n) residuals.squared[i] - (Y[i] - ( ((e.26^comp[i,3])*(e.27^(comp[i,7]-mean(comp[,7])))*(e.28^comp[i,6])*(comp[i,65]^comp[i,5]))* (e.1*comp[i,10]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.21) + e.2*comp[i,11]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.21) + e.3*comp[i,12]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.21) + e.4*comp[i,13]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.22) + e.5*comp[i,14]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.22) + e.6*comp[i,15]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.22) + e.7*comp[i,16]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.23) + e.8*comp[i,17]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.24) + e.9*comp[i,18]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.24) + e.10*comp[i,19]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.24) + e.11*comp[i,20]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.24) + e.12*comp[i,21]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.25) + e.13*comp[i,22]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.25) + e.14*comp[i,23]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.25) + e.15*comp[i,24]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.25) + e.15*comp[i,25]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.25) + e.16*comp[i,26]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.25) + e.15*comp[i,27]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.25) + e.12*comp[i,28]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.25) + e.8*comp[i,29]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.24) + e.14*comp[i,30]*comp[i,34]+comp[i,35])+(e.17*(comp[i,36]+comp[i,37]+comp[i,38]))+(e.18*comp[i,41])+(e.19*comp[i,39])+(e.20*comp[i,42]))/(comp[i,31]+comp[i,32]+comp[i,33]))^e.25))^2) )
[R] R Participation in the Google Summer of Code 2010
Dear R Users, We would like to highlight that R has once again been selected to participate in the Google Summer of Code. Suggested projects can be found in the R-Wiki: http://rwiki.sciviews.org/doku.php?id=developers:projects:gsoc2010. The GSoC is a program from Google that offers student developers stipends to write code for various open source software projects (more information can be found here: http://code.google.com/soc/). All discussion related to R and the Google Summer of Code should preferably tak place on the respective google group: http://groups.google.com/group/gsoc-r (gso...@googlegroups.com). We are currently in a time period during which interested students can discuss an idea from the wiki with the respective project mentor, or contact the gsoc-r group to propose a new one and find a mentor. Please note that some projects on the R-Wiki also provide test questions, so please read these pages thoroughly before contacting a project mentor. The student application period opens on March 29th. Best regards, the R Project GSoC mentors ___ r-annou...@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-announce __ 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] qplot(ggplo2): axis label sizes/colors
Dear all, How can I change the size and the color of axis? I would like that the xlab to be larger, xvalues to be larger, and xvalues in black instead of grey. x=runif(10) y=runif(10) require(ggplo2) qplot(x,y) cheers milton [[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] qplot(ggplo2): axis label sizes/colors
http://had.co.nz/stat405/lectures/21-themes.pdf On Wed, Mar 24, 2010 at 1:22 AM, milton ruser milton.ru...@gmail.com wrote: Dear all, How can I change the size and the color of axis? I would like that the xlab to be larger, xvalues to be larger, and xvalues in black instead of grey. x=runif(10) y=runif(10) require(ggplo2) qplot(x,y) cheers milton [[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] Displaying equations from .Rd files
Hi All, I am reading through section 2.6 (Mathematics) of the Writing R Extensions manuscript and am wondering where I can find more examples/documentation on the \deqn{ } function. I would like to learn how to display equations using this function but am not sure how to go about doing it. The one example provided in section 2.6 doesn't give me much of a sense on how to do this. Thank you, AC [[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] Operator overloading for custom classes
Hi, I need some help to get some of the object orientation, specifically the methods that overload the basic arithmetic operations, from sample C++ code to R. I don't have experience with such advanced language features inside of R. So I was wondering if some of you could help me out in this regard. I have written a simple demonstration of a forward mode automatic differentiator in C++ and it is currently hosted on github: http://github.com/quantumelixir/ad-demo/blob/master/simple.cpp. It uses simple operator overloading techniques to modify the meaning of the basic arithmetic operations (+, -, *, /) for the derivative type Dual number class that I have defined. Could you show me how this could be equivalently done in R? I want to know how to define custom classes and define the meaning of arithmetic for them. I had checked for operator overloading in R but could only find the equivalence of a + b and '+'(a, b) in the R language definition. Could you show how I could extend the simple object oriented-ness in the C++ code neatly to R? Thanks a bunch! Chillu PS: Sorry that I had mistakenly sent the email to the r-devel list earlier, instead of the intended r-help list. This is a copy of the same email. [[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] information module Wilks' lambda criterion
On Tue, 23 Mar 2010, Catherine ENG wrote: Hi everybody, I was wondering if you can help me about a module. In fact, I'm looking for a package or module about Wilks' lambda criterion in R environment. I didn't find it in R website ( See ?summary.manova HTH, Chuck http://cran.cict.fr/web/packages/index.html#available-packages-W or http://search.cpan.org/faq.html). If this module exists, could you show me the command line. Thank you very much for your help, Miss Catherine ENG - Laboratoire de G?n?tique et Microbiologie UMR INRA 1128 - IFR 110 Universit? Henri Poincar? - Facult? des Sciences BP 239 54506 Vandoeuvre-l?s-Nancy T?l. : 06.58.25.37.66 [[alternative HTML version deleted]] Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:cbe...@tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 __ 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] Creating pdfs using qplot in qqplot2
I am trying to create plots within a for loop and output them to a pdf. Here is a working example using plot: gg - data.frame(datadate=1:4, spread=5:8) pdf() for (i in 1:3) { plot(gg$datadate, gg$spread, main=i) } dev.off() I am trying to learn more about ggplot2 so I try a slight modification and it doesn't work. Anyone know how to do this using qplot in ggplot2? gg - data.frame(datadate=1:4, spread=5:8) pdf() for (i in 1:3) { qplot(gg$datadate, gg$spread, geom=line, main=i) } dev.off() *** This message is for the named person's use only. It may\...{{dropped:20}} __ 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] Creating pdfs using qplot in qqplot2
you have to print the object gg - data.frame(datadate=1:4, spread=5:8) pdf() for (i in 1:3) { + d - qplot(gg$datadate, gg$spread, geom=line, main=i) + print(d)} dev.off() On Tue, Mar 23, 2010 at 1:14 PM, Bos, Roger roger@rothschild.com wrote: I am trying to create plots within a for loop and output them to a pdf. Here is a working example using plot: gg - data.frame(datadate=1:4, spread=5:8) pdf() for (i in 1:3) { plot(gg$datadate, gg$spread, main=i) } dev.off() I am trying to learn more about ggplot2 so I try a slight modification and it doesn't work. Anyone know how to do this using qplot in ggplot2? gg - data.frame(datadate=1:4, spread=5:8) pdf() for (i in 1:3) { qplot(gg$datadate, gg$spread, geom=line, main=i) } dev.off() *** This message is for the named person's use only. It may\...{{dropped:20}} __ 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. -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis __ 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] Conditional replacement of NA depending on value in the previous column
Dear R-helpers, I have a dataframe like this: ID X1 X2 X3 X4 X5 X6 49 1 1 1 0 NA NA 50 1 1 1 1 NA 1 I would like to convert a missing value (NA) that follows a 0 (zero) or another missing value (NA) into a 0 (zero). So, the above lines would be converted to: ID X1 X2 X3 X4 X5 X6 49 1 1 1 0 0 0 50 1 1 1 1 NA 1 I have been struggling with this all morning, so any help you could provide would be much appreciated. Thank you! Mark Na [[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] Conditional replacement of NA depending on value in the previous column
Mark - Does this do what you want? dat = data.frame(X1=c(1,1),X2=c(1,1),X3=c(1,1), X4=c(0,1),X5=c(NA,NA),x6=c(NA,1)) fixit = function(x){ y = c(x[-1],0) x[is.na(y) is.na(x)] = 0 x} t(apply(dat,1,fixit)) X1 X2 X3 X4 X5 x6 [1,] 1 1 1 0 0 0 [2,] 1 1 1 1 NA 1 - Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.berkeley.edu On Tue, 23 Mar 2010, Mark Na wrote: Dear R-helpers, I have a dataframe like this: ID X1 X2 X3 X4 X5 X6 49 1 1 1 0 NA NA 50 1 1 1 1 NA 1 I would like to convert a missing value (NA) that follows a 0 (zero) or another missing value (NA) into a 0 (zero). So, the above lines would be converted to: ID X1 X2 X3 X4 X5 X6 49 1 1 1 0 0 0 50 1 1 1 1 NA 1 I have been struggling with this all morning, so any help you could provide would be much appreciated. Thank you! Mark Na [[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.
Re: [R] Creating pdfs using qplot in qqplot2
Bos, Roger-2 wrote: I am trying to create plots within a for loop and output them to a pdf. Here is a working example using plot: gg - data.frame(datadate=1:4, spread=5:8) pdf() for (i in 1:3) { plot(gg$datadate, gg$spread, main=i) } dev.off() I am trying to learn more about ggplot2 so I try a slight modification and it doesn't work. Anyone know how to do this using qplot in ggplot2? gg - data.frame(datadate=1:4, spread=5:8) pdf() for (i in 1:3) { qplot(gg$datadate, gg$spread, geom=line, main=i) } dev.off() This question gets asked many, many times and is answered in FAQ 7.22: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f Basically, old-school functions like plot() execute plotting commands directly when they are called. With Lattice-based graphics, like ggplot2, the composition of the plot and the execution of the plotting commands are separated into two steps. qplot() returns an object that contains the composition of the plot, the print() method performs the actual execution of plotting commands to a graphics device. When functions are called interactively in the top-level environment, an implicit call to print() is executed to display the results. When these same functions are used inside another function or for() loop, you will need to explicitly add the call to print() in order to get the same effect. Hope this helps! -Charlie - Charlie Sharpsteen Undergraduate-- Environmental Resources Engineering Humboldt State University -- View this message in context: http://n4.nabble.com/Creating-pdfs-using-qplot-in-qqplot2-tp1679488p1679523.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] If else statements
tj wrote: Thanks Sam for the short but very helpful answer. That's what I only want to know. Thanks.=) ~tj Even though you got the answer you were looking for, I would still browse the material Matthew posted. The Introduction to R is a standard R manual that helped me greatly when I was learning the R language. The question you asked is answered in this manual and Eric Raymond's essay explains why asking questions that are answered in the manual can be socially risky on software mailing lists. You don't want the last reply you ever get from a list to be RTFM! -Charlie - Charlie Sharpsteen Undergraduate-- Environmental Resources Engineering Humboldt State University -- View this message in context: http://n4.nabble.com/If-else-statements-tp1678705p1679530.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] rpad ?
Is anyone using rpad? Is there any documentation or examples beyond that in the 'man' directory of the source? -- View this message in context: http://n4.nabble.com/rpad-tp1679534p1679534.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] Operator overloading for custom classes
Chidambaram Annamalai wrote: Hi, I need some help to get some of the object orientation, specifically the methods that overload the basic arithmetic operations, from sample C++ code to R. I don't have experience with such advanced language features inside of R. So I was wondering if some of you could help me out in this regard. {snip} For S3 objects: ?base::Ops http://n4.nabble.com/Operator-overloading-td854452.html#a854452 http://n4.nabble.com/Overloading-td850827.html#a850828 For S4 objects: ?methods::Ops http://n4.nabble.com/How-to-define-new-operators-td974842.html#a974842 A good resource for reading material on S4 classes, which are more formally defined than S3 classes, can be found in the R wiki: http://rwiki.sciviews.org/doku.php?id=tips:classes-s4 Hope this can get you started! -Charlie - Charlie Sharpsteen Undergraduate-- Environmental Resources Engineering Humboldt State University -- View this message in context: http://n4.nabble.com/Operator-overloading-for-custom-classes-tp1679467p1679573.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] Optim() Help, Unusual Error
missed a c(...) here, therefore no par defined. On Mar 23, 2010, at 12:58 PM, ApproxGaussian wrote: par-(e.1,e.2,e.3,e.4,e.5,e.6,e.7,e.8,e.9,e.10,e.11,e.12,e.13,e.14,e. 15,e.16,e.17,e.18,e.19,e.20,e.21,e.22,e.23,e.24,e.25,e.26,e.27,e.28) __ 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] Optim() Help, Unusual Error
I apologize, the c is in the original coding; I merely misprinted (copy and paste). I have edited the orginal post to reflect this. -- View this message in context: http://n4.nabble.com/Optim-Help-Unusual-Error-tp1679363p1679582.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] rpad ?
Based on a private response, it seems that rpad is no longer being maintained and in fact no longer works with the latest R release. I noticed that the web site listed in the FAQ no longer works, the code is being hosted by google code but it appears no one is working on it. Looking at the R Web Interfaces section of the R FAQ I don't really see anything comparable -- does anyone have a suggestion for a similar web-based front-end to R? From the FAQ: Rpad, developed and actively maintained by Tom Short, provides a sophisticated environment which combines some of the features of the previous approaches with quite a bit of JavaScript, allowing for a GUI-like behavior (with sortable tables, clickable graphics, editable output), etc. -- View this message in context: http://n4.nabble.com/rpad-tp1679534p1679590.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] no predict function in lme4 ?
It is not easy to decide what predict should return for a linear mixed model, let alone the more complicated cases. Do you want predictions based on the fixed-effects only or based on a combination of the fixed-effects and the random-effects? For the lme function in the nlme package we allowed levels of predictions but that won't work for all models that can be fit with lme4. On Tue, Mar 23, 2010 at 9:18 AM, Markus Loecher markus.loec...@gmail.com wrote: Dear mixed effects modelers, I seem unable to find a predict method for mer objects in the package lme4. Am I not seeing the forest for the trees ? Any pointer would be very helpful. Thanks, Markus [[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.
Re: [R] help needed with boxplot
Thank you so much for help, Jim. But I didn't get any plot after I submit the job except below, which indicating the number of lines for the two inputs. What's the problem? Read 3360 records Read 3360 records I know I didn't confuse you. -- View this message in context: http://n4.nabble.com/help-needed-with-boxplot-tp1677678p1679546.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] rpad ?
sjaffe wrote: Based on a private response, it seems that rpad is no longer being maintained and in fact no longer works with the latest R release. I noticed that the web site listed in the FAQ no longer works, the code is being hosted by google code but it appears no one is working on it. Looking at the R Web Interfaces section of the R FAQ I don't really see anything comparable -- does anyone have a suggestion for a similar web-based front-end to R? You could try Sage: http://www.sagemath.org You can get a notebook account at: http://www.sagenb.org Sage uses python to integrate several open-source and closed-source mathmatics/computation packages and R is among one of the options available. It provides a nice Mathematica-like notebook interface where you can mix computations and annotations. If you don't want to type Sage code, just choose 'r' from the drop-down menu at the top of the worksheet next to the Typeset checkbox and the contents of every cell you enter will be passed directly to R for evaluation. Hope this helps! -Charlie - Charlie Sharpsteen Undergraduate-- Environmental Resources Engineering Humboldt State University -- View this message in context: http://n4.nabble.com/rpad-tp1679534p1679599.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] rpad ?
Sharpie wrote: You could try Sage: http://www.sagemath.org Yes, I've tried Sage (briefly) and it is very interesting. But what I'm looking for here is a client-server system that allows multiple users to access the results of R without exposing the details. -- View this message in context: http://n4.nabble.com/rpad-tp1679534p1679607.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] rpad ?
sjaffe wrote: Yes, I've tried Sage (briefly) and it is very interesting. But what I'm looking for here is a client-server system that allows multiple users to access the results of R without exposing the details. Maybe you're looking for something similar to this webapp: http://rweb.stat.ucla.edu/ggplot2/ The author's website is at: http://www.stat.ucla.edu/~jeroen/live.html I believe he used RApache to drive the site, but I'm not positive. The widgets are done in ExtJS. -Charlie - Charlie Sharpsteen Undergraduate-- Environmental Resources Engineering Humboldt State University -- View this message in context: http://n4.nabble.com/rpad-tp1679534p1679624.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] Operator overloading for custom classes
Thanks! On Wed, Mar 24, 2010 at 1:01 AM, Sharpie ch...@sharpsteen.net wrote: Chidambaram Annamalai wrote: Hi, I need some help to get some of the object orientation, specifically the methods that overload the basic arithmetic operations, from sample C++ code to R. I don't have experience with such advanced language features inside of R. So I was wondering if some of you could help me out in this regard. {snip} For S3 objects: ?base::Ops http://n4.nabble.com/Operator-overloading-td854452.html#a854452 http://n4.nabble.com/Overloading-td850827.html#a850828 For S4 objects: ?methods::Ops http://n4.nabble.com/How-to-define-new-operators-td974842.html#a974842 A good resource for reading material on S4 classes, which are more formally defined than S3 classes, can be found in the R wiki: http://rwiki.sciviews.org/doku.php?id=tips:classes-s4 Hope this can get you started! -Charlie - Charlie Sharpsteen Undergraduate-- Environmental Resources Engineering Humboldt State University -- View this message in context: http://n4.nabble.com/Operator-overloading-for-custom-classes-tp1679467p1679573.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] rpad ?
We are using RPad for a teaching application here. But we had to find many things the hard way, and additionally, it did not survive the latest R release change. There is a minimal repair, but the maintainer does not answer any email any more. We did the repair and are giving a modified version to our students, but we do not have enough resource to take over maintenance. On 3/23/2010 8:00 PM, sjaffe wrote: Is anyone using rpad? Is there any documentation or examples beyond that in the 'man' directory of the source? -- Erich Neuwirth, University of Vienna Faculty of Computer Science Computer Supported Didactics Working Group Visit our SunSITE at http://sunsite.univie.ac.at Phone: +43-1-4277-39464 Fax: +43-1-4277-39459 __ 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] Saving tab/csv delimited data with NaN's
Hello, I am working multiple simulated data sets with missing values, I would like to store these data sets in either tab delimited format for .csv format with missing values marked as NaN's instead of NA's. I read the import/export document which mentions that write.table command converts NaN's to NA. Is there any other way I can store the NaN's. I tried the write syntax it gives me error codes. Each data files are of dimensions 1000 x 21 . I would appreciate any help in this regard. Many thanks __ 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] Saving tab/csv delimited data with NaN's
On 24/03/2010, at 9:50 AM, shan...@bios.unc.edu wrote: Hello, I am working multiple simulated data sets with missing values, I would like to store these data sets in either tab delimited format for .csv format with missing values marked as NaN's instead of NA's. I read the import/export document which mentions that write.table command converts NaN's to NA. Is there any other way I can store the NaN's. I tried the write syntax it gives me error codes. Each data files are of dimensions 1000 x 21 . I would appreciate any help in this regard. A feasible workaround is to convert your data to character before writing them. Suppose that your data are in a data frame called ``clyde''. Set mung - as.data.frame(lapply(clyde,as.character)) write.csv(mung,mung.csv,row.names=FALSE,quote=FALSE) # Check: gorp - read.csv(mung.csv) all.equal(gorp,clyde) [1] TRUE HTH cheers, Rolf Turner ## Attention: This e-mail message is privileged and confidential. If you are not the intended recipient please delete the message and notify the sender. Any views or opinions presented are solely those of the author. This e-mail has been scanned and cleared by MailMarshal www.marshalsoftware.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] Adding matrix rows that have the same name?
Does anyone know if there is an R function that will take a matrix like this jim 1 0 0 0 0 0 jim 0 1 0 0 0 0 jim 0 0 1 0 0 0 bob1 0 0 0 0 0 bob0 0 1 0 0 0 harry 0 0 1 0 0 0 harry 0 0 0 1 0 0 harry 0 0 0 0 1 0 harry 0 0 0 0 0 1 and make it like this? (that is, add together rows that have the same name?) jim1 1 1 0 0 0 bob 1 0 1 0 0 0 harry 0 0 1 1 1 1 here's the code I started with, if it helps library (dummies) a - c(1,1,1,2,2,3,3,3,3) b- c(A,B,C,A,C,C,D,E,F) name- c(jim, jim, jim, bob, bob, harry, harry, harry, harry) MyMat - cbind (a, b) rownames (MyMat) - name dum.mat.temp - dummy (b, MyMat) #dum.mat.temp -cbind (name, dum.mat.temp) # if you want names as a column dum.mat.temp Many thanks in advance! --Sarah __ 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] rpad ?
Hello, You could try svSocket that creates a socket server where several clients can connect simultaneously. The server is restricted to local clients for obvious security reasons, but if you would like to access it though a network, you can use stunnel to transfer the data crypted with SSL. Best, Philippe Grosjean ..°})) ) ) ) ) ) ( ( ( ( (Prof. Philippe Grosjean ) ) ) ) ) ( ( ( ( (Numerical Ecology of Aquatic Systems ) ) ) ) ) Mons University, Belgium ( ( ( ( ( .. On 23/03/10 20:57, sjaffe wrote: Sharpie wrote: You could try Sage: http://www.sagemath.org Yes, I've tried Sage (briefly) and it is very interesting. But what I'm looking for here is a client-server system that allows multiple users to access the results of R without exposing the details. __ 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] Adding matrix rows that have the same name?
Try this: aggregate(as.data.frame(dum.mat.temp), list(row.names(dum.mat.temp)), sum) On Tue, Mar 23, 2010 at 6:15 PM, Sarah Berke skbe...@gmail.com wrote: Does anyone know if there is an R function that will take a matrix like this jim 1 0 0 0 0 0 jim 0 1 0 0 0 0 jim 0 0 1 0 0 0 bob 1 0 0 0 0 0 bob 0 0 1 0 0 0 harry 0 0 1 0 0 0 harry 0 0 0 1 0 0 harry 0 0 0 0 1 0 harry 0 0 0 0 0 1 and make it like this? (that is, add together rows that have the same name?) jim 1 1 1 0 0 0 bob 1 0 1 0 0 0 harry 0 0 1 1 1 1 here's the code I started with, if it helps library (dummies) a - c(1,1,1,2,2,3,3,3,3) b- c(A,B,C,A,C,C,D,E,F) name- c(jim, jim, jim, bob, bob, harry, harry, harry, harry) MyMat - cbind (a, b) rownames (MyMat) - name dum.mat.temp - dummy (b, MyMat) #dum.mat.temp -cbind (name, dum.mat.temp) # if you want names as a column dum.mat.temp Many thanks in advance! --Sarah __ 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. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ 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] Setting breaks to data more appropriately
David Thanks you for the guidance. I am looking to drive the data into the intervals. Problem now is that I have a few 0 values that are returning as NA (e.g - (0.1,0.2] (0.1,0.2] (0.1,0.2] NA (0,0.1] ) This is causing issues when I try and use the brks to inform a clorepleth map. I tried setting all na's to 0 but because the dataset is in factor form (I guess this is why) it wont allow me to do so. Thoughts about how to handle the zero values? Thanks JR -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Monday, March 22, 2010 12:46 PM To: ROLL Josh F Cc: r-help@r-project.org Subject: Re: [R] Setting breaks to data more appropriately On Mar 22, 2010, at 1:49 PM, LCOG1 wrote: Basic question. For the below data, i would like to but each of the values in a bin that represents their value. So the below would hopefully put .1 in the 0-.1 bin, .2 in the .11-.2 bin and so forth. The outlying values would then be put into and outer category representing everything 1. Im using the breaks to inform some code for making a clorepleth map that represents probabilities, which in some cases IS greater than 1 ... not if it's a quantile or a probability. and i need to identify those better. Define better. As my code stands now, my real data is put put into this form when brks is called: 0%10%20%30%40% 50%60% 0. 0.05054675 0.07787235 0.11235238 0.14424786 0.18089360 0.21475990 70%80%90% 100% 0.26309899 0.30807771 0.39478573 0.67573483. But what i want is for the values to be placed in bins corresponding to their value(0-.1, .11-.2, .21-.3 etc) Pct.SFD-c(.1,.2,.3,.4,.5,.6,.7,.8,.9,1,2,3) brks - quantile(Pct.SFD, ) I think this is clear. It's not. You need to decide whether you want the breaking to be driven by you or by the data. If you are doing the driving then use cut(object, breaks=c(seq(0,1, by=0.1), Inf) , right=TRUE) If the data is doing the driving then: cut(object, breaks=quantile(object, probs= seq(0,1,1/10 ) ) , right=TRUE) -- David. Thanks -- View this message in context: http://n4.nabble.com/Setting-breaks-to-data-more-appropriately-tp16780 19p1678019.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] rpad ?
sjaffe sjaffe at riskspan.com writes: Sharpie wrote: You could try Sage: http://www.sagemath.org Yes, I've tried Sage (briefly) and it is very interesting. But what I'm looking for here is a client-server system that allows multiple users to access the results of R without exposing the details. You might find gWidgetsWWW able to do what you want. Some demos are here: www.math.csi.cuny.edu/gWidgetsWWW --John __ 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] Sample size for proportion, not binomial
On Mar 23, 2010, at 11:05 AM, Prew, Paul wrote: Hello, I am looking for a sample size function for samples sizes, to test proportions that are not binomial proportions. The proportions represent a ratio of (final measure) / (baseline measure) on the same experimental unit. Searches using RSeek and such bring multiple hits for binomial proportions, but that doesn't seem to fit my situation. Perhaps there's some standard terminology from a different field that would provide better hits than deeming this a 'rate' or a 'proportion'. Of course, most sample size functions assume a normal distribution, while this data will be bounded between 0 and 1. The scientist I'm working with feels it's important to make fair comparisons, any weight loss must account for the baseline weight. A logistic transformation seems appropriate, but that term also didn't yield hits I recognized as useful. Loss of weight --- compare treatments: Treatment A: 1 - Final weight / Initial weight Treatment B: 1 - Final weight / Initial weight This appears to be a situation that would be common, but I'm not framing it in a way that matches an R package. Any guidance is appreciated. Regards, Paul If you and the scientist are in a position of being open to better options of analyzing change from baseline data, I would recommend that you both read the following two papers: Statistics notes: analysing controlled trials with baseline and follow up measurements. Vickers AJ, Altman DG. BMJ 2001;323:1123–4. http://www.bmj.com/cgi/content/full/323/7321/1123 http://www.ncbi.nlm.nih.gov/pmc/articles/PMC1121605/pdf/1123.pdf The use of percentage change from baseline as an outcome in a controlled trial is statistically inefficient: a simulation study. Vickers AJ. BMC Med Res Methodol 2001;1:6. http://www.biomedcentral.com/1471-2288/1/6 http://www.biomedcentral.com/content/pdf/1471-2288-1-6.pdf and review an additional web site: http://biostat.mc.vanderbilt.edu/wiki/Main/MeasureChange Once you are hopefully in a position of adopting a regression based approach (eg. FinalWeight ~ BaseWeight + Treatment), there are various options for calculating sample sizes. The key advantage of this approach is that you get the baseline adjusted between-group comparison (the regression beta coefficient and confidence intervals for Treatment) which is the key outcome of interest in comparing treatments in a parallel design. The easiest, albeit conservative approach for sample size, is to use power.t.test() on your assumptions of the inter-group delta for actual weight change (not percent change), the std dev for actual change, desired power and target alpha. I am not aware off-hand of any power/sample size functions in R for regular linear regression, though they may exist. There are third party programs that do provide that functionality. If you are willing to code and experiment a bit, you could construct a monte carlo simulation with a linear model, using data generated with rnorm() based upon reasonable assumptions about the distribution of your data in each group for the baseline and final values. Once you get your actual data collected and ready for analysis, you will also need to test for a baseline*treatment interaction (FinalWeight ~ BaseWeight * Treatment), which can make the interpretation of treatment effects more complicated, since the treatment effect will be conditional upon the baseline weight, rather than being able to report a mean treatment effect. 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] Optim() Help, Unusual Error
I cannot replicate the error. The following seem to work. Y - runif(100) comp - matrix(runif(6500),100,65) par - rep(.5, 28) optim.results - optim(par, fn=objective.function, method=Nelder- Mead,comp=comp, Y=Y, n=100) # Not sure why you are selecting the columns in the comp. That is probably the error Nikhil On Mar 23, 2010, at 3:38 PM, ApproxGaussian wrote: I apologize, the c is in the original coding; I merely misprinted (copy and paste). I have edited the orginal post to reflect this. -- View this message in context: http://n4.nabble.com/Optim-Help-Unusual-Error-tp1679363p1679582.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] Setting breaks to data more appropriately
On Mar 23, 2010, at 5:23 PM, ROLL Josh F wrote: David Thanks you for the guidance. I am looking to drive the data into the intervals. Problem now is that I have a few 0 values that are returning as NA (e.g - (0.1,0.2] (0.1,0.2] (0.1,0.2] NA (0,0.1] ) This is causing issues when I try and use the brks to inform a clorepleth map. I tried setting all na's to 0 but because the dataset is in factor form (I guess this is why) it wont allow me to do so. Thoughts about how to handle the zero values? Thanks JR ?cut By default include.lowest is set to FALSE. Setting it to TRUE should cure your missing zeroes problem. (My own feeling is that was a very poor choice of defaults but I guess it is cast in stone now.) You don't say how you tried setting NA's to zero (and doing so is not a good idea if there are real zeroes in the data), but the is.na and is.na- functions are often needed for that purpose. -- David. -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Monday, March 22, 2010 12:46 PM To: ROLL Josh F Cc: r-help@r-project.org Subject: Re: [R] Setting breaks to data more appropriately On Mar 22, 2010, at 1:49 PM, LCOG1 wrote: Basic question. For the below data, i would like to but each of the values in a bin that represents their value. So the below would hopefully put .1 in the 0-.1 bin, .2 in the .11-.2 bin and so forth. The outlying values would then be put into and outer category representing everything 1. Im using the breaks to inform some code for making a clorepleth map that represents probabilities, which in some cases IS greater than 1 ... not if it's a quantile or a probability. and i need to identify those better. Define better. As my code stands now, my real data is put put into this form when brks is called: 0%10%20%30%40% 50%60% 0. 0.05054675 0.07787235 0.11235238 0.14424786 0.18089360 0.21475990 70%80%90% 100% 0.26309899 0.30807771 0.39478573 0.67573483. But what i want is for the values to be placed in bins corresponding to their value(0-.1, .11-.2, .21-.3 etc) Pct.SFD-c(.1,.2,.3,.4,.5,.6,.7,.8,.9,1,2,3) brks - quantile(Pct.SFD, ) I think this is clear. It's not. You need to decide whether you want the breaking to be driven by you or by the data. If you are doing the driving then use cut(object, breaks=c(seq(0,1, by=0.1), Inf) , right=TRUE) If the data is doing the driving then: cut(object, breaks=quantile(object, probs= seq(0,1,1/10 ) ) , right=TRUE) -- David. Thanks -- View this message in context: http://n4.nabble.com/Setting-breaks-to-data-more-appropriately- tp16780 19p1678019.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. David Winsemius, MD 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.
[R] Bold greek letters using plotmath
I'm trying to annotate some graphics using plotmath and finding out that the code I'm using isn't bolding the greek letters - it bolds the rest (once I adjusted the numerics to characters), it's just failing on the greek characters. Any suggestions welcomed. Jim Price. Cardiome Pharma Corp. Test code: plot(1:5, type = 'n') # The not bold version text(2, 2:4, cex = 2, labels = do.call(expression, unlist(list('Placebo', lapply(c(3, 6), function(.x) substitute(.x ~~ mu * g / kg / hr, list(.x = .x, recur = F))) # The bold version - note that the greek letter doesn't change text(4, 2:4, cex = 2, labels = do.call(expression, unlist(list(substitute(bold(Placebo)), lapply(as.character(c(3, 6)), function(.x) substitute(bold(.x ~~ mu * g / kg / hr), list(.x = .x, recur = F))) sessionInfo() R version 2.10.0 (2009-10-26) i386-pc-mingw32 locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] graphics grDevices utils datasets methods stats base other attached packages: [1] foreign_0.8-38 latticeExtra_0.6-1 RColorBrewer_1.0-2 lattice_0.17-26 loaded via a namespace (and not attached): [1] grid_2.10.0 tools_2.10.0 -- View this message in context: http://n4.nabble.com/Bold-greek-letters-using-plotmath-tp1679759p1679759.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] Diffusion entropy analysis
Hello, Does anyone know of an R implementation of diffusion entropy analysis (DEA) as proposed by Scafetta dn Grigolini (2002)? I was unable to find any existing functions, so I attempted to write up my own, but cannot reproduce known results, so obviously I'm doing something wrong. If there does not appear to be any existing script, I'll send along my attempts for your critique. I'd also be happy for any leads on scripts written in languages other than R. Thanks very much in advance-- Andy Rominger Scafetta N, and Grigolini P (2002) Scaling detection in time series: Diffusion entropy analysis. Phys. Rev. E 66:1:10. [[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] Saving tab/csv delimited data with NaN's
shankar-17 wrote: Hello, I am working multiple simulated data sets with missing values, I would like to store these data sets in either tab delimited format for .csv format with missing values marked as NaN's instead of NA's. I read the import/export document which mentions that write.table command converts NaN's to NA. Is there any other way I can store the NaN's. I tried the write syntax it gives me error codes. Each data files are of dimensions 1000 x 21 . I would appreciate any help in this regard. Many thanks foo - matrix(0,nrow=3,ncol=3) foo [,1] [,2] [,3] [1,]000 [2,]000 [3,]000 foo[3,3] - NA foo [,1] [,2] [,3] [1,]000 [2,]000 [3,]00 NA write.csv( foo, file='tst.csv', na = NaN, row.names = F ) readLines( 'tst.csv' ) [1] \V1\,\V2\,\V3\ 0,0,00,0,0 [4] 0,0,NaN Seems to work fine for me. If you post a reproducible example, we could probably figure out why it is not working for you. -Charlie - Charlie Sharpsteen Undergraduate-- Environmental Resources Engineering Humboldt State University -- View this message in context: http://n4.nabble.com/Saving-tab-csv-delimited-data-with-NaN-s-tp1679673p1679844.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] Plot ``freezes''.
In an elderly version of ``plotSymbols'' (now in the cwhmisc package) that I had lying around, there was the example plot(1:10,xlab=\374) which the comments said would give a u-umlaut as the x-axis label. When I execute this plot (a) I get no x-axis label at all, and (b) the plot ``freezes'' in that further plotting commands (e.g. plot(runif(42))) produce no results. The plot window (X11) remains as it was after the ``plot(1:10,xlab=\374)'' command. No error message is given, but no new plot is produced. If I do dev.off(), then normal plotting recommences. Can anyone explain to me what is going on here? My session info is given below. I run R from the command line, from a terminal window. cheers, Rolf Turner sessionInfo() R version 2.10.1 (2009-12-14) i386-apple-darwin8.11.1 locale: [1] en_NZ.UTF-8/en_NZ.UTF-8/C/C/en_NZ.UTF-8/en_NZ.UTF-8 attached base packages: [1] datasets utils stats graphics grDevices methods base other attached packages: [1] misc_0.0-12fortunes_1.3-7 MASS_7.3-4 ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ 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.