Re: [R] Uncorrelated random vectors - Thank you!

2009-07-07 Thread Stein, Luba (AIM SE)
Thanks to all for the answers! I solved my problem now by sufficient iteration! Have a nice day! Luba __ 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-gu

Re: [R] SVM cross validation in e1071

2009-07-07 Thread Tao Shi
Hi Steve, Thanks for the pointer! After checking the source code myself, it's indeed the case. And of course, the training error is always better than the CV error. And this can be also checked if you vary the fold number in "cross", the "fitted" result is not changing. I wonder if the de

Re: [R] Decompose function : calculation of each component

2009-07-07 Thread wapita wapita
as tu lu l'article suggere dans l'aide: M. Kendall and A. Stuart (1983) The Advanced Theory of Statistics, Vol.3, Griffin, 410–414. > Date: Mon, 6 Jul 2009 13:22:17 -0700 > From: m.gha...@yahoo.fr > To: r-help@r-project.org > Subject: [R] Decompose function : calculation of each component >

Re: [R] i need same function solver in excel..

2009-07-07 Thread Gabor Grothendieck
Check out the Optimization Task View: http://cran.r-project.org/web/views/Optimization.html On Wed, Jul 8, 2009 at 12:00 AM, leecholho wrote: > > > thanks... > > i do homework..  my professor said , to use slover function in excel. > but i used R , so i want to find same function. > > question is

Re: [R] i need same function solver in excel..

2009-07-07 Thread leecholho
thanks... i do homework.. my professor said , to use slover function in excel. but i used R , so i want to find same function. question is " Max(x,y) x*E(R.a) + y*E(R.b)" , and x+y=1, E(R.a) and E(R.b) is average of the special data.. special data is this ---

[R] i need same function solver in excel..

2009-07-07 Thread leecholho
hi.. i used R a few days.. who can call me? same function solver in excel. _ [[elided Hotmail spam]] [[alternative HTML version deleted]] __ R-help@r-project.org mailing list htt

Re: [R] Density value over 1 using density function

2009-07-07 Thread Ben Bolker
Debabrata Midya wrote: > > > Dear R users, > > Thanks in advance. > > > > I am using R 2.9.1 on Windows XP. > > In the plot, the density value displays over 1. How can I explain it? > > library(urca) > plot(density(Raotbl1[, 1])) > > > It's a probability density, not a probabilit

Re: [R] Uncorrelated random vectors

2009-07-07 Thread Moshe Olshansky
As mentioned by somebody before, there is no problem for the normal case - use mvrnorm function from MASS package with any mu and make Sigma be any diagonal matrix (with strictly positive diagonal). Note that even though all the correlations are 0, the SAMPLE correlations won't be 0. If you wan

[R] Density value over 1 using density function

2009-07-07 Thread Debabrata Midya
Dear R users, Thanks in advance. I am using R 2.9.1 on Windows XP. In the plot, the density value displays over 1. How can I explain it? library(urca) plot(density(Raotbl1[, 1])) Once again, thank you very much for the time you have given. I am looking forward for your reply. Regar

Re: [R] ksvm question -- help! line search failed...

2009-07-07 Thread Steve Lianoglou
I guess this is going to be hard to debug w/o knowing more about your data. How big is your dataset? * How many observations? * How many predictors/features per observation? How many classes are in the data? Can you make a small reproducible example? Does your now cleaned data work w/ e1071

Re: [R] ksvm question -- help! line search failed...

2009-07-07 Thread Michael
I got the data working, but now I got another problem with KSVM: line search fails -2.793708 -0.5831701 1.870406e-05 -5.728611e-06 -5.059796e-08 -3.761822e-08 -7.308871e-13Error in prob.model(object)[[p]]$A : $ operator is invalid for atomic vectors On Tue, Jul 7, 2009 at 6:45 PM, Steve Lian

Re: [R] can't get rJava to install on Linux

2009-07-07 Thread Godmar Back
On Tue, Jul 7, 2009 at 10:07 PM, Mark Kimpel wrote: > Switching to Sun definitely did not help, still no build with rJava, > below is the output of  R CMD javareconf. You didn't switch. The paths /usr/lib/gcj-4.3.-90 etc. - any path containing 'gcj' - indicates you're using GNU's Java. It seems t

Re: [R] can't get rJava to install on Linux

2009-07-07 Thread Mark Kimpel
Switching to Sun definitely did not help, still no build with rJava, below is the output of R CMD javareconf. mkimpel-m90 /home/mkimpel/bin# ./R CMD javareconf *** JAVA_HOME is not a valid path, ignoring Java interpreter : /usr/bin/java Java version : 1.6.0_14 Java home path : /usr/lib/jvm/

Re: [R] Question in using e1071 svm routine

