Re: [R] Searching the console

2011-09-08 Thread andrewH
Thanks, Josh! I'm using TINN-R now, but I have been thinking of switching to ESS. Though perhaps TINN-R has a similar function -- I had been looking for consol functions, rather than editor functions. andrewH -- View this message in context:

[R] Consistently printing the name of an object passed to a function; a data-auditing question

2011-09-08 Thread andrewH
Dear folks-- I always seem to find that I spend more than half my time making sure my input date is in the right form, properly aligned, with no bizarre features. You know the drill: five kinds of missing values, three of them documented. An alpha mistype in one numeric field turns 30,000 numbers

Re: [R] metaMDS and envfit: Help reading output

2011-09-08 Thread Briony
Hi Katie, This is probably a bit late given the date of your post, but I was having similar problems with my own work and thought I'd respond anyway. I'm not sure that the script you've written here will fit 3D vectors for your 3D nmds. I tried it and it doesn't seem to work for me - it only

Re: [R] function censReg in panel data setting

2011-09-08 Thread Igors
Does censReg expect from panel data to be balanced? Because in my case it is unbalanced. Could this be a reason for errors? Best, Igors -- View this message in context: http://r.789695.n4.nabble.com/function-censReg-in-panel-data-setting-tp3792227p3798113.html Sent from the R help mailing

Re: [R] Overall SSR in plm package

2011-09-08 Thread Igors
any ideas? -- View this message in context: http://r.789695.n4.nabble.com/Overall-SSR-in-plm-package-tp3796004p3798116.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] suggestion for proportions

2011-09-08 Thread Viechtbauer Wolfgang (STAT)
I assume you mean Cohen's kappa. This is not what the OP is asking about. The OP wants to know how to test for a difference in the proportions of 1's. Cohen's kappa will tell you what the level of agreement is between the two tests. This is something different. Also, the OP has now clarified

[R] invalid strings while parsing code with inlinedocs package.skeleton.dx()

2011-09-08 Thread Jannis
Dear list members, I use the package inlinedocs to create documentation for a package that I am building. The function package.skeleton.dx() is used to convert the source *.R file into the *.Rd documentation file. Usually this works like a charm, but on several occasions I got messages like

Re: [R] several functions in one *.R file in a R package

