[R] drawing ellipses in R

2011-11-01 Thread mmstat
Hello, I have been following the thread dated Monday, October 9, 2006 when Kamila Naxerova asked a question about plotting elliptical shapes. Can you explain the equations for X and Y. I believe they used the parametric form of x and y (x=r cos(theta), y=r sin(theta). I don't know what r is

Re: [R] quantmod package

2011-11-01 Thread ATANU
Dear Michael , Thanks for your help. I figured out the fault. Actually i was running the code for a very short time(less than one minute) and was then trying to make chart out of that. The code works well if I run it for more than one minute. Thanks again for your help. Atanu -- View this

Re: [R] troubles installing R

2011-11-01 Thread Paul Hiemstra
On 10/31/2011 06:30 PM, Cable, Sam B Civ USAF AFMC AFRL/RVBXI wrote: I am trying to install R on a pretty up-to-date CentOS system. I have tried installing 2.14.0 and 2.13.2. In both cases, the configure step fails, and does not produce a Makefile. So, of course, I can't issue make. The

[R] Nested lapply? Is this allowed?

2011-11-01 Thread Alaios
Dear all, I want for a given data set to call a funciton many time. That bring us all to the notion of lapply (or any other variance). My problem is that this data set should also be created from another lapply As for example   DataToAnalyse -

Re: [R] drawing ellipses in R

2011-11-01 Thread Barry Rowlingson
On Tue, Nov 1, 2011 at 4:49 AM, mms...@comcast.net wrote: Hello, I have been following the thread dated Monday, October 9, 2006 when Kamila Naxerova asked a question about plotting elliptical shapes. Can you explain the equations for X and Y. I believe they used the parametric form of x

Re: [R] Significance of trend

2011-11-01 Thread Muhammad Rahiz
Thanks for those who replied. I know what a p-value is and the links given reaffirm my understanding. The code below gives p=0.26. This is more than 0.05 - hence null hypothesis i.e. attributed by chance. But I did not specify the significance level at 0.05. So I'm wondering if any part of

[R] triangles point left, filled?

2011-11-01 Thread Martin Ivanov
Dear R users, I want to plot not only triangles point up and triangles point down, which is easy using the pch argument to points. I want to plot left and right pointing triangles as well. They must be fillable with colour. I browsed a little in the documentation, tried rotating the up and

Re: [R] troubles installing R

2011-11-01 Thread Prof Brian Ripley
On Tue, 1 Nov 2011, Paul Hiemstra wrote: On 10/31/2011 06:30 PM, Cable, Sam B Civ USAF AFMC AFRL/RVBXI wrote: I am trying to install R on a pretty up-to-date CentOS system. I have tried installing 2.14.0 and 2.13.2. In both cases, the configure step fails, and does not produce a Makefile.

Re: [R] troubles installing R

2011-11-01 Thread Paul Hiemstra
On 11/01/2011 09:50 AM, Prof Brian Ripley wrote: On Tue, 1 Nov 2011, Paul Hiemstra wrote: On 10/31/2011 06:30 PM, Cable, Sam B Civ USAF AFMC AFRL/RVBXI wrote: I am trying to install R on a pretty up-to-date CentOS system. I have tried installing 2.14.0 and 2.13.2. In both cases, the

[R] Read/Write textbox in R

2011-11-01 Thread Ritz
I am writing a GUI for my R script. It is a very basic form consisting of textboxes and buttons. I tried to run the following example to learn how to read value currently entered into the textbox: ( it requires tcltk/tcltk2 packages ) # Create the widgets base - tktoplevel() list -

Re: [R] Question on estimating standard errors with noisy signals using the quantreg package

2011-11-01 Thread Thorsten Vogel
Many thanks for your comments. The median of the r_i is something around 1000. And for the time being there are no covariates, though this might change in the future. We are only starting to exploit a very nice data set. Regarding the probability of being in the data, p, I would say it is indeed

Re: [R] Vectorize 'eol' characters

2011-11-01 Thread Stefano Conti
Dear David, My ultimate purpose is to generate a text file encoding a LaTeX table for later inclusion in a report; while I'm aware of, and familiar with, Sweave, such table would feature _some_ whole or partial crossing horizontal lines (\hline or \cline with varying arguments, which need to

Re: [R] Correlation Matrix in R

2011-11-01 Thread AlexC
Hello, Thank you for your replies. I cannot run the function rcor.test even when having loaded package ltm. Perhaps it has to do with the fact that I am using the latest version of R and this package wasn't created under that version The function corr.test in package psych works fine. Is

[R] multivariate random variable

2011-11-01 Thread Anera Salucci
Dear All,   How can I generate multivariate random variable (not multivariate normal )   I am in urgent [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] Correlation Matrix in R

2011-11-01 Thread andrija djurovic
Hi, one solution is to use sink. Check ?sink to see explanation and following example. sink(sink-examp.txt) i - 1:10 outer(i, i, *) sink() Andrija On Tue, Nov 1, 2011 at 10:43 AM, AlexC alexandre.chaus...@unil.ch wrote: Hello, Thank you for your replies. I cannot run the function rcor.test

Re: [R] multivariate random variable

2011-11-01 Thread Mehmet Suzen
You can use mvtnorm package http://cran.r-project.org/web/packages/mvtnorm/index.html -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Anera Salucci Sent: 01 November 2011 11:22 To: r-help@r-project.org Subject: [R] multivariate

Re: [R] Multiple time series with zoo

2011-11-01 Thread Gabor Grothendieck
On Mon, Oct 31, 2011 at 11:27 PM, Vinny Moriarty vwmoria...@gmail.com wrote: Thanks for everyone's input so far, it is greatly appreciated. But I've got one last task I could use some advice on Here are the first few lines of my data set:

Re: [R] Significance of trend

2011-11-01 Thread Uwe Ligges
On 01.11.2011 09:47, Muhammad Rahiz wrote: Thanks for those who replied. I know what a p-value is and the links given reaffirm my understanding. The code below gives p=0.26. This is more than 0.05 - hence null hypothesis i.e. attributed by chance. But I did not specify the significance level

Re: [R] Nested lapply? Is this allowed?

2011-11-01 Thread Uwe Ligges
For short: 1. I wonder if you cannot make the two steps one and hence only need one lapply anway. 2. Why not just try out? 3. If it does not work, ordinary loops may be able to. best, Uwe Ligges On 01.11.2011 09:24, Alaios wrote: Dear all, I want for a given data set to call a funciton

[R] Combine variables of different length

2011-11-01 Thread Johannes Radinger
Hi, I have got a dataset with the variables Y,X1,X2,X3. Some of these variables contain NAs. Therefore incomplete datasets aren't recognized when I am doing a regression like: model - lm(Y~X1+X2+X3) so the resulting vector of resid(model) is obviousely shorter then the original variables. How

[R] package descr: create weighted cross tabulation

2011-11-01 Thread Marion Wenty
hello, using the package descr i created a crosstab e.g.: Table - crosstab(age,question,weight=pond) age: being a variable that consists of the surveyed data of the ages of children: the values are 6 years, 7 years and 8 years. question: is a variable that consists of the answers of these

[R] predict lmer

2011-11-01 Thread Natalia Vizcaíno Palomar
Dear all, I've been reading for many days trying to predict with lmer but I haven't managed to do it. I've fitted an allometric model for trees where I have included climatic variables and diameter in the fixed part and in the random part I've included the experimental sites where trees are and

Re: [R] Interesting Memory Management Problem (Windows)

2011-11-01 Thread Bob
Just to close my issue: When changing the data types from xts to numeric, the problem went away and the speed of processing increased dramatically. (seems obvious in hindsight) -- View this message in context:

Re: [R] weibull fitdistr problem: optimization failed

2011-11-01 Thread ethan.shepherd
That worked, thanks! On Fri, Oct 28, 2011 at 12:27 PM, bbolker [via R] ml-node+s789695n3948463...@n4.nabble.com wrote: ethan.shepherd someguy235 at gmail.com writes: I'm getting errors when running what seems to be a simple Weibull distribution function: [snip] If I change the

[R] Greek letter

2011-11-01 Thread Filoche
Hi everyone. I'm trying to use small letter phi in a graph produced in R. However, the small letter phi does not look as it should. In fact, it looks like this: http://r.789695.n4.nabble.com/file/n3963311/Untitled.png instead of what is here http://en.wikipedia.org/wiki/Phi Here's the code I

Re: [R] Greek letter

2011-11-01 Thread Uwe Ligges
On 01.11.2011 13:20, Filoche wrote: Hi everyone. I'm trying to use small letter phi in a graph produced in R. However, the small letter phi does not look as it should. In fact, it looks like this: http://r.789695.n4.nabble.com/file/n3963311/Untitled.png Yes, an excellent phi. instead

Re: [R] Greek letter

2011-11-01 Thread R. Michael Weylandt
Try changing phi to varphi. Michael On Tue, Nov 1, 2011 at 8:20 AM, Filoche pmassico...@hotmail.com wrote: Hi everyone. I'm trying to use small letter phi in a graph produced in R. However, the small letter phi does not look as it should. In fact, it looks like this:

Re: [R] Greek letter

2011-11-01 Thread peter dalgaard
On Nov 1, 2011, at 13:20 , Filoche wrote: Hi everyone. I'm trying to use small letter phi in a graph produced in R. However, the small letter phi does not look as it should. In fact, it looks like this: http://r.789695.n4.nabble.com/file/n3963311/Untitled.png instead of what is

Re: [R] Correlation Matrix in R

2011-11-01 Thread William Revelle
Alexandre, The output from corr.test is a list of matrices. To export one of those matrices, simply specify which one you want: Using the example from my previous note: library(psych) examp - corr.test(sat.act) mat.c.p - lower.tri(examp$r)*examp$r + t(lower.tri(examp$p)*examp$p) mat.c.p

Re: [R] writing data from several matrices in R into one excel-file with several sheets

2011-11-01 Thread Marion Wenty
hello, over a month ago i asked this question and then wrote to the list that i had to postpone the problem. anyway, now i tried it again with the XLConnect package and was successfull! i used these commands: wb - loadWorkbook(MyExcelFile.xlsx, create=TRUE) createSheet(wb,name=MySheetname)

Re: [R] Combine variables of different length

2011-11-01 Thread R. Michael Weylandt
Perhaps something like this: X = jitter(1:10) Y = jitter(3*X-5, factor = 3) X[3] = NA m = lm(Y~X)$fitted.values fits - rep(NA, length(X)); fits[as.numeric(names(m))] - m; cbind(X,Y,fits) Michael On Tue, Nov 1, 2011 at 8:52 AM, Johannes Radinger jradin...@gmx.at wrote: Hi, I have got a

[R] annotate histogram

2011-11-01 Thread Wendy
Hi all, I want to make a histogram like the one show http://nar.oxfordjournals.org/content/39/suppl_1/D1011/F1.expansion.html here , but I did not figure out how to add the red marks at the bottom of the bars. Could anybody help? Thank you very much -- View this message in context:

Re: [R] annotate histogram

2011-11-01 Thread Carlos Ortega
Hi, You can use function segments() to draw them. Regards, Carlos Ortega www.qualityexcellence.es 2011/11/1 Wendy wendy2.q...@gmail.com Hi all, I want to make a histogram like the one show http://nar.oxfordjournals.org/content/39/suppl_1/D1011/F1.expansion.html here , but I did not

Re: [R] Vectorize 'eol' characters

2011-11-01 Thread David Winsemius
On Nov 1, 2011, at 5:18 AM, Stefano Conti wrote: Dear David, My ultimate purpose is to generate a text file encoding a LaTeX table for later inclusion in a report; while I'm aware of, and familiar with, Sweave, such table would feature _some_ whole or partial crossing horizontal lines

Re: [R] annotate histogram

2011-11-01 Thread Tom Fletcher
See rug() and use col=2 to get red. So, as an example ... x - rchisq(100, df=2) hist(x) abline(v=median(x), lty=2) rug(x, col=2) TF -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Wendy Sent: Tuesday, November 01, 2011 10:22 AM

[R] Sample size calculations for one sided binomial exact test

2011-11-01 Thread Andrew Redd
I'm trying to compute sample size requirements for a binomial exact test. we want to show that the proportion is at least 90% assuming that it is 95%, with 80% power so any asymptotic approximations are out of the questions. I was planning on using binom.test to perform the simple test against a

[R] Marketing Mix Model using PDL

2011-11-01 Thread Peter Erskine
Hello, I am working a marketing mix model with different specification (that is different lags , degree of polynomial and different end point specification ) for each of the independent variables and will appreciate any help on the package I can used to this exercise and also a

Re: [R] oversampling code

2011-11-01 Thread loubna181
Hi, Thanks all for your responses, but as I m a new user of R while trying to apply what David suggests I dont know what *dorm *refers to. dfrm[c(rownames(dfrm[*dorm*$Y==1,]), sample(rownames(dfrm[dfrm$Y==0]), 0.10)) , ] But to give you more details , I'm working on a table calles balance from

Re: [R] oversampling code

2011-11-01 Thread Kevin E. Thorpe
On 11/01/2011 12:32 PM, loubna181 wrote: Hi, Thanks all for your responses, but as I m a new user of R while trying to apply what David suggests I dont know what *dorm *refers to. dfrm[c(rownames(dfrm[*dorm*$Y==1,]), sample(rownames(dfrm[dfrm$Y==0]), 0.10)) , ] I suspect that dorm was a typo

Re: [R] triangles point left, filled?

2011-11-01 Thread David Winsemius
On Nov 1, 2011, at 5:05 AM, Martin Ivanov wrote: Dear R users, I want to plot not only triangles point up and triangles point down, which is easy using the pch argument to points. I want to plot left and right pointing triangles as well. They must be fillable with colour. I browsed a

Re: [R] help with means using tail()

2011-11-01 Thread R. Michael Weylandt
I think a lag() command will work for you -- but a more helpful piece of advise is probably to use xts or zoo packages rather than the base ts. Most people find ts very hard to work with and find that all their difficulties magically go away when they use those classes. In xts: it would be

Re: [R] Vectorize 'eol' characters

2011-11-01 Thread Stefano Conti
Dear David, Thank you for your follow-up and extra-suggestion. Your additional stab at my problem indeed looks like it'd work too; as I previously wrote, I had already devised a work-around but was nonetheless left wondering whether a more elegant and compact solution was still escaping my

[R] round up a number to 10^4

2011-11-01 Thread Wendy
Hi all, I have a list of numbers, e.g., X = c(60593.23, 71631.17, 75320.1), and want to round them so the output is Y = c(6, 8, 8). I tried Y-round(X,-4), but it gives me Y = c(6, 7, 8). Do anybody know how to round up a number to 10^4? Thank you in advance. Wendy --

[R] Removal/selecting specific rows in a dataframe conditional on 2 columns

2011-11-01 Thread Aurelie Cosandey Godin
Dear list, After reading different mails, blogs, and tried a few different codes without any success, I am asking your help! I have the following data frame where each row represent a survey unit with the following variables: names(RV09) [1] record.t trip set month stratum

[R] help with unequal variances

2011-11-01 Thread peak99
Hello, I have some patient data for my masters thesis with three groups (n=16, 19 20) I have completed compiling the results of 7 tests, for which one of these tests the variances are unequal. I wish to perform an ANOVA between the three groups but for the one test with unequal variance

Re: [R] help with unequal variances

2011-11-01 Thread B77S
the following is a more appropriate forum for your question, seeing as this has nothing to do with R (per se). http://stats.stackexchange.com/questions good luck. peak99 wrote: Hello, I have some patient data for my masters thesis with three groups (n=16, 19 20) I have completed

Re: [R] round up a number to 10^4

2011-11-01 Thread David Winsemius
On Nov 1, 2011, at 1:07 PM, Wendy wrote: Hi all, I have a list of numbers, e.g., X = c(60593.23, 71631.17, 75320.1), and want to round them so the output is Y = c(6, 8, 8). Under what notion of rounding would that be the result? I tried Y-round(X,-4), but it gives me Y =

Re: [R] round up a number to 10^4

2011-11-01 Thread R. Michael Weylandt michael.weyla...@gmail.com
Could you divide by your desired order of magnitude, use ceiling and then re-multiply? Michael On Nov 1, 2011, at 3:42 PM, David Winsemius dwinsem...@comcast.net wrote: On Nov 1, 2011, at 1:07 PM, Wendy wrote: Hi all, I have a list of numbers, e.g., X = c(60593.23, 71631.17, 75320.1),

Re: [R] round up a number to 10^4

2011-11-01 Thread Clint Bowman
Or does the middle number have two digits switched? 76131.17 would round up to 8 very nicely. -- Clint BowmanINTERNET: cl...@ecy.wa.gov Air Quality Modeler INTERNET: cl...@math.utah.edu Department of Ecology VOICE: (360)

Re: [R] round up a number to 10^4

2011-11-01 Thread Bert Gunter
Yes, I agree with David that this looks like an error. However, for fun, one might ask: what is the fewest number of R elementary math operations that would produce such a result -- this might be good for clever 6th or 7th graders, for example. For here, I leave this as an exercise for the

Re: [R] round up a number to 10^4

2011-11-01 Thread jim holtman
Also be aware of the IEEE standard of rounding to even: round(61000, -4) [1] 6 round(62000, -4) [1] 6 round(65000, -4) [1] 6 round(66000, -4) [1] 7 round(76000, -4) [1] 8 round(75000, -4) [1] 8 notice what 65000 rounds to and what 75000 rounds to. On Tue, Nov 1,

Re: [R] round up a number to 10^4

2011-11-01 Thread Nordlund, Dan (DSHS/RDA)
Bert, How do you define elementary? And, do we play this like Name That Tune? Bert, I can do that calculation in X operations. Or, maybe like Jeopardy, What is the number X? Or maybe we could play Are You Smarter Than a Seventh-Grader? I'm just asking. Dan Daniel J. Nordlund

Re: [R] Removal/selecting specific rows in a dataframe conditional on 2 columns

2011-11-01 Thread R. Michael Weylandt
Perhaps use tapply() to split by the survey unit and write a little identity function that returns only those rows you want, then patch them all back together with something like simplify2array(). Michael On Tue, Nov 1, 2011 at 1:16 PM, Aurelie Cosandey Godin god...@dal.ca wrote: Dear list,

[R] factor level issue after subsetting

2011-11-01 Thread Schreiber, Stefan
Dear list, I cannot figure out why, after sub-setting my data, that particular item which I don't want to plot is still in the newly created subset (please see example below). R somehow remembers what was in the original data set. A work around is exporting and importing the new subset. Then it's

[R] Imputing Missing Data: A Good Starting Point?

2011-11-01 Thread Sascha Vieweg
Hello I am working on my first attempt to impute missing data of a data set with systematically incomplete answers (school performance tests). I was googling around for some information and found Amelia (Honaker et al., 2010) and the mi package (Yu-Sung et al., n.d.). However, since I am new

[R] Windows binary of 2.14.0

2011-11-01 Thread Duncan Murdoch
To all Windows users: The binary build of 2.14.0 that was uploaded yesterday was missing Cairo support. I have rebuilt it, and uploaded a new copy. You can tell which one you have by running svg(), which works on the new one, but not the old one. You can tell which one is on your CRAN

Re: [R] Imputing Missing Data: A Good Starting Point?

2011-11-01 Thread Ken
Hope this helps: http://rss.acs.unt.edu/Rdoc/library/randomForest/html/rfImpute.html Ken Hutchison On Nov 1, 2554 BE, at 5:29 PM, Sascha Vieweg saschav...@gmail.com wrote: Hello I am working on my first attempt to impute missing data of a data set with systematically incomplete answers

Re: [R] factor level issue after subsetting

2011-11-01 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Schreiber, Stefan Sent: Tuesday, November 01, 2011 2:29 PM To: r-help@r-project.org Subject: [R] factor level issue after subsetting Dear list, I cannot figure out why,

Re: [R] factor level issue after subsetting

2011-11-01 Thread Justin Haynes
first of all, the subsetting line is overly complicated. dat.sub-dat[dat$treat!='cont',] will work just fine. R does exactly what you're describing. It knows the levels of the factor. Once you remove 'cont' from the data, that doesn't mean that the level is removed from the factor:

Re: [R] factor level issue after subsetting

2011-11-01 Thread Felipe Carrillo
Stefan: Use the droplevels function... dat - read.table(textConnection(   treat yield 1  cont  98.7 2  cont  97.2 3  cont  96.1 4  cont  98.1 5    10 103.0 6    10 101.3 7    10 102.1 8    10 101.9 9    30 121.1 10    30 123.1 11    30 119.7 12    30 118.9 13    60 109.9 14    60 110.1 15    60

Re: [R] factor level issue after subsetting

2011-11-01 Thread Schreiber, Stefan
Thanks for the fast response and your comments! That works perfect! Another little mystery solved ;) Stefan From: Felipe Carrillo [mailto:mazatlanmex...@yahoo.com] Sent: Tuesday, November 01, 2011 3:54 PM To: Schreiber, Stefan; r-help@r-project.org Subject: Re: [R] factor level

Re: [R] NROW doesn't equal length(x)

2011-11-01 Thread R. Michael Weylandt
Your first problem is that you aren't using paste() properly: print out paste(ct3[, 1:2]) and take a look at it. This works: apply(head(ct3[,1:2]),1,paste,collapse = ) You also have the format argument to POSIXct wrong. See ?strptime for details. So the whole line (if you want to do it in

Re: [R] NROW doesn't equal length(x)

2011-11-01 Thread R. Michael Weylandt
I perhaps made that a little too complicated: this will also work: v2 = xts(ct3[,3], as.POSIXct(paste(ct3[,1], ct3[,2]), format = %m/%d/%Y %H:%M:%S)) identical(v, v2) TRUE On Tue, Nov 1, 2011 at 6:06 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: Your first problem is that you

Re: [R] Superimpose xversus y plot on a histogram of x

2011-11-01 Thread Jim Silverton
I need a plot with a histogram z and a plot of z versus y superimposed. This is not working... z = rnorm(1000) y = rnorm(1000,1,2) hist(z) dx = plot(z, y, lwd = 1) lines(dx, add=TRUE) -- Thanks, Jim. [[alternative HTML version deleted]] __

[R] How to interpret Spearman Correlation

2011-11-01 Thread shahab
Hi, I am not really familiar with Correlation foundations, although I read a lot. So maybe if someone kindly help me to interpret the following results. I had the following R commands: correlation -cor( vector_CitationProximity , vector_Impact, method = spearman, use=na.or.complete)

Re: [R] Subsampling-oversampling from a data frame

2011-11-01 Thread B77S
If no one has a better solution, split it, take a sample of size X from both and put it back together. hgwelec wrote: Dear members, Consider the following data frame (first 4 rows shown) age sex class 15 m low 20 f high 15 f low 10 m low in my original

[R] Counting entries to create a new table

2011-11-01 Thread Empty Empty
Hi, I am an R novice and I am trying to do something that it seems should be fairly simple, but I can't quite figure it out and I must not be using the right words when I search for answers. I have a dataset with a number of individuals and observations for each day (7 possible codes plus

[R] Discrepancy with p.value from t.test

2011-11-01 Thread Jonathan Thayn
Sometimes the p.value returned by t.test() is the same that I calculate using pt() and sometimes it's not. I don't understand the difference. I'm sure there is a simple explanation but I haven't been able to find it, even after looking at the code for t.test.default. I apologize if this is a

[R] condition has length 1 for LL denominator

2011-11-01 Thread M. Tran
I have a dataset called results that looks like this: arrive depart intercept 11 1 12 1 13 1 12 2 13 2 13 3 22 2 23 2 33 3

[R] building a subscript programatically

2011-11-01 Thread Ernest Adrogué
Hi, On ocasion, you need to subscript an array that has an arbitrary (ie. not known in advance) number of dimensions. How do you deal with these situations? It appears that it is not possible use a list as an index, for instance this fails: x - array(NA, c(2,2,2)) x[list(TRUE,TRUE,2)] Error

[R] predict for a cv.glmnet returns an error

2011-11-01 Thread asafw
Hi there, I am trying to use predict() with an object returned by cv.glmnet(), and get the following error: no applicable method for 'predict' applied to an object of class cv.glmnet What's wrong? my code: x=matrix(rnorm(100*20),100,20) y=rnorm(100) cv.fit=cv.glmnet(x,y)

[R] Export to .txt

2011-11-01 Thread stat.kk
Hi, I would like to export all my workspace (even with the evaluation of commands) to the text file. I know about the sink() function but it doesnt work as I would like. My R-function looks like this: there are instructions for user displayed by cat() command and browser() commands for fulfilling

Re: [R] round up a number to 10^4

2011-11-01 Thread Dennis Murphy
Works in the newly released 2.14.0: X = c(60593.23, 71631.17, 75320.1) round(X, -4) [1] 6 7 8 Dennis On Tue, Nov 1, 2011 at 10:07 AM, Wendy wendy2.q...@gmail.com wrote: Hi all, I have a list of numbers, e.g., X = c(60593.23, 71631.17, 75320.1), and want to round them  so the

Re: [R] Export to .txt

2011-11-01 Thread Rich Shepard
On Tue, 1 Nov 2011, stat.kk wrote: I would like to export all my workspace (even with the evaluation of commands) to the text file. Have you looked at .Rhistory? If you save your workspace when you quit a session with R it's put in that file. You can always read it anywhere you have a text

Re: [R] Discrepancy with p.value from t.test

2011-11-01 Thread Peter Langfelder
On Tue, Nov 1, 2011 at 12:40 PM, Jonathan Thayn jth...@ilstu.edu wrote: Sometimes the p.value returned by t.test() is the same that I calculate using pt() and sometimes it's not. I don't understand the difference. I'm sure there is a simple explanation but I haven't been able to find it, even

Re: [R] Removal/selecting specific rows in a dataframe conditional on 2 columns

2011-11-01 Thread Dennis Murphy
Does this work? library('plyr') # Function to return a data frame if it has one row, else return NULL: f - function(d) if(nrow(d) == 1L) d else NULL ddply(RV09, .(set, month), f) record.t trip set month stratum NAFO unit.area time dur.set distance 15 913 110 351 3O

Re: [R] Counting entries to create a new table

2011-11-01 Thread Dennis Murphy
Hi: After cleaning up your data, here's one way using the plyr and reshape packages: d - read.csv(textConnection( Individual, A, B, C, D Day1, 1,1,1,1 Day2, 1,3,4,2 Day3, 3,,6,4), header = TRUE) closeAllConnections() d library('plyr') library('reshape') # Stack the variables dm - melt(d, id =

Re: [R] building a subscript programatically

2011-11-01 Thread Rolf Turner
On 02/11/11 11:14, Ernest Adrogué wrote: Hi, On ocasion, you need to subscript an array that has an arbitrary (ie. not known in advance) number of dimensions. How do you deal with these situations? It appears that it is not possible use a list as an index, for instance this fails: x-

Re: [R] How to interpret Spearman Correlation

2011-11-01 Thread Raphael Saldanha
Hi Shahab, This test shows that there is some positive statistical correlation, BUT the p-value of the test - this is, the level of significance - shows that the correlation is not statistically significant at 95% confidence level. So, the correlation may be equal to zero. To understand this

Re: [R] building a subscript programatically

2011-11-01 Thread Comcast
Leaving the indices empty should give you what I'm guessing you want/expect. x[,,2]#. TRUE would also work, just not in a list. David. On Nov 1, 2011, at 6:14 PM, Ernest Adrogué nfdi...@gmail.com wrote: Hi, On ocasion, you need to subscript an array that has an arbitrary (ie. not

Re: [R] predict for a cv.glmnet returns an error

2011-11-01 Thread Dennis Murphy
Hi: Here's what I got when I ran your code: library('glmnet') x=matrix(rnorm(100*20),100,20) y=rnorm(100) cv.fit=cv.glmnet(x,y) predict(cv.fit,newx=x[1:5,]) 1 [1,] 0.1213114 [2,] 0.1213114 [3,] 0.1213114 [4,] 0.1213114 [5,] 0.1213114 coef(cv.fit) 21 x 1 sparse Matrix of class

Re: [R] How to interpret Spearman Correlation

2011-11-01 Thread David Winsemius
Shahab; You would be well advised not to seek private tutoring from someone on the Internet who tells you that a p-value of 0.008736 is not significant. On Nov 1, 2011, at 8:09 PM, Raphael Saldanha saldanha.plan...@gmail.com wrote: Hi Shahab, This test shows that there is some positive

[R] Calling str() on mlogit object gives warnings

2011-11-01 Thread Jennifer Lyon
Hi: When I call str() on an mlogit object, I seem to get warnings. This code is from an example provided in the mlogit documentation: library(mlogit) data(Train, package=mlogit) tr-mlogit.data(Train, shape=wide, choice=choice, varying=4:11, sep=, alt.levels=c(1,2), id=id)

Re: [R] building a subscript programatically

2011-11-01 Thread David Winsemius
Yes,Ii did fail to read your post carefully and agree do.call seems roundabout, but alternatives look even more tortured. (You might want to include more context in the future.) On Nov 1, 2011, at 8:30 PM, Ernest Adrogué eadro...@gmx.net wrote: 1/11/11 @ 20:22 (-0400), Comcast escriu:

Re: [R] Export to .txt

2011-11-01 Thread David Winsemius
The if function only takes an argument of length 1 (as the warning says): ?if Many such confusions are resolved by looking at : ?ifelse -- David On Nov 1, 2011, at 7:22 PM, Rich Shepard rshep...@appl-ecosys.com wrote: On Tue, 1 Nov 2011, stat.kk wrote: I would like to export all my

Re: [R] Superimpose xversus y plot on a histogram of x

2011-11-01 Thread R. Michael Weylandt michael.weyla...@gmail.com
Plot doesn't create an object to be plotted later like in ggplot: rather it, by default, makes a new plot and erases the histogram. hist(z) lines(z, y, lwd = 1) should work, though you may need to add freq=FALSE to hist() MW On Nov 1, 2011, at 6:42 PM, Jim Silverton jim.silver...@gmail.com

Re: [R] condition has length 1 for LL denominator

2011-11-01 Thread David Winsemius
Posted to another thread a response to this posting ( and to all those who wanted R on an iPad, I say forget it - The if function only takes an argument of length 1 (as the warning says): ?if Many such confusions are resolved by looking at : ?ifelse -- David On Nov 1, 2011, at 4:45

Re: [R] Discrepancy with p.value from t.test

2011-11-01 Thread Albyn Jones
The print method is the issue: t.out - t.test(b1,b2,var.equal=T) t.out$p.value [1] 4.108001e-38 t.out$statistic t -15.93656 albyn On Tue, Nov 01, 2011 at 02:40:15PM -0500, Jonathan Thayn wrote: Sometimes the p.value returned by t.test() is the same that I calculate using pt()

Re: [R] condition has length 1 for LL denominator

2011-11-01 Thread jim holtman
will this do it: x - read.table(textConnection(arrive depart intercept + 11 1 + 12 1 + 13 1 + 12 2 + 13 2 + 13 3 + 22 2 + 23 2 + 33

Re: [R] building a subscript programatically

2011-11-01 Thread Dennis Murphy
Here's a hack, but perhaps you might want to rethink what type of output you want. # Function: g - function(arr, lastSubscript = 1) { n - length(dim(arr)) commas - paste(rep(',', n - 1), collapse = '') .call - paste('arr[', commas, lastSubscript, ']', sep = '') eval(parse(text =

[R] I really need help to merge two data frames

2011-11-01 Thread Tony
Hello, I need help getting two data sets to merge. The structure of my two data sets are: str(bcusip) 'data.frame': 1391 obs. of 3 variables: $ bond_id : Factor w/ 1391 levels AAGH,AAGI,..: 1 2 3 4 5 6 $ Freq: num 41361 4126 5206 10125 45536 ... $ CUSIP_ID: Factor w/ 1391 levels

Re: [R] building a subscript programatically

2011-11-01 Thread Ernest Adrogué
1/11/11 @ 20:22 (-0400), Comcast escriu: Leaving the indices empty should give you what I'm guessing you want/expect. x[,,2]#. TRUE would also work, just not in a list. Exactly, but this only works if x has three dimensions. What I want is x[,,2] if x has three dimensions, x[,,,2] if it

[R] Removing or ignoring package version for generic function in locked environment

2011-11-01 Thread Oliver Mannion (COMPASS)
Hi, I use the epicalc package which provides the function aggregate.numeric. Unfortunately aggregate.numeric produces warnings when aggregate is used by functions not under my control on a numeric value. If I don't load epicalc, aggregate.default is used instead by these functions and does not

Re: [R] building a subscript programatically

2011-11-01 Thread Ernest Adrogué
2/11/11 @ 13:10 (+1300), Rolf Turner escriu: On 02/11/11 11:14, Ernest Adrogué wrote: Hi, On ocasion, you need to subscript an array that has an arbitrary (ie. not known in advance) number of dimensions. How do you deal with these situations? It appears that it is not possible use a list

Re: [R] building a subscript programatically

2011-11-01 Thread Rolf Turner
On 02/11/11 13:43, Ernest Adrogué wrote: SNIP Sorry for not stating my problem in a more clear way. What I want is, given an array of n dimensions, overwrite it by iteratating over its outermost dimension... OK, in the previous example, I would like to do x- array(NA, c(2,2,2)) for (i in 1:2)

[R] using a file name in a system call

2011-11-01 Thread Erin Hodgess
Dear R People: I have a variable named file1 which contains the name of a file. I would like to copy that file to a different directory. Can I do that via the system command or is there a better way, please? Thanks, Erin -- Erin Hodgess Associate Professor Department of Computer and

[R] Using a file name in a system call

2011-11-01 Thread Erin Hodgess
Never mind...I used paste and all is well. sorry for the trouble. -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodg...@gmail.com __ R-help@r-project.org mailing

Re: [R] building a subscript programatically

2011-11-01 Thread Henrik Bengtsson
2011/11/1 Ernest Adrogué nfdi...@gmail.com: Hi, On ocasion, you need to subscript an array that has an arbitrary (ie. not known in advance) number of dimensions. How do you deal with these situations? It appears that it is not possible use a list as an index, for instance this fails: x -

Re: [R] Using a file name in a system call

2011-11-01 Thread Rolf Turner
On 02/11/11 15:45, Erin Hodgess wrote: Never mind...I used paste and all is well. sorry for the trouble. You *might* want to consider using file.rename() rather than system(). Dunno what the pro's and con's might be. Still have to use paste(), but! :-) cheers, Rolf

Re: [R] Export to .txt

2011-11-01 Thread R. Michael Weylandt
I'm somewhat confused on how you intend to use browser() after rerouting output to a sink Beyond that, how are you running your script? source() has some arguments that encourage it to say alot more to the sink() command. Michael On Tue, Nov 1, 2011 at 6:15 PM, stat.kk stat...@gmail.com

  1   2   >