2009-07-07 Thread Steve Lianoglou
Hi, On Jul 7, 2009, at 8:37 PM, Stavros Macrakis wrote: Isn't the initial value of the variable T equal to the constant TRUE? So unless he's modified the value of T, shouldn't it work? Yes, it should. Perhaps we should be looking at your data: model <- svm(y=factor(mytraindata[, 1]), x=myt

Re: [R] ksvm question -- help! cannot get program to run...

2009-07-07 Thread Steve Lianoglou
Hi, On Jul 7, 2009, at 6:44 PM, Michael wrote: What's wrong? Very sad about this... model <- ksvm(x=mytraindata[, -1], y=factor(mytraindata[, 1]), prob.model=T) Error in .local(x, ...) : x and y don't match. Same problem you're having with the svm in e1071: I bet your data is wonky. s

Re: [R] can't get rJava to install on Linux

2009-07-07 Thread Godmar Back
This is just a guess: looks like you have GNU's Java version in your path (aka "gcj"). Perhaps rJava relies on Sun's Java version. If so, install Sun's Java first. apt-get install sun-java6-jdk might do it. - Godmar On Tue, Jul 7, 2009 at 9:28 PM, Mark Kimpel wrote: > Having difficulties getti

Re: [R] SVM cross validation in e1071

2009-07-07 Thread Steve Lianoglou
Hi Tao, On Jul 7, 2009, at 8:33 PM, Tao Shi wrote: Hi list, Could someone help me to explain why the leave-one-out cross validation results I got from svm using the internal option "cross" are different from those I got manually? It seems using "cross" to do cross validation, the result

[R] can't get rJava to install on Linux

2009-07-07 Thread Mark Kimpel
Having difficulties getting rJava to install on my Debian Squeeze box. Perused the R-help list and tried some things that have worked for others but not for me. Below is the output of my attempted build, R CMD javareconf -e, and sessionInfo(). Note I tried the R CMD javareconf also as root, restart

Re: [R] Question in using e1071 svm routine

2009-07-07 Thread Stavros Macrakis
Isn't the initial value of the variable T equal to the constant TRUE? So unless he's modified the value of T, shouldn't it work? -s On 7/7/09, Max Kuhn wrote: > Unlike Splus, R does not use T for TRUE. > > On Tue, Jul 7, 2009 at 6:05 PM, Michael wrote: >> Hi all, >> >> I've got the fo

Re: [R] wordStem problems in R 2.9, Fedora 11; Linux Kernel 2.6.29.5-191.fc11.i586

2009-07-07 Thread Duncan Temple Lang
Hi Rene Can you tell us the version of the Rstem package you installed. Rstem_0.3-1 from http://www.omegahat.org/Rstem/ or install.packages("Rstem", repos = "http://www.omegahat.org/R";) work fine for me. I seem to recall this being a problem with an older version of Rstem.

[R] SVM cross validation in e1071

2009-07-07 Thread Tao Shi
Hi list, Could someone help me to explain why the leave-one-out cross validation results I got from svm using the internal option "cross" are different from those I got manually? It seems using "cross" to do cross validation, the results are always better. Please see the code below. I also

Re: [R] Counting the number of cycles in a temperature test

2009-07-07 Thread Moshe Olshansky
Hi Antje, Are your measurements taken every minute (i.e. 30 minutes correspond to 30 consecutive values)? How fast is your transition? If you had 30 minures of upper temperature, then 1000 minutes of room temperature and then 30 minutes of lower temperature - would you count this as a cycle? C

Re: [R] Question in using e1071 svm routine

2009-07-07 Thread Max Kuhn
Unlike Splus, R does not use T for TRUE. On Tue, Jul 7, 2009 at 6:05 PM, Michael wrote: > Hi all, > > I've got the following error message in using e1071 svm routine... > > Could anybody please help me? > > Thank you! > > - > model <- svm(y=factor(mytraindata[, 1]),

Re: [R] Error in Rolling window of function - rollapply

2009-07-07 Thread Gabor Grothendieck
Your excel calculation does not correspond to your rollapply call. rollapply(x, k, f) should have length(x) - k + 1 elements so in this case it should have 37 - 20 + 1 = 18. To take a simpler example, > rollapply(zoo(1:5), 3, sum) 2 3 4 6 9 12 This has 5 - 3 + 1 = 3 elements and the result

Re: [R] r-project.org address blacklisted by anti-spam software

2009-07-07 Thread Ted Harding
On 07-Jul-09 21:59:41, Hans W Borchers wrote: > Dear List: > An e-mail mentioning the r-project.org address and sent to a friend > at a German university was considered spam by the local spam filter. > > Its reasoning: the URL "r-project.org" is blacklisted at > uribl.swinog.ch resp. > at antispam

Re: [R] ReShape to create Time from Observations?