2011-09-08 Thread Jannis
Thanks, Duncan, for your reply. You are right, the () in my code are not correct. Maybe my problem is that I do not really understand the exact effect of this dot . I have no tried with the following file in my /R folder in the package: mainfunction- function(x) { x2 - .subfunction1(x)

Re: [R] invalid strings while parsing code with inlinedocs package.skeleton.dx()

2011-09-08 Thread Jannis
Seems as whether I found a (clumsy) workaround: 1. options(warn =2) 2. run package.skeleton.dx, now an error is produced with the name of the file package.skeleton was actually working on 3. The number of the erroneous input string should correspond to the line number in that file. Just in

Re: [R] storage and single-precision

2011-09-08 Thread Duncan Murdoch
On 11-09-07 6:25 PM, Mike Miller wrote: I'm getting the impression from on-line docs that R cannot work with single-precision floating-point numbers, but that it has a pseudo-mode for single precision for communication with external programs. I don't mind that R is using doubles internally, but

Re: [R] rgl 'how-to's

2011-09-08 Thread Duncan Murdoch
On 11-09-07 6:07 PM, Dale Coons wrote: Doing a visual graphic and trying to make it pretty Here's simple chart to play with: library(rgl) dotframe-data.frame(x=c(0,7,0,0,-7,0),y=c(0,0,7,0,0,-7),z=c(7,0,0,-7,0,0)) dotframe plot3d(dotframe$x,dotframe$y,dotframe$z, radius=3,

Re: [R] Searching the console

2011-09-08 Thread Eik Vettorazzi
Hi Andrew, maybe history() helps you? It also allows pattern search (using grep internally). hth. Am 08.09.2011 07:03, schrieb andrewH: Is there any way to search the console during an interactive session? I've looked and looked, and can not find one. In some add-on package, maybe? Sorry

Re: [R] access objects

2011-09-08 Thread Petr PIKAL
Hi Beware of shooting in your leg. Instead of poisoning your workspace with numerous objects called obj.n or something like that you help yourself with creating single object of type list. Parts of a list can be accessed much more easily than this kind of get construction. I use R quite a

Re: [R] several functions in one *.R file in a R package

2011-09-08 Thread Duncan Murdoch
On 11-09-08 5:28 AM, Jannis wrote: Thanks, Duncan, for your reply. You are right, the () in my code are not correct. Maybe my problem is that I do not really understand the exact effect of this dot . I have no tried with the following file in my /R folder in the package: mainfunction-

Re: [R] how to create data.frames from vectors with duplicates

2011-09-08 Thread peter dalgaard
On Sep 8, 2011, at 03:18 , zhenjiang xu wrote: Thanks for all your replies. I am using rowsum() and it looks efficient. I hope I could do some benchmark sometime in near future and let people know. Or is there any benchmark result available? I'm a bit surprised that no-one thought of xtabs(x

Re: [R] Reshaping data from wide to tall format for multilevel modeling

2011-09-08 Thread Jim Lemon
On 09/08/2011 12:02 AM, dadrivr wrote: Hi, I'm trying to reshape my data set from wide to tall format for multilevel modeling. Unfortunately, the function I typically use (make.univ from the multilevel package) does not appear to work with unbalanced data frames, which is what I'm dealing

Re: [R] predictive modeling and extremely large data

2011-09-08 Thread Divyam
Hi Steve, Thanks for the reply. I am a complete novice to R and to using SVM as well and therefore the terms that I'd used maybe non standard(I am not sure how to call them technically). Nevertheless the number of data points I had mentioned are just instances. But as I mentioned, these are bound

Re: [R] Code for The R Book

2011-09-08 Thread Peter Raundal
Hi Paul, I'm struggling to find the R code as well on the books website. Did you managed to get it and are you willing to share it with me? BR Peter -- View this message in context: http://r.789695.n4.nabble.com/Code-for-The-R-Book-tp3091596p3798218.html Sent from the R help mailing list

[R] generate randomly a value of a vector

2011-09-08 Thread Boris Beranger
Hi everyone, I have a zero vector of length N and I would like to randomly allocate the value 1 to one of the values of this vector. I presume I have to use the uniform distribution but could someone tell me how I should process? Thanks in advance, Boris -- View this message in context:

Re: [R] generate randomly a value of a vector

2011-09-08 Thread andrija djurovic
Hi Boris. Here is one approach: N-100 a-rep(0,N) a[sample(N,1)]-1 a which(a==1) Look ?sample, ?which. Andrija On Thu, Sep 8, 2011 at 10:42 AM, Boris Beranger borisberan...@gmail.comwrote: Hi everyone, I have a zero vector of length N and I would like to randomly allocate the value 1 to

Re: [R] generate randomly a value of a vector

2011-09-08 Thread Patrick Breheny
On 09/08/2011 04:42 AM, Boris Beranger wrote: I have a zero vector of length N and I would like to randomly allocate the value 1 to one of the values of this vector. I presume I have to use the uniform distribution but could someone tell me how I should process? rmultinom(m,1,rep(1,N)) where

Re: [R] Question about model selection for glm -- how to select features based on BIC?

2011-09-08 Thread Jean V Adams
If you read the help file on the step() function ?step you will see a reference to BIC under the description of the k= argument. This suggests that you could try: BIC.fitted = step(glm.fit, k=log(dim(dat)[1])) Jean Andra Isan wrote on 09/07/2011 06:12:19 PM: Hi All, After

Re: [R] Getting the values out of histogram (lattice)

2011-09-08 Thread Monica Pisica
Hi everybody, Thank you so much for all the explanations. Now it is much more clear to me. And sorry for the delay in answer but i move office and i was not on line for some time (not that you are really interested in that, though ;-)). I should have sent a dummy example, my real data is a

[R] error in knn: too many ties in knn

2011-09-08 Thread Максим Иванов
Hello. I found the behavior of knn( http://stat.ethz.ch/R-manual/R-devel/library/class/html/knn.html) function looking very strange. Consider the toy example. library(class) train - matrix(nrow=5000,ncol=2,data=rnorm(1,0,1)) test - matrix(nrow=10,ncol=2,data=rnorm(20,0,1)) cl -

Re: [R] generate randomly a value of a vector

2011-09-08 Thread Boris Beranger
Thank you very much Andrija, I have been do some research and was about to post the same solution. Boris -- View this message in context: http://r.789695.n4.nabble.com/generate-randomly-a-value-of-a-vector-tp3798190p3798595.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Searching the console

2011-09-08 Thread Sarah Goslee
I'm not at all certain what you wish to search: R objects? Past commands? If the latter, others have offered suggestions. If the former, what about simply ls()? Or if you mean something else entirely, please clarify. Sarah On Thu, Sep 8, 2011 at 1:03 AM, andrewH ahoer...@rprogress.org wrote:

[R] predict.rma (metafor package)

2011-09-08 Thread Andrew Beckerman
Hi (R 2.13.1, OSX 10.6.8) I am trying to use predict.rma with continuous and categorical variables. The argument newmods in predict.rma seems to handle coviariates, but appears to falter on factors. While I realise that the coefficients for factors provide the answers, the goal is to

[R] Extract r.squared using cbind in lm

2011-09-08 Thread Johannes Radinger
Hello, I am using cbind in a lm-model. For standard lm-models the r.squared can be easily extracted with summary(model)$r.squared, but that is not working in in the case with cbind. Here an example to illustrate the problem: a - c(1,3,5,2,5,3,1,6,7,2,3,2,6) b -

Re: [R] randomForest memory footprint

2011-09-08 Thread Liaw, Andy
It looks like you are building a regression model. With such a large number of rows, you should try to limit the size of the trees by setting nodesize to something larger than the default (5). The issue, I suspect, is the fact that the size of the largest possible tree has about 2*nodesize

[R] How to specify a variable name in the regression formula without hard coding it

2011-09-08 Thread Bos, Roger
I have a matrix called mat and y is the column number of my response and x is a vector of the column numbers of my terms. The variable name of y can change, so I don't want to hardcode it. I can find out the name as follows: names(mat)[y] [1] er12.l Then I can run the regression by

[R] 3D plot RGL

2011-09-08 Thread francogrex
Hi, anyone has experience with 3D plot (ex: in package RGL) I have a question, I draw a 3D plot of country, year and sales in z axis but when the type is h then it's ok but when I want to link the points and type is 'l' lines it's a mess Is there a way to link the points only in one direction? For

Re: [R] Extract r.squared using cbind in lm

2011-09-08 Thread peter dalgaard
On Sep 8, 2011, at 14:53 , Johannes Radinger wrote: Hello, I am using cbind in a lm-model. For standard lm-models the r.squared can be easily extracted with summary(model)$r.squared, but that is not working in in the case with cbind. Here an example to illustrate the problem: a -

[R] Variable scoping question

2011-09-08 Thread Bos, Roger
I modified an example in the object.size help page to create a function I want to be able to run: mysize - function() { z - sapply(ls(), function(w) object.size(get(w))) as.matrix(rev(sort(z))[1:5]) } mysize() When I test the lines inside the function it works fine: z -

Re: [R] Extract r.squared using cbind in lm

2011-09-08 Thread Petr PIKAL
Hi Hello, I am using cbind in a lm-model. For standard lm-models the r.squared can be easily extracted with summary(model)$r.squared, but that is not working in in the case with cbind. Here an example to illustrate the problem: a - c(1,3,5,2,5,3,1,6,7,2,3,2,6) b -

Re: [R] How to specify a variable name in the regression formula without hard coding it

2011-09-08 Thread David Winsemius
On Sep 8, 2011, at 9:03 AM, Bos, Roger wrote: I have a matrix called mat and y is the column number of my response and x is a vector of the column numbers of my terms. The variable name of y can change, so I don't want to hardcode it. I can find out the name as follows:

Re: [R] How to specify a variable name in the regression formula without hard coding it SOLVED

2011-09-08 Thread Bos, Roger
The answer to my question was : fmla - as.formula(names(mat)[y] %+% ~ .) mod - try(rlm(fmla, data=mat[zidx, c(y, x)]), silent=TRUE) Thanks for your help and the quick response. Roger -Original Message- From: Jean-Christophe BOUËTTÉ [mailto:jcboue...@gmail.com] Sent: Thursday,

Re: [R] Variable scoping question

2011-09-08 Thread David Winsemius
On Sep 8, 2011, at 9:13 AM, Bos, Roger wrote: I modified an example in the object.size help page to create a function I want to be able to run: mysize - function() { z - sapply(ls(), function(w) object.size(get(w))) as.matrix(rev(sort(z))[1:5]) } mysize() When I test the lines inside

Re: [R] suggestion for proportions

2011-09-08 Thread csrabak
Em 8/9/2011 05:24, Viechtbauer Wolfgang (STAT) escreveu: I assume you mean Cohen's kappa. This is not what the OP is asking about. The OP wants to know how to test for a difference in the proportions of 1's. Cohen's kappa will tell you what the level of agreement is between the two tests. This

Re: [R] Variable scoping question

2011-09-08 Thread jim holtman
Here is a function I use to look at the sizes of objects: my.ls - function (pos = 1, sorted = FALSE) { .result - sapply(ls(pos = pos, all.names = TRUE), function(..x) object.size(eval(as.symbol(..x if (sorted) { .result - rev(sort(.result)) } .ls -

Re: [R] 3D plot RGL

2011-09-08 Thread Jean V Adams
francogrex wrote on 09/08/2011 08:08:19 AM: Hi, anyone has experience with 3D plot (ex: in package RGL) I have a question, I draw a 3D plot of country, year and sales in z axis but when the type is h then it's ok but when I want to link the points and type is 'l' lines it's a mess Is there

Re: [R] rpart/tree issue

2011-09-08 Thread Terry Therneau
-- begin included message -- I am trying to create a classification tree using either tree or rpart but when it comes to plotting the results the formatting I get is different than what I see in all the tutorials. What I would like to see is the XX/XX format but all I get is a weird decimal

Re: [R] Imposing Feller condition using project constraint in spg

2011-09-08 Thread Ravi Varadhan
Hi Kristian, The idea behind projection is that you take an iterate that violates the constraints and project it onto a point such that it is the nearest point that satisfies the constraints. Suppose you have an iterate (w1, w4) that does not satisfy the constraint that w1 * w4 != (1 +

[R] ggplot geom_freqpoly() layers ..?

2011-09-08 Thread Brian Smith
Hi, I was trying to overlay/combine two freqpoly plots. The sample code below illustrates the problem. Essentially, I want to do is: 1. Have the same colour for all the lines in 'Plot 1' (and 'Plot 2'). Currently, all the lines in Plot 1 have different colours and all the lines in Plot 2 have

[R] global optimisation with inequality constraints

2011-09-08 Thread Liu Evans, Gareth
Dear All, I would like to minimise a nonlinear function subject to linear inequality constraints as part of an R program. I have been using the constrOptim function. I have tried all of the methods that come with Optim, but nothing finds the correct solution. If I use the correct solution

Re: [R] How to specify a variable name in the regression formula without hard coding it

2011-09-08 Thread Jean-Christophe BOUËTTÉ
have a look at ?formula and the examples 2011/9/8 Bos, Roger roger@rothschild.com: I have a matrix called mat and y is the column number of my response and x is a vector of the column numbers of my terms.  The variable name of y can change, so I don't want to hardcode it.  I can find out

[R] Need formatting help - ctree - plot.party - node_hist

2011-09-08 Thread Warren W. Kretzschmar
Hi, I am trying to get the terminal nodes of a plot of a ctree object to look nice. Using the iris data I have: library(party) mtree - ctree(Species ~ ., data=iris) plot(mtree,terminal_panel=node_barplot(mtree)) The terminal nodes don't display the species names because the names are displayed

[R] problems with function read.table

2011-09-08 Thread Samir Benzerfa
Hello everyone I have a couple of questions about the usage of the R function read.table(.). My point of departure is that I want to import a matrix (consisting of time and daily stock returns of many stocks) in R. Most of the data is numeric, however some values are missing (blanks) and in

Re: [R] storage and single-precision

2011-09-08 Thread Mike Miller
On Thu, 8 Sep 2011, Duncan Murdoch wrote: On 11-09-07 6:25 PM, Mike Miller wrote: I'm getting the impression from on-line docs that R cannot work with single-precision floating-point numbers, but that it has a pseudo-mode for single precision for communication with external programs. I

Re: [R] randomForest memory footprint

2011-09-08 Thread John Foreman
I set maxnodes and nodesize to reasonable levels and everything is working great now. Thanks for the guidance. v/r, John On Thu, Sep 8, 2011 at 8:58 AM, Liaw, Andy andy_l...@merck.com wrote: It looks like you are building a regression model.  With such a large number of rows, you should try

[R] ggplot2 freqpoly() layers..?

2011-09-08 Thread Tim Smith
Hi, I was trying to overlay/combine two freqpoly plots. The sample code below illustrates the problem. Essentially, I want to do is: 1. Have the same colour for all the lines in 'Plot 1' (and 'Plot 2'). Currently, all the lines in Plot 1 have different colours and all the lines in Plot 2 have

Re: [R] ggplot geom_freqpoly() layers ..?

2011-09-08 Thread Ista Zahn
Hi Brian On Thu, Sep 8, 2011 at 10:30 AM, Brian Smith bsmith030...@gmail.com wrote: Hi, I was trying to overlay/combine two freqpoly plots. The sample code below illustrates the problem. Essentially, I want to do is: 1. Have the same colour for all the lines in 'Plot 1' (and 'Plot 2').

Re: [R] Variable scoping question

2011-09-08 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of jim holtman Sent: Thursday, September 08, 2011 6:52 AM To: Bos, Roger Cc: r-help@r-project.org Subject: Re: [R] Variable scoping question Here is a function I use to look at

Re: [R] predict.rma (metafor package)

2011-09-08 Thread Viechtbauer Wolfgang (STAT)
Hello Andrew, Take a look at the following: predict(model1, addx=T) predict(model2, addx=T) predict(model3, addx=T) As you can see, the factor was turned into dummy variables. However, the predict.rma() function does not expand a factor passed via newmods into the corresponding dummy

[R] Density function: Area under density plot is not equal to 1. Why?

2011-09-08 Thread Gonçalo Ferraz
Hi, I have a vector 'data' of 58 probability values (bounded between 0 and 1) and want to draw a probability density function of these values. For this, I used the commands: data - runif(58) a - density(data, from=0, to=1) plot(a, type=l,lwd=3) But then, when I try to approximate the area

[R] rpart or tree function issue

2011-09-08 Thread Brian Jensvold
I am trying to create a classification tree using either tree or rpart functions but when it comes to plotting the results the formatting I get is different than what I see in all the tutorials (like http://www.youtube.com/watch?v=9XNhqO1bu0A or

Re: [R] storage and single-precision

2011-09-08 Thread William Dunlap
Use gzcon() to make a compressed connection and any function that write to a connection will write compressed data. E.g., con - gzcon(file(tempfile.junk, wb)) x - as.integer(rep(c(-127, 1, 127), c(3,2,1))) writeBin(x, con, size=1) close(con) q(no) bill:158% zcat tempfile.junk |

Re: [R] Variable scoping question

2011-09-08 Thread William Dunlap
In my.ls() you ought to convert the pos argument to an environment and consistently use that environment in the calls to eval, get, and ls in the function. E.g., with the following modification my.ls1 - function (pos = 1, sorted = FALSE, envir = as.environment(pos)) { .result -

Re: [R] problems with function read.table

2011-09-08 Thread Carlos Ortega
Hi, If you read carefully the help pages for read.table you get this: na.stringsa character vector of strings which are to be interpreted as NA../../utils/help/NA values. Blank fields are also considered to be missing values in logical, integer, numeric and complex fields. So, both NAs and

Re: [R] storage and single-precision

2011-09-08 Thread Mike Miller
On Thu, 8 Sep 2011, William Dunlap wrote: Use gzcon() to make a compressed connection and any function that write to a connection will write compressed data. E.g., con - gzcon(file(tempfile.junk, wb)) x - as.integer(rep(c(-127, 1, 127), c(3,2,1))) writeBin(x, con, size=1) close(con)

Re: [R] rpart or tree function issue

2011-09-08 Thread Carlos Ortega
Hi, Use packages rpart.plot or maptree to enhance the tree drawing. Or another alternative, use party package that offers much more graphing possibilities. Regards, Carlos Ortega www.qualityexcellence.es On Thu, Sep 8, 2011 at 5:27 PM, Brian Jensvold brnjns...@gmail.com wrote: I am trying to

Re: [R] ggplot geom_freqpoly() layers ..?

2011-09-08 Thread Brian Smith
Hi, Thanks for the reply. For the combined plot, if I use: ggplot(comb2) + geom_freqpoly(aes(x = value, y = ..density.., group = X2)) I get the same colour for both the sets of distributions. What I want is one colour for the first set of distributions, and a different

Re: [R] global optimisation with inequality constraints

2011-09-08 Thread Carlos Ortega
Hi, I think this other post could help: http://stackoverflow.com/questions/7328104/optim-with-inequality-constraint Regards, Carlos Ortega www.qualityexcellence.es On Thu, Sep 8, 2011 at 3:54 PM, Liu Evans, Gareth gareth.liu-ev...@liverpool.ac.uk wrote: Dear All, I would like to minimise a

Re: [R] Need formatting help - ctree - plot.party - node_hist

2011-09-08 Thread Carlos Ortega
Hi, You can get something better in this way: plot(mtree,terminal_panel=node_barplot(mtree, ylines=1.2, gap=0.05)) Check node_barplot() for details, although it does not offer for barplots the possibility to graph it horizontally. Regards, Carlos Ortega www.qualityexcellence.es On Thu, Sep

Re: [R] storage and single-precision

2011-09-08 Thread Duncan Murdoch
On 08/09/2011 11:14 AM, Mike Miller wrote: On Thu, 8 Sep 2011, Duncan Murdoch wrote: On 11-09-07 6:25 PM, Mike Miller wrote: I'm getting the impression from on-line docs that R cannot work with single-precision floating-point numbers, but that it has a pseudo-mode for single precision

Re: [R] Density function: Area under density plot is not equal to 1. Why?

2011-09-08 Thread Greg Snow
For bounded density estimation look at the logspline package instead of the regular density function. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org

Re: [R] Density function: Area under density plot is not equal to 1. Why?

2011-09-08 Thread Albyn Jones
Look at area - sum(a$y)*(a$x[1]-a$y[2]) The problem appears to be a$x[1]-a$y[2]; that is not the length of the base of an approximating rectangle, whatever it is :-) albyn On Thu, Sep 08, 2011 at 11:36:23AM -0400, Gonçalo Ferraz wrote: Hi, I have a vector 'data' of 58 probability values

Re: [R] Hysteresis modeling and simulation

2011-09-08 Thread Bill Harris
On Mon, Sep 5, 2011 at 12:25 AM, Yvonnick Noel yvonnick.n...@uhb.fr wrote: Hi Bill, I once modelled a hysteresis phenomenon (on binary data) with a simple logistic model. I am not sure I understand how this pattern appears in your data, but in my previous analyses, it appeared as an order

[R] problem with math expressions in grid graphics when using line breaks (\n)

2011-09-08 Thread Mark Heckmann
I want to plot a multiline annotation including a mathematical expression using grid graphics (grid.text). This works fine for a single line, but the math expression is misplaced when I insert a line break (\n escape sequence): grid.text(expression(paste(Some words here\n more , sigma))) Does

[R] Can't load workspaces

2011-09-08 Thread Monsieur Do
I've seen a number of issues with the loading of workspaces discussed previously, but here's another one... I simply can't load any saved workspace at all... Here's an example, starting with an empty workspace and creating a single variable a. a-1:5 save.image(a.Rdata) rm(a)

[R] pie chart

2011-09-08 Thread Mohan L
Hi All, I have txt file like : $ cat data.txt US 10 UK 12 Ind 4 Germany 14 France 8 rawdata - read.table(file='data.txt',sep='\t' , header=FALSE) rawdata V1 V2 1 US 10 2 UK 12 3 Ind 4 4 Germany 14 5 France 8 I want to draw pie chart for the above data.

Re: [R] pie chart

2011-09-08 Thread Jean V Adams
Mohan L wrote on 09/08/2011 12:35:18 PM: Hi All, I have txt file like : $ cat data.txt US 10 UK 12 Ind 4 Germany 14 France 8 rawdata - read.table(file='data.txt',sep='\t' , header=FALSE) rawdata V1 V2 1 US 10 2 UK 12 3 Ind 4 4 Germany 14

Re: [R] Density function: Area under density plot is not equal to 1. Why?

2011-09-08 Thread Jean-Christophe BOUËTTÉ
Is your data supposed to be observations, or values of the density of the underlying law? Also, could you explain the rationale behind : sum(a$y)*(a$x[1]-a$y[2]) because it is not immediately clear to the reader. 2011/9/8 Gonçalo Ferraz gferra...@gmail.com: Hi, I have a vector 'data' of 58

[R] random sampling but with caveats!

2011-09-08 Thread Rebecca Ross
Hi, I wonder if someone can help me. I have built a gam model to predict the presence of cold water corals and am now trying to evaluate my model by splitting my dataset into training/test datasets. In an ideal world I would use the sample() function to randomly select rows of data for me so

[R] General help - online statistics courses?

2011-09-08 Thread kensuguro
I understand this isn't a r specific question. I'm switching departments to work with the analytics team at my company as a service side manager to better incorporate the analytics process into product design / production. We're an online gaming company. As I'm going through tools like R,

Re: [R] General help - online statistics courses?

2011-09-08 Thread Mitchell Maltenfort
My approach has been autodidactic. There's a bookstore near me (Barnes and Noble at U of Penn) that has a terrific stats section. Amazon also has a lot of books, including limited online browsing + reader recommendations. On 9/8/11, kensuguro magronb...@gmail.com wrote: I understand this isn't a

Re: [R] General help - online statistics courses?

2011-09-08 Thread Mitchell Maltenfort
Also, look at ocw.mit.edu for free course notes with statistical content. On 9/8/11, kensuguro magronb...@gmail.com wrote: I understand this isn't a r specific question. I'm switching departments to work with the analytics team at my company as a service side manager to better incorporate the

Re: [R] Searching the console

2011-09-08 Thread andrewH
Dear Sarah-- I am thinking mainly in terms of long programs run by cut-and-past or some other batch-like submission, where you can get back a lot of code, some program outputs, and some error messages, all in a big lump. I want tl look through that lump to locate all the error or warning

[R] The elegant way to test if a number is a whole number

2011-09-08 Thread Alexander Engelhardt
Hi, x - 0.2*5 is.integer(x) gives me FALSE because R stores it as a float number, right? Is there an elegant way to work around that problem? Right now I'm using x - 0.2*5 round(x) == x which returns TRUE. But more strictly I should use all.equal(), right? I somehow just

Re: [R] rpart/tree issue

2011-09-08 Thread Stephen Milborrow
Brian Jensvold bjensv...@hawesfinancial.com het geskryf I am trying to create a classification tree using either tree or rpart but when it comes to plotting the results the formatting I get is different than what I see in all the tutorials. What I would like to see is the XX/XX format but all I

Re: [R] Searching the console

2011-09-08 Thread andrewH
Thanks Eik! I did not know about or remember history. I agree that it solves part of my problem, but I really want to be able to search my code and the things R has printed in response as a single block of text. I can cut-and-paste it into a text editor, but I was hoping that there was a way to

Re: [R] The elegant way to test if a number is a whole number

2011-09-08 Thread Jason Morgan
Hello Alex, Have you tried the modulus operator? 2 %% 1 [1] 0 2.1 %% 1 [1] 0.1 ~Jason On 2011.09.08 20:27:14, Alexander Engelhardt wrote: Hi, x - 0.2*5 is.integer(x) gives me FALSE because R stores it as a float number, right? Is there an elegant way to work around that

Re: [R] Density function: Area under density plot is not equal to 1. Why?

2011-09-08 Thread peter dalgaard
On Sep 8, 2011, at 19:03 , Albyn Jones wrote: Look at area - sum(a$y)*(a$x[1]-a$y[2]) The problem appears to be a$x[1]-a$y[2]; that is not the length of the base of an approximating rectangle, whatever it is :-) I would assume that that is just a typo for a$x[1]-a$x[2], which makes

Re: [R] ggplot2-Issue placing error bars behind data points

2011-09-08 Thread Nathan Miller
Jeff Newmiller and Dennis, As always, very helpful. I appreciate the comments on how best to organize the code as well. Simplifies things greatly. Thanks, Nate On Wed, Sep 7, 2011 at 3:33 PM, Dennis Murphy djmu...@gmail.com wrote: Hi: For your test data, try this: # Result of

Re: [R] The elegant way to test if a number is a whole number

2011-09-08 Thread Bert Gunter
Have a close look at ?storage.mode and ?typeof. The problem here, as usual and as you seem to allude is: define integer . Mathematically, there is an unequivocal definition, but not so in finite precision arithmetic. Are you referring to the machine representation (typeof()), or the approximate

Re: [R] General help - online statistics courses?

2011-09-08 Thread Spencer Graves
Have you looked at www.r-project.org - books? Also, www.r-project.org - CRAN (select a mirror) - Documentation: Contributed includes a variety of documents that are free and potentially quite helpful. Also, I wouldn't be shy about asking co-workers for suggestions. (I'd rather

Re: [R] The elegant way to test if a number is a whole number

2011-09-08 Thread Marc Schwartz
There was a post from Martin Maechler some years ago and I had to search a bit to find it. For these sorts of issues, I typically trust his judgement. The post is here: https://stat.ethz.ch/pipermail/r-help/2003-April/032471.html His solution also handles complex numbers. HTH, Marc

Re: [R] The elegant way to test if a number is a whole number

2011-09-08 Thread Alexander Engelhardt
Am 08.09.2011 20:48, schrieb Marc Schwartz: There was a post from Martin Maechler some years ago and I had to search a bit to find it. For these sorts of issues, I typically trust his judgement. The post is here: https://stat.ethz.ch/pipermail/r-help/2003-April/032471.html His

Re: [R] The elegant way to test if a number is a whole number

2011-09-08 Thread David Winsemius
On Sep 8, 2011, at 3:35 PM, Alexander Engelhardt wrote: Am 08.09.2011 20:48, schrieb Marc Schwartz: There was a post from Martin Maechler some years ago and I had to search a bit to find it. For these sorts of issues, I typically trust his judgement. The post is here:

Re: [R] The elegant way to test if a number is a whole number

2011-09-08 Thread Marc Schwartz
On Sep 8, 2011, at 2:42 PM, David Winsemius wrote: On Sep 8, 2011, at 3:35 PM, Alexander Engelhardt wrote: Am 08.09.2011 20:48, schrieb Marc Schwartz: There was a post from Martin Maechler some years ago and I had to search a bit to find it. For these sorts of issues, I typically

Re: [R] The elegant way to test if a number is a whole number

2011-09-08 Thread David Winsemius
On Sep 8, 2011, at 3:54 PM, Marc Schwartz wrote: On Sep 8, 2011, at 2:42 PM, David Winsemius wrote: On Sep 8, 2011, at 3:35 PM, Alexander Engelhardt wrote: Am 08.09.2011 20:48, schrieb Marc Schwartz: There was a post from Martin Maechler some years ago and I had to search a bit to find

Re: [R] ggplot geom_freqpoly() layers ..?

2011-09-08 Thread Ista Zahn
On Thu, Sep 8, 2011 at 12:10 PM, Brian Smith bsmith030...@gmail.com wrote: Hi, Thanks for the reply. For the combined plot, if I use:     ggplot(comb2) + geom_freqpoly(aes(x = value,                     y = ..density.., group = X2)) I get the same colour for both the sets of

[R] help subsetting data based on date AND time

2011-09-08 Thread Steve E.
Dear R Community, I am new to R, and have a question that I suspect may be quite simple but is proving a formidable roadblock for me. I have a large data set that includes water-quality measurements collected over many 24-hour periods. The date and time of sample collection are in a combined

[R] Spider (Radar) Plot

2011-09-08 Thread XINLI LI
Dear R Group: Based on the following data, how to do a great Spider (Radar) Plot? Any advice is greatly appreciated. HospID Rate Age Charlson NIHSS 1 0.2 49 3.5 0 2 0.1 48 1.8 12 3 0.4 56 2.1 5 4 0.3 77 0 7 5 0.2 67 6.5 3 6 0.1 62 4.8 4.6 7 0.1 64 12 5.2 8 0.3 61 3 2.8 9 0.15 69 4.5 1.9

Re: [R] ggplot2 freqpoly() layers..?

2011-09-08 Thread Dennis Murphy
Hi: You could try something like this: # rbind the two melted data frames: comb - rbind(mat2, tab2) # create a group factor to distinguish the two data sets comb - mutate(comb, gp = factor(rep(1:2, each = 1))) # Generate the plot: ggplot(comb) + geom_freqpoly(aes(x = value, y =

Re: [R] help subsetting data based on date AND time

2011-09-08 Thread Luke Miller
Try altering your subset operation from this: with(DataSet, subset(DataSet, DataSet$NewDateTime '2004-08-05 14:15:00')) to this: with(DataSet, subset(DataSet, DataSet$NewDateTime as.POSIXct('2004-08-05 14:15:00'))) and see if you get the desired effect. The statement DataSet$NewDateTime

Re: [R] Spider (Radar) Plot

2011-09-08 Thread Jean-Christophe BOUËTTÉ
Both ??radar and ??spider return ?stars. 2011/9/8 XINLI LI lihaw...@gmail.com: Dear R Group:   Based on the following data, how to do a great Spider (Radar) Plot? Any advice is greatly appreciated.     HospID Rate Age Charlson NIHSS 1 0.2 49 3.5 0 2 0.1 48 1.8 12 3 0.4 56 2.1 5 4 0.3 77 0

Re: [R] The elegant way to test if a number is a whole number

2011-09-08 Thread Marc Schwartz
On Sep 8, 2011, at 3:09 PM, David Winsemius wrote: On Sep 8, 2011, at 3:54 PM, Marc Schwartz wrote: On Sep 8, 2011, at 2:42 PM, David Winsemius wrote: On Sep 8, 2011, at 3:35 PM, Alexander Engelhardt wrote: Am 08.09.2011 20:48, schrieb Marc Schwartz: There was a post from Martin

Re: [R] Can't load workspaces

2011-09-08 Thread Rolf Turner
Your example works without error for me; R version 2.13.1 Patched on Ubuntu Linux. No idea why you are having problems. cheers, Rolf Turner On 09/09/11 05:24, Monsieur Do wrote: I've seen a number of issues with the loading of workspaces discussed previously, but here's

Re: [R] The elegant way to test if a number is a whole number

2011-09-08 Thread David Winsemius
On Sep 8, 2011, at 4:41 PM, Marc Schwartz wrote: On Sep 8, 2011, at 3:09 PM, David Winsemius wrote: On Sep 8, 2011, at 3:54 PM, Marc Schwartz wrote: On Sep 8, 2011, at 2:42 PM, David Winsemius wrote: On Sep 8, 2011, at 3:35 PM, Alexander Engelhardt wrote: Am 08.09.2011 20:48,

Re: [R] General help - online statistics courses?

2011-09-08 Thread Rolf Turner
On 09/09/11 06:46, Spencer Graves wrote: SNIP I'd rather ask a stupid question than make a stupid mistake. SNIP Fortune? cheers, Rolf Turner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

  1   2   >