2009-07-07 Thread jim holtman
Does something like this work for you; it uses the reshape package: > X<-data.frame(A=1:10, B=0, C=1, Ob1=1:10, Ob2=2:11, Ob3=3:12, + Ob4=4:13, Ob5=3:12, Ob6=2:11) > Y<-data.frame(A=1:20, B=0, C=1, D=5, Ob1=1:10, Ob2=2:11, Ob3=3:12, + Ob4=4:13, Ob5=3:12, Ob6=2:11, Ob7=5:9) > Z<-data.frame(A=1:30,

Re: [R] Numbering sequences of non-NAs in a vector

2009-07-07 Thread Krishna Tateneni
Many thanks to all who responded, and especially for the promptness of your answers. The common thread in your solutions is the use of rle, a very useful function of which I was ignorant. --Krishna [[alternative HTML version deleted]] __ R-hel

Re: [R] how to read point shp file to R?

2009-07-07 Thread Kingsford Jones
Assuming you are referring to ESRI shapefiles, options can be found in the following packages: maptools, rgdal, and shapefiles See the Spatial Task View for more info: http://cran.r-project.org/web/views/Spatial.html hth, Kingsford On Tue, Jul 7, 2009 at 12:28 PM, Sunny wrote: > I am new with R

[R] How to re-order panels and y-axis values in trellis display using lattice

2009-07-07 Thread Peter_Kappes
Hi, I have been trying to re-order several items in a trellised barchart display in lattice, but can't seem to figure it out. ###sample code, Stage and Colony have 2 and 3 levels respectively. barchart(Activity ~ Percent | Stage + Colony, data = Percent.df, horizontal = TRUE, layout = c(2,3),

[R] ksvm question -- help! cannot get program to run...

2009-07-07 Thread Michael
What's wrong? Very sad about this... model <- ksvm(x=mytraindata[, -1], y=factor(mytraindata[, 1]), prob.model=T) Error in .local(x, ...) : x and y don't match. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] Dump plots to powerpoint?

2009-07-07 Thread Ben Bolker
Why not directly generate a large PNG file (which will be much better for line art than JPG anyway)? Or EMF? See http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:export [Of course, this doesn't answer the original question ... to which I suspect the answer is "no".] Mark

Re: [R] r-project.org address blacklisted by anti-spam software

2009-07-07 Thread John Kane
--- On Tue, 7/7/09, Duncan Murdoch wrote: > From: Duncan Murdoch > Subject: Re: [R] r-project.org address blacklisted by anti-spam software > To: "Hans W Borchers" > Cc: r-h...@stat.math.ethz.ch > Received: Tuesday, July 7, 2009, 6:15 PM > On 07/07/2009 5:59 PM, Hans W > Borchers wrote: > >

Re: [R] r-project.org address blacklisted by anti-spam software

2009-07-07 Thread Mark Knecht
On Tue, Jul 7, 2009 at 3:15 PM, Duncan Murdoch wrote: > On 07/07/2009 5:59 PM, Hans W Borchers wrote: >> >> Dear List: >> >> An e-mail mentioning the r-project.org address and sent to a friend at a >> German >> university was considered spam by the local spam filter. >> >> Its reasoning: the URL "r

[R] Tex fonts in R plots

2009-07-07 Thread KARAVASILIS GEORGE
Hello, R users. I would like to display the font of Math Mode of MikTex 2.3, WinEdt 5.4 in R plots, e.g. in xlab, ylab or legend. How can I do that? Thank you in advance. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-hel

Re: [R] r-project.org address blacklisted by anti-spam software

2009-07-07 Thread Duncan Murdoch
On 07/07/2009 5:59 PM, Hans W Borchers wrote: Dear List: An e-mail mentioning the r-project.org address and sent to a friend at a German university was considered spam by the local spam filter. Its reasoning: the URL "r-project.org" is blacklisted at uribl.swinog.ch resp. at antispam.imp.ch. I

Re: [R] odfWeave: odt-file damaged

2009-07-07 Thread ukoenig
Hi, I think, I can answer my own posting. I found out, that the directory structure of the ODT-file created by "odfWeave" causes the error message. The file structure of the unzipped odt-file looks like this: Pictures content_1-Boxplot.png content.xml current.xml manifest.xml meta.xml

Re: [R] building 2.0.6 on Win32/Py2.5

2009-07-07 Thread Chuck White
My sincere apologies. This message was intended for the rpy2 mailing list. Thanks. Uwe Ligges wrote: > Which previous message? Should we all look up the archives now? Please > cite and stay within the same thread. > > Thank you, > Uwe LIgges > > > > > > Chuck White wrote: > > After

[R] Question in using e1071 svm routine

2009-07-07 Thread Michael
Hi all, I've got the following error message in using e1071 svm routine... Could anybody please help me? Thank you! - model <- svm(y=factor(mytraindata[, 1]), x=mytraindata[, -1], probability=T) Error in if (any(co)) { : missing value where TRUE/FALSE needed In a

[R] wordStem problems in R 2.9, Fedora 11; Linux Kernel 2.6.29.5-191.fc11.i586

2009-07-07 Thread Reitsma, Rene - COB
Dear All, I just updated from Fedora 9 to Fedora 11, kernel version 2.6.29.5-191.fc11.i586. I'm running R 2.9. I successfully installed package Rstem from source (it always ran fine for me in F9). However: > wordStem(c("This","is","a","test")) Error in wordStem(c("This", "is", "a", "test")) :

[R] r-project.org address blacklisted by anti-spam software

2009-07-07 Thread Hans W Borchers
Dear List: An e-mail mentioning the r-project.org address and sent to a friend at a German university was considered spam by the local spam filter. Its reasoning: the URL "r-project.org" is blacklisted at uribl.swinog.ch resp. at antispam.imp.ch. I checked the list http://antispam.imp.ch/swi

Re: [R] Numbering sequences of non-NAs in a vector

2009-07-07 Thread Marc Schwartz
On Jul 7, 2009, at 4:08 PM, Krishna Tateneni wrote: Greetings, I have a vector of the form: [10,8,1,3,0,8,NA,NA,NA,NA,2,1,6,NA,NA,NA,0,5,1,9...] That is, a combination of sequences of non-missing values and missing values, with each sequence possibly of a different length. I'd like to cr

Re: [R] Numbering sequences of non-NAs in a vector

2009-07-07 Thread Stavros Macrakis
Here's one possibility: vv <- c(10,8,1,3,0,8,NA,NA,NA,NA,2,1,6,NA,NA,NA,0,5,1,9) > (1+cumsum(diff(is.na(c(vv[1],vv)))==1)) * !is.na(vv) [1] 1 1 1 1 1 1 0 0 0 0 2 2 2 0 0 0 3 3 3 3 On Tue, Jul 7, 2009 at 5:08 PM, Krishna Tateneni wrote: > Greetings, I have a vector of the form: > [10,8,1,3,0,

[R] R2WinBUGS under Linux/WINE fails

2009-07-07 Thread Harlan Harris
Hi, I'm running wine-1.0.1, OpenBUGS 3.0.3, R 2.9.0, and R2WinBUGS on a Redhat Enterprise Linux machine. Following various peoples' suggestions... This works perfectly (yay!): wine Z:/opt/OpenBUGS/winbugs.exe Within R, however, I get this: (setup the example from ?bugs, then) R> schools.s

Re: [R] Numbering sequences of non-NAs in a vector

2009-07-07 Thread Jorge Ivan Velez
Dear Krishna, Here is one way. It is not very elegant, but seems to work: # x is the vector you want to change foo <- function(x){ R1 <- rle(!is.na(x)) R2 <- rle(is.na(x)) len <- R1$lengths[!R2$values] x[!is.na(x)] <- rep(1:length(len), len) x } # Example x <- c(10, 8, 1, 3, 0, 8

[R] ReShape to create Time from Observations?

2009-07-07 Thread Mark Knecht
Here is a couple of very simple data.frames: X<-data.frame(A=1:10, B=0, C=1, Ob1=1:10, Ob2=2:11, Ob3=3:12, Ob4=4:13, Ob5=3:12, Ob6=2:11) Y<-data.frame(A=1:20, B=0, C=1, D=5, Ob1=1:10, Ob2=2:11, Ob3=3:12, Ob4=4:13, Ob5=3:12, Ob6=2:11, Ob7=5:9) Z<-data.frame(A=1:30, B=0, C=1, D=6, E=1:2, Ob1=1:10, O

Re: [R] how to count number of elements in a vector that are not NA ?

2009-07-07 Thread Giovanni Petris
sum(!is.na(x)) > Date: Tue, 07 Jul 2009 14:56:54 -0400 > From: Godmar Back > Sender: r-help-boun...@r-project.org > Precedence: list > DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; > DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; > > Hi, > > is th

Re: [R] building 2.0.6 on Win32/Py2.5

2009-07-07 Thread Uwe Ligges
Which previous message? Should we all look up the archives now? Please cite and stay within the same thread. Thank you, Uwe LIgges Chuck White wrote: After I posted the previous message, I repeated the process on a windows machine with Python 2.6 and still get the same error. I would app

Re: [R] Dump plots to powerpoint?

2009-07-07 Thread Mark Wardle
I generate PDF images and then rasterise using imagemagick to large, high quality JPG files. Then manually insert into powerpoint. Former two can definitely be automated, I'm sure the latter insertion could be automated with judicious use of scripting if really necessary. 2009/7/7 Thomas : > Hi, >

Re: [R] object ".trPaths" not found

2009-07-07 Thread Uwe Ligges
I have to admit that I have no idea what we are talking about here (yes, I tend to forget many things these days) - and you have not cited the original message, unfortunately (nor have you specifies R versions, Tinn-R versions and both OS versions, but just one) ... Best wishes, Uwe Knut K

[R] Numbering sequences of non-NAs in a vector

2009-07-07 Thread Krishna Tateneni
Greetings, I have a vector of the form: [10,8,1,3,0,8,NA,NA,NA,NA,2,1,6,NA,NA,NA,0,5,1,9...] That is, a combination of sequences of non-missing values and missing values, with each sequence possibly of a different length. I'd like to create another vector which will help me pick out the sequences

Re: [R] subscripted assignment of grid units

2009-07-07 Thread Paul Murrell
Hi You have encountered the fact that, while there are "[" methods for grid unit objects, there are NOT any "[<-" methods for grid unit objects. I guess that needs to go (back) onto my todo list. A workaround for your simple example is ... unit.c(testUnits[1:2], testUnit2, testUnits[4:5]) .

[R] Dump plots to powerpoint?

2009-07-07 Thread Thomas
Hi, Is it possible to dump a series of plots directly into a powerpoint presentation (as is possible in Splus)? Thank you, Thomas [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/

[R] building 2.0.6 on Win32/Py2.5

2009-07-07 Thread Chuck White
After I posted the previous message, I repeated the process on a windows machine with Python 2.6 and still get the same error. I would appreciate any help. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] Uncorrelated random vectors

2009-07-07 Thread Giovanni Petris
Here is one way: > x <- rnorm(100) > y <- rnorm(100) > z <- residuals(lm(y ~ x)) > cor(x, z) [1] 3.610290e-17 Best, Giovanni > Date: Tue, 07 Jul 2009 16:26:02 +0200 > From: "Stein, Luba (AIM SE)" > Sender: r-help-boun...@r-project.org > Accept-Language: en-US, de-DE > Precedence: list > Thread

Re: [R] Test for X=1 fails, test for >0 works, data in text file is 1

2009-07-07 Thread William Dunlap
subset(), like many R methods, has an argument list that ends with '...', meaning that it will not tell you that an argument you gave it by name= is not in the official list of arument names. If the ... were not there then you would have gotten an error message. E.g., the following makes a version

Re: [R] Solving quadratic equations with covariance term

2009-07-07 Thread Giovanni Petris
It is not clear to me whether you are talking about a covariance (a theoretical quantity depending on the distribution of A and x) or an empirical covariance, estimated from some data. In the first case you don't need to solve anything because, as long as A is fixed, i.e. non-random, its covaria

Re: [R] vectorizing a function

2009-07-07 Thread Bert Gunter
?ifelse Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Steve Jaffe Sent: Tuesday, July 07, 2009 12:42 PM To: r-help@r-project.org Subject: [R] vectorizing a function I'm sure I'm mi

[R] Error in Rolling window of function - rollapply

2009-07-07 Thread Andriy Fetsun
Dear Colleagues, I have faced with the problem that function rollaply with rolling window for calculation of volatility doesn't give the all results of calculations. I have run the rolling window for calculation in Excel and obtained that the number of outputs for Excel is 36 and for R is 18. The

Re: [R] vectorizing a function

2009-07-07 Thread Greg Snow
For this case it is quite simple, see ?ifelse > z <- ifelse( x > 0, y, -y ) Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun.

Re: [R] how to count number of elements in a vector that are not NA ?

2009-07-07 Thread Zhiliang Ma
how about sum(!is.na(x)) ? On Tue, Jul 7, 2009 at 2:56 PM, Godmar Back wrote: > Hi, > > is there a simpler way to count the number of elements in a vector > that are not NA than this: > > countN <- function (v) { >    return (Reduce(function (x, y) x + y, ifelse(is.na(v), 0, 1))) > } > > ? > >  -

Re: [R] vectorizing a function (NEVERMIND)

2009-07-07 Thread Steve Jaffe
Nevermind, indeed it is obvious: Vectorize ! Steve Jaffe wrote: > > I'm sure I'm missing something obvious but I'm not seeing how to simply > "vectorize" a function of two or more variables. > -- View this message in context: http://www.nabble.com/vectorizing-a-function-tp24380064p24380136

[R] vectorizing a function

2009-07-07 Thread Steve Jaffe
I'm sure I'm missing something obvious but I'm not seeing how to simply "vectorize" a function of two or more variables. Say I have f <- function(x,y) if (x>0) y else -y Now I have vectors x and y of equal length and I'd like to apply f element-wise. I.e. conceptually z <- f(x,y) where x, y, z

Re: [R] find duplicates... need help!

2009-07-07 Thread Jorge Ivan Velez
Dear njhuang86, Here is one way: x <- c('a', 't', 'c', 'y', 'g') y <- c('a', 'a', 'g', 's') table(factor(y, levels = x)) # a t c y g # 2 0 0 0 1 HTH, Jorge On Tue, Jul 7, 2009 at 3:28 PM, njhuang86 wrote: > > Hi all, > Suppose I have x = c('a', 't', 'c', 'y', 'g') > and also y = c('a', 'a',

Re: [R] Test for X=1 fails, test for >0 works, data in text file is 1

2009-07-07 Thread Mark Knecht
On Tue, Jul 7, 2009 at 12:17 PM, Henrique Dallazuanna wrote: > Try this: > > MyResults.GroupA <- subset(MyResults, PosType == 1) > > Darn those small screen fonts. I never noticed that! Every example I'm looking at jsut looks like a single '=' until you pointed it out! Thanks to everyone who res

Re: [R] how to count number of elements in a vector that are not NA ?

2009-07-07 Thread Godmar Back
Thank you for the many replies! This is really a very friendly and helpful community! On Tue, Jul 7, 2009 at 3:06 PM, Henrique Dallazuanna wrote: > another option should be: > > length(na.omit(v)) > I think the above is what I was looking for since, presumably, it uses the very same test as other

Re: [R] Test for X=1 fails, test for >0 works, data in text file

2009-07-07 Thread Ted Harding
On 07-Jul-09 19:06:59, Mark Knecht wrote: > Hi, >I am apparently not understanding some nuance about either the use > of subset or more likely my ability to test for a numerical match > using '='. Which is it? Thanks in advance. It looks as though you have tripped over the distinction between

[R] find duplicates... need help!

2009-07-07 Thread njhuang86
Hi all, Suppose I have x = c('a', 't', 'c', 'y', 'g') and also y = c('a', 'a', 'g', 's') If I do something like x%in%y, I obtain a vector like this: [TRUE, FALSE, FALSE, FALSE, TRUE] which I can easily turn into this: [1, 0, 0, 0, 1]. I was wondering is there anyway for me to get a vector back in

Re: [R] how to count number of elements in a vector that are not NA ?

2009-07-07 Thread David Huffer
On Tuesday, July 07, 2009 3:20 PM, Godmar Back wrote: > ...That would be wrong, wouldn't it, if the > other replies are correct Yes. It was wrong. This isn't: countN <- function ( v ) { length ( v ) - sum ( is.na ( v ) ) } But there are really tons of ways to do it. Even your

Re: [R] Test for X=1 fails, test for >0 works, data in text file is 1

2009-07-07 Thread Duncan Murdoch
On 7/7/2009 3:06 PM, Mark Knecht wrote: Hi, I am apparently not understanding some nuance about either the use of subset or more likely my ability to test for a numerical match using '='. Which is it? Thanks in advance. I've read a data file, reshaped it and then created MyResults by keepi

Re: [R] Test for X=1 fails, test for >0 works, data in text file is 1

2009-07-07 Thread Jorge Ivan Velez
Hi Mark, X = 1 assings the number 1 to X whereas X == 1 test if X is equal to 1. I suspect you want to do this :-) Here is an example: # R code X = 1 X # [1] 1 X == 1 # [1] TRUE HTH, Jorge On Tue, Jul 7, 2009 at 3:06 PM, Mark Knecht wrote: > Hi, > I am apparently not understanding s

Re: [R] Test for X=1 fails, test for >0 works, data in text file is 1

2009-07-07 Thread Henrique Dallazuanna
Try this: MyResults.GroupA <- subset(MyResults, PosType == 1) On Tue, Jul 7, 2009 at 4:06 PM, Mark Knecht wrote: > Hi, > I am apparently not understanding some nuance about either the use > of subset or more likely my ability to test for a numerical match > using '='. Which is it? Thanks in

Re: [R] how to count number of elements in a vector that are not NA ?

2009-07-07 Thread David Huffer
How about countN <- function ( v ) { sum ( !is.na ( v ) ) - sum ( is.na ( v ) ) } -- David   - David Huffer, Ph.D. Senior Statistician CSOSA/Washington, DC david.huf...@csosa.gov --

[R] Test for X=1 fails, test for >0 works, data in text file is 1

2009-07-07 Thread Mark Knecht
Hi, I am apparently not understanding some nuance about either the use of subset or more likely my ability to test for a numerical match using '='. Which is it? Thanks in advance. I've read a data file, reshaped it and then created MyResults by keeping only lines where the value column is gr

Re: [R] how to count number of elements in a vector that are not NA ?

2009-07-07 Thread Henrique Dallazuanna
another option should be: length(na.omit(v)) On Tue, Jul 7, 2009 at 3:56 PM, Godmar Back wrote: > Hi, > > is there a simpler way to count the number of elements in a vector > that are not NA than this: > > countN <- function (v) { >return (Reduce(function (x, y) x + y, ifelse(is.na(v), 0, 1

Re: [R] how to count number of elements in a vector that are not NA ?

2009-07-07 Thread Jorge Ivan Velez
Dear Godmar, Yes. One way would be sum( !is.na( yourvector ) ) HTH, Jorge On Tue, Jul 7, 2009 at 2:56 PM, Godmar Back wrote: > Hi, > > is there a simpler way to count the number of elements in a vector > that are not NA than this: > > countN <- function (v) { >return (Reduce(function (x

[R] how to count number of elements in a vector that are not NA ?

2009-07-07 Thread Godmar Back
Hi, is there a simpler way to count the number of elements in a vector that are not NA than this: countN <- function (v) { return (Reduce(function (x, y) x + y, ifelse(is.na(v), 0, 1))) } ? - Godmar __ R-help@r-project.org mailing list https://s

Re: [R] Quantitative Risk Management by McNeil

2009-07-07 Thread spencerg
Dear Andriy: 1. The help file for "fit.NH" says the first argument should be a "vector of data". Consider the following modification of the example on that help page: > rs <- matrix(rseries, 10, 202, dimnames=list(letters[1:10], 1:202)) > rs. <- fit.NH(rs) Error: cannot allocate

Re: [R] object ".trPaths" not found

2009-07-07 Thread Knut Krueger
Uwe Ligges schrieb: Maybe, but the may depend on your "script", your OS, your R version, used packages and so on. Hence please read and follow the posting guide and provide commented, minimal, self-contained, reproducible code. Hi Uwe, I was just asked the same question and hat the same

[R] how to read point shp file to R?

2009-07-07 Thread Sunny
I am new with R and want do some analysis with a point vector data file. Any help is appreciate. Sunny [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the pos

Re: [R] Error due to non-conformable arrays

2009-07-07 Thread Jorge Ivan Velez
Hi spime, What is "x"? Did you have any other "X" defined in your R-session? Be aware that R is case-sensitive. Best, Jorge On Tue, Jul 7, 2009 at 1:30 PM, spime wrote: > > Hello, > > Consider this function for generalized ridge regression: > > gre <- function (X,y,D){ >n <- dim(X)[1]

Re: [R] Error due to non-conformable arrays

2009-07-07 Thread David Winsemius
Incomplete code leaves us able to do naught but guess; Perhaps you are unaware that x != X -- DW On Jul 7, 2009, at 1:30 PM, spime wrote: Hello, Consider this function for generalized ridge regression: gre <- function (X,y,D){ n <- dim(X)[1] p <- dim(X)[2] interce

Re: [R] Error due to non-conformable arrays

2009-07-07 Thread Henrique Dallazuanna
I think that is because X in your function has (n + 1) columns and D with only n coluimns: matrix(1:9, ncol = 3) + matrix(1:8, ncol = 2) On Tue, Jul 7, 2009 at 2:30 PM, spime wrote: > > Hello, > > Consider this function for generalized ridge regression: > > gre <- function (X,y,D){ >n <

[R] Error due to non-conformable arrays

2009-07-07 Thread spime
Hello, Consider this function for generalized ridge regression: gre <- function (X,y,D){ n <- dim(X)[1] p <- dim(X)[2] intercept <- rep(1, n) X <- cbind(intercept, X) X2D <- crossprod(X,X)+ D Xy <- crossprod(X,y) bth <- qr.solve(

Re: [R] how to get R to print only one column per line when outputting a matrix?

2009-07-07 Thread Godmar Back
On Tue, Jul 7, 2009 at 1:22 PM, Godmar Back wrote: > >> apply(AA, c(2,1), cat, "\n") > Error in cat(list(...), file, sep, fill, labels, append) : >  argument 1 (type 'list') cannot be handled by 'cat' > ps: but your idea of using 'apply' led me to this: > dummy <- apply(AA, c(2), function (r) {

Re: [R] how to get R to print only one column per line when outputting a matrix?

2009-07-07 Thread Godmar Back
On Tue, Jul 7, 2009 at 12:20 PM, David Winsemius wrote: > It looks like you are printing a matrix and that you want to print all rows > of the first column before all rows of the second column. Apply should do > it. Assume the matrix is named "AA" > > apply(AA, c(2,1), cat, "\n")   # the \n is the

Re: [R] cor vs cor.test

2009-07-07 Thread Godmar Back
Thanks, Peter. You're right, I mistyped and getOption('na.action') shows na.omit. Perhaps my question was more commentary about my perceived lack of rationale and orthogonality in R than it should have been. Presumably, q[[i]] is a data frame and q[[i]][,1] is a numeric vector, so cor and cor.tes

[R] error: no such index at level 2

2009-07-07 Thread Godmar Back
Hi, I am confused about how to select elements from a list. I'm trying to select all rows of a table 'crossRsorted' such that the mean of a related vector is > 0. The related vector is accessible as a list element l[[i]] where i is the row index. I thought this would work: > crossRsorted[mean(

[R] Thanks!

2009-07-07 Thread Mark Knecht
Hi all, I just wanted to send a general word of thanks to the list for making my first week using R successful (by my measures) and reasonably pleasurable. (Not a single literal RTFM!) ;-) I appreciate all the help I've received from folks. I have a long way to go but I'm starting to get dat

Re: [R] how to get R to print only one column per line when outputting a matrix?

2009-07-07 Thread David Winsemius
It looks like you are printing a matrix and that you want to print all rows of the first column before all rows of the second column. Apply should do it. Assume the matrix is named "AA" apply(AA, c(2,1), cat, "\n") # the \n is the line-feed character -- DW On Jul 7, 2009, at 10:06 AM, Go

Re: [R] Uncorrelated random vectors

2009-07-07 Thread Greg Snow
Here are some examples that may get you started (note that there is no guarantee that a variable follows a given distribution after it has been adjusted to have 0 correlation with another variable): library(MASS) tmp <- mvrnorm(25, c(0,0), diag(2), empirical=TRUE) zapsmall(cor(tmp)) tmp2 <- exp

Re: [R] Mathematical annotation axis in lattice

2009-07-07 Thread Paul Hiemstra
Hi Albart, This bugged me also for quite some time. After some experiments the following syntax worked best: library(lattice) a = 0.11 xyplot(1:10~10:11, xlab = as.expression(bquote(R^2~" equals "~.(a With the combination of as.expression and bquote you can mix text, math expression and

Re: [R] Solving quadratic equations with covariance term

2009-07-07 Thread Charles C. Berry
On Tue, 7 Jul 2009, Stein, Luba (AIM SE) wrote: Hi, more precisely I consider a matrix with three column vectors a_i (i=1,2,3), i.e. A=(a_1,a_2,a_3). On the other hand x should take vectors as values, i.e. x=v_j, while j goes also from 1 till 3. Now I just want to calculate the equation Cov(a

Re: [R] Uncorrelated random vectors

2009-07-07 Thread Ted Harding
Be careful to be clear what you are referring to when you say "correlation is zero". The commands x <- rnorm(100) y <- rnorm(100) will produce two vectors of given length (100) which (to within the effectively ignorable limitations of the ransom number generator) will have been produced indepe

Re: [R] cor vs cor.test

2009-07-07 Thread Peter Ehlers
?cor says that cor() can be applied to 'numeric vector, matrix or data frame' ?cor.test requires 'numeric vectors of data values' So, what's your q? As to na.action: ?cor.test makes no reference to na.action for the default method. Looking at the code of cor.test.default shows that only compl

Re: [R] bigglm() results different from glm()+Another question

2009-07-07 Thread Greg Snow
How many rows does xx have? Let's look at your example for chunksize 1, you initially fit the first 1 observations, then the seq results in just the value 1 which means that you do the update based on vaues 10001 through 2, if xx only has 1 rows, then this should give at lea

Re: [R] Uncorrelated random vectors

2009-07-07 Thread Andrew Dolman
You could use the mvtnorm package to generate correlated vectors of random normal deviates where the nominal correlation is 0. library(mvtnorm) rho <- 0.0 Cor <- array(c(1, rho, rho, 1), dim=c(2,2)) Y <- rmvnorm(1000, sigma=Cor) plot(Y) cor(Y) cor.test(Y[,1],Y[,2]) Any given random set will hav

Re: [R] Uncorrelated random vectors

2009-07-07 Thread Stein, Luba (AIM SE)
Thank you for your help! But is it possible to produe two vectors x and y with a given length such that there correlation is zero. For me ist not enough just to simulate two vectors with there correlation. Thank you, Luba -Urspr?ngliche Nachricht- Von: ONKELINX, Thierry [mailto:thie

[R] cor vs cor.test

2009-07-07 Thread Godmar Back
Hi, I am trying to use R for some survey analysis, and need to compute the significance of some correlations. I read the man pages for cor and cor.test, but I am confused about - whether these functions are intended to work the same way - about how these functions handle NA values - whether cor.t

Re: [R] Multiplication of data frame with vector

2009-07-07 Thread Stein, Luba (AIM SE)
Thank you for your help! But is it possible to produe two vectors x and y with a given length such that there correlation is zero. For me ist not enough just to simulate two vectors with there correlation. Thank you, Luba -Urspr?ngliche Nachricht- Von: r-help-boun...@r-project.org

Re: [R] Testing memory limits in R??

2009-07-07 Thread Scott Zentz
Hey Whit, That worked! I was able to consume all the memory on the server! Thanks! -scz Whit Armstrong wrote: > Seems strange. I can go all the way up to 50GB on our machine which > has 64GB as well. It starts swapping after that, so I killed the > process. > > try this: > ans <- list() >

  1   2   >