Re: [R] Nested for loops

2009-07-14 Thread Daniel Nordlund
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Michael Knudsen Sent: Monday, July 13, 2009 10:39 PM To: r-help@r-project.org Subject: [R] Nested for loops Hi, I have spent some time locating a quite subtle (at least in

Re: [R] Nested for loops

2009-07-14 Thread Moshe Olshansky
Make it for (i in 1:9) This is not the general solution, but in your case when i=10 you do not want to do anything. --- On Tue, 14/7/09, Michael Knudsen micknud...@gmail.com wrote: From: Michael Knudsen micknud...@gmail.com Subject: [R] Nested for loops To: r-help@r-project.org Received:

Re: [R] Nested for loops

2009-07-14 Thread Michael Knudsen
On Tue, Jul 14, 2009 at 8:03 AM, Moshe Olshanskym_olshan...@yahoo.com wrote: Make it for (i in 1:9) Thanks. That's also how I solved the problem myself. I just somehow think it makes my code look rather clumsy and opaque. Maybe I just have to get used to this kind of nasty tricks. This is

Re: [R] Nested for loops

2009-07-14 Thread Michael Knudsen
On Tue, Jul 14, 2009 at 8:20 AM, Michael Knudsenmicknud...@gmail.com wrote: What do you mean? It looks a like a very general solution to me. Just got an email suggesting using the functions col and row. For example temp = matrix(c(1:36),nrow=6) which(col(temp)row(temp)) This gives the indices

Re: [R] averaging two matrices whilst ignoring missing values

2009-07-14 Thread Bill.Venables
Another (also somewhat inelegant) way to do this might be as follows. First write a small function to replace missing values by zeros: zNA - function(X) { X[is.na(X)] - 0; X} Now testAve - (zNA(test) + zNA(test2))/(2 - is.na(test) - is.na(test2)) If you are unlucky enough to have missing

[R] Cluster analysis with missing data

2009-07-14 Thread Hollix
Hi folks, I tried for the first time hclust. Unfortunately, with missing data in my data file, it doesn't seem to work. I found no information about how to consider missing data. Omission of all missings is not really an option as I would loose to many cases. Thanks in advance Holger -- View

Re: [R] \dQuote in packages

2009-07-14 Thread Uwe Ligges
Rebecca Sela wrote: Thank you! (That was easy to fix.) How does one deal with quoting (in \reference)? The following line causes problems: \references{Sela, Rebecca J., and Simonoff, Jeffrey S., \dQuote{RE-EM Trees: A New Data Mining Approach for Longitudinal Data}.} The error given is:

Re: [R] nls - find good starting values

2009-07-14 Thread Bill.Venables
It is not at all clear what you are trying to do. Fitting a gaussian distribution is the simplest problem in all of statistics: the sample mean and sample variance (divisor n) are the mle's of the two parameters involved. No non-linear regresson is required. If what you are really trying to

Re: [R] nls - find good starting values

2009-07-14 Thread Dieter Menne
antje-4 wrote: I have several data sets, I'd like to fit to a gaussian distribution. I've tried to give an estimate of the mean and the sd of this distribution but still, I run into problems if these estimates are not close enough. For example, nls() breaks with this message:

Re: [R] Cluster analysis with missing data

2009-07-14 Thread Bill.Venables
vegdist() in the vegan package optionally allows pairwise deletion of missing values when computing dissimilarities. The result can be used as the first agrument to hclust() ('Caveat emptor', of course.) From: r-help-boun...@r-project.org

Re: [R] Cluster analysis with missing data

2009-07-14 Thread Gavin Simpson
On Mon, 2009-07-13 at 23:42 -0700, Hollix wrote: Hi folks, I tried for the first time hclust. Unfortunately, with missing data in my data file, it doesn't seem to work. I found no information about how to consider missing data. Omission of all missings is not really an option as I would

Re: [R] read.delim skips first column (why?)

2009-07-14 Thread Giovanni Marco Dall'Olio
Hi, I have uploaded a copy of the file here: - http://pastebin.com/fd0edfab the file has also been passed throught the unix command tool unexpand, but it doesn't solve the problem. using head=TRUE instead of head=T has also the same effect. the output of print(names) is: print(names(ngly),

Re: [R] read.delim skips first column (why?)

2009-07-14 Thread Petr PIKAL
Hi str(read.table(test.txt, header=T)) 'data.frame': 9 obs. of 12 variables: $ snp : Factor w/ 9 levels rs1113188,rs1113397,..: 9 5 7 8 3 4 6 1 2 $ gene : Factor w/ 1 level TRP2: 1 1 1 1 1 1 1 1 1 $ chromosome : int 3 3 3 3 3 3 3 3 3

[R] LAPACK package

2009-07-14 Thread Moumita Das
Hi All, Can someone tell me if solve function shown below for my version of R is proper or not? I am using R 2.7.2 .Wherever i have used this function ,i got results which were different from the expected results as computed using SPSS. Description of this function says:-- Solve a System of

[R] Error installing package sna

2009-07-14 Thread Greenerpole
Dear R-users, These days, I have been struggling to install the package sna on my Ubuntu 8.04 laptop. My R version is currently R 2.7.2. And I had no trouble installing any other packages (including network). However when I run 'install.packages(sna)', compilation of C codes is ok, but a

[R] How does logLik(lm(...)) find the maximum log likelihoods

2009-07-14 Thread Lars Bergemann
Hi. Thanks for your help with my previous question (comparing two lm() models with a maximum likelihood ratio test) I had a look at lrtest from the package lmtest as it has been suggested to me, but I am not 100% sure if that is the right thing to do ... lrtest uses the same log

Re: [R] .RData signature

2009-07-14 Thread Duncan Murdoch
stephenb wrote: any ideas? has anybody tried to recover RData files before? I have seen messages about that problem here before (see RSiteSearch(.RData corrupted) for a sampling), but I don't think I've seen any really satisfactory solutions. It would be nice to have an error tolerant

[R] hi friends, is there any wait function in R

2009-07-14 Thread deepak m r
hi, is there any wait function in R. I am running one R script to plot many graphs it is in the for loop. its showing no error but its not plotting well I think i can solve this problem with a wait function. Please help me in this regards. If u need any clarification about programme. u can find

Re: [R] How does logLik(lm(...)) find the maximum log likelihoods

2009-07-14 Thread Achim Zeileis
On Tue, 14 Jul 2009, Lars Bergemann wrote: Hi. Thanks for your help with my previous question (comparing two lm() models with a maximum likelihood ratio test) I had a look at lrtest from the package lmtest as it has been suggested to me, but I am not 100% sure if that is the right thing to

[R] Help needed in identifying type of plot

2009-07-14 Thread Girish A.R.
Hi folks, Can someone please help me in identifying the type of plot shown here? Sample R code or specific package name would be of help as well. Thanks, -Girish http://www.nabble.com/file/p24477714/example_plot.jpg -- View this message in context:

Re: [R] graph: axis label font

2009-07-14 Thread S Ellison
R on windows includes some useful functions for windows font handling. Start with ?windowsFonts windowsFonts() should show Arial mapped to sans. (Arial is the default in Windows, at least in my locale; ?windows tells you that too) Then try par(family=sans, font=2) #specifies Arial bold as

Re: [R] hi friends, is there any wait function in R

2009-07-14 Thread ONKELINX, Thierry
Dear Deepak, You'll need to clarify what EXACTLY is happening? If empty plots are created then try to wrap the plot() in print() statements. print(plot(...)). Furthermore I would recommend to avoid attach. HTH, Thierry

Re: [R] read.delim skips first column (why?)

2009-07-14 Thread Gabor Grothendieck
Try count.fields(myfile.txt, sep = \t) read.delim uses sep = \t but there are trailing tabs on some lines. The first line, i.e. with the headers, has three trailing tabs so it thinks that there are 15 columns rather than 12. The 5th line of the file (4th line of data) has 4 trailing tabs so it

[R] Odp: hi friends, is there any wait function in R

2009-07-14 Thread Petr PIKAL
Hi For this type of problems I do multipage pdf. pdf(file, ) for (i in ...) { do all stuff including plot } dev.off() and then check the plots afterwards. Recently there was some post about how to wait but you do not want only wait you want also to interactively change plotting

Re: [R] Nested for loops

2009-07-14 Thread David Winsemius
On Jul 14, 2009, at 2:25 AM, Michael Knudsen wrote: On Tue, Jul 14, 2009 at 8:20 AM, Michael Knudsenmicknud...@gmail.com wrote: What do you mean? It looks a like a very general solution to me. Just got an email suggesting using the functions col and row. For example temp =

Re: [R] Help needed in identifying type of plot

2009-07-14 Thread Christopher Jones
On 14 Jul 2009, at 12:30, Girish A.R. wrote: Can someone please help me in identifying the type of plot shown here? Its a Forest Plot Chris. --- Gynaecological Cancer Research Laboratories, UCL EGA Institute for Women's Health, University College London, Paul O'Gorman

[R] How to provide list as an argument for the data.frame()

2009-07-14 Thread Gaurav Kumar
Hi R -users, i've a table as describe below. I'm reading the numeric value presented in this table to populate a list. #table # #X    A    B    C #x1    2    3    4 #x2    5    7    10 #x4    2    3    5 # rawData - read.table(raw_data.txt,header=T, sep=\t)

Re: [R] Help needed in identifying type of plot

2009-07-14 Thread ONKELINX, Thierry
It is a plot with pointranges. Here is an example with the ggplot2 package library(ggplot2) #use the diamond data set from ggplot2 diamonds$A - diamonds$depth 60 dmod - lm(price ~ cut * A, data=diamonds) cuts - unique(diamonds[, c(cut, A)]) cuts - cbind(cuts, predict(dmod, cuts,

Re: [R] Help needed in identifying type of plot

2009-07-14 Thread Girish A.R.
Thanks, Chris and Thierry! I think I can explore both your solutions. best, -Girish It is a plot with pointranges. Here is an example with the ggplot2 package library(ggplot2) #use the diamond data set from ggplot2 diamonds$A - diamonds$depth 60 dmod - lm(price ~ cut * A, data=diamonds)

Re: [R] Nested for loops

2009-07-14 Thread Gabor Grothendieck
Try this: seq. - function(from, to) seq(from = from, length = max(0, to - from + 1)) seq.(11, 10) On Tue, Jul 14, 2009 at 1:38 AM, Michael Knudsenmicknud...@gmail.com wrote: Hi, I have spent some time locating a quite subtle (at least in my opinion) bug in my code. I want two nested for

Re: [R] How to provide list as an argument for the data.frame()

2009-07-14 Thread David Winsemius
On Jul 14, 2009, at 8:14 AM, Gaurav Kumar wrote: Hi R -users, i've a table as describe below. I'm reading the numeric value presented in this table to populate a list. #table # #XABC #x1234 #x25710 #x4235 # rawData -

Re: [R] hi friends, is there any wait function in R

2009-07-14 Thread deepak m r
Hi, Empty plot is getting i dont know why. can u please clarify how can i use Print function instead of plot function. best regards deepak On Tue, Jul 14, 2009 at 7:48 AM, Petr PIKALpetr.pi...@precheza.cz wrote: Hi For this type of problems I do multipage pdf. pdf(file, ) for (i in

Re: [R] hi friends, is there any wait function in R

2009-07-14 Thread deepak m r
Hi, where can i use this par(ask=TRUE) function i tried before dev.off() code but it is again the same. best regards, Deepak On Tue, Jul 14, 2009 at 8:56 AM, deepak m rdeepak...@gmail.com wrote: Hi,    Empty plot is getting i dont know why. can u please clarify how can i use Print function

Re: [R] How to provide list as an argument for the data.frame()

2009-07-14 Thread Marc Schwartz
On Jul 14, 2009, at 7:14 AM, Gaurav Kumar wrote: Hi R -users, i've a table as describe below. I'm reading the numeric value presented in this table to populate a list. #table # #XABC #x1234 #x25710 #x4235 # rawData -

[R] 2 x 2 x 10 x 2 binomial setup

2009-07-14 Thread Suresh Krishna
Hello, I have a hierarchical dataset of this form and am trying to analyze it in R. 1 subject Tested under 2 conditions: A and B 10 sesssions in each condition In each session, 2 kinds of tests: Test 1 and Test 2 200 independent repetitions of each test-type, with 200 Yes/No answers So I

Re: [R] nls - find good starting values

2009-07-14 Thread Antje
Hi Bill, thanks for your answer. I don't see what you mean with fitting a gaussian distribution... I'm pretty sure, that I'd like to fit a gaussian probability density function :-) (not normalized, for example with a mean around -4 and a standard deviation of 0.5) I'm not sure if I

Re: [R] Nested for loops

2009-07-14 Thread Michael Knudsen
On Tue, Jul 14, 2009 at 1:56 PM, David Winsemiusdwinsem...@comcast.net wrote: temp[ upper.tri(temp) ]  [1]  7 13 14 19 20 21 25 26 27 28 31 32 33 34 35 Thanks! I didn't know about that function; it certainly makes things a lot easier. For example, until now I have used the following, homemade

Re: [R] Nested for loops

2009-07-14 Thread Michael Knudsen
On Tue, Jul 14, 2009 at 2:29 PM, Gabor Grothendieckggrothendi...@gmail.com wrote: seq. - function(from, to) seq(from = from, length = max(0, to - from + 1)) Really nice! Thank you! -- Michael Knudsen micknud...@gmail.com http://lifeofknudsen.blogspot.com/

Re: [R] hi friends, is there any wait function in R

2009-07-14 Thread Duncan Murdoch
On 7/14/2009 8:56 AM, deepak m r wrote: Hi, Empty plot is getting i dont know why. can u please clarify how can i use Print function instead of plot function. You need print() if you are using grid-based graphics (lattice, ggplot2,...) in a script. You are using classic graphics so it

[R] Attributes lost after 'merge'

2009-07-14 Thread Frank Bloos
Hi, In my dataframes, I am using attributes such as 'units' and 'labels' from the Hmisc-package. However, when I join two dataframes with the merge-command, all these attributes are gone. Is there a way to preserve them? Thanks, Frank Universitätsklinikum Jena Körperschaft

[R] LondonR meeting - 21st of July

2009-07-14 Thread Francisco Gochez
Thank you to everyone for showing such an interest in the next LondonR meeting. Below is the agenda for the meeting: LondonR meeting - 21st July 2009 Time:4pm - 7pm Venue: The Wall 45 Old Broad Street London

Re: [R] hi friends, is there any wait function in R

2009-07-14 Thread deepak m r
Hi, I am not an expert to debug the R can u please help. best regards deepak On Tue, Jul 14, 2009 at 10:06 AM, deepak m rdeepak...@gmail.com wrote: Hi, On Tue, Jul 14, 2009 at 9:38 AM, Duncan Murdochmurd...@stats.uwo.ca wrote: On 7/14/2009 8:56 AM, deepak m r wrote: Hi,    Empty plot

Re: [R] hi friends, is there any wait function in R

2009-07-14 Thread deepak m r
Hi, On Tue, Jul 14, 2009 at 9:38 AM, Duncan Murdochmurd...@stats.uwo.ca wrote: On 7/14/2009 8:56 AM, deepak m r wrote: Hi,    Empty plot is getting i dont know why. can u please clarify how can i use Print function instead of plot function. You need print() if you are using grid-based

[R] Tinn-R 2.3.0.0 released

2009-07-14 Thread Jose Claudio Faria
We would like to announce that a new version of the Tinn-R for Windows (2.3.0.0) was released and is available on SourceForge server: http://sourceforge.net/projects/tinn-r Tinn-R is a R script editor under the OS Windows. Changes: 2.3.0.0 (jul/10/2009) * Bugs fixed: - The error

Re: [R] Help needed in identifying type of plot

2009-07-14 Thread John Kane
It looks like a forest plot normally used in meta-analysis work. See http://www.bmj.com/cgi/content/full/322/7300/1479 . See http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=114 for an example from rmeta package with accompanying code. I think that package metafor also gives

Re: [R] LAPACK package

2009-07-14 Thread Steve Lianoglou
Hi, On Jul 14, 2009, at 5:45 AM, Moumita Das wrote: Hi All, Can someone tell me if solve function shown below for my version of R is proper or not? I am using R 2.7.2 .Wherever i have used this function ,i got results which were different from the expected results as computed using

Re: [R] Fortran function for quantiles

2009-07-14 Thread roger koenker
You could look at the function kuantile() in the package quantreg and the associated fortran code dsel05.f which implements a version of the Floyd and Rivest (CACM, 1975) algorithm. url:www.econ.uiuc.edu/~rogerRoger Koenker emailrkoen...@uiuc.eduDepartment of

Re: [R] hi friends, is there any wait function in R

2009-07-14 Thread Duncan Murdoch
On 7/14/2009 10:07 AM, deepak m r wrote: Hi, I am not an expert to debug the R can u please help. No, because you haven't given us anything to work with. Simplify your example to something we can run, explain what you see and what you think you should see, and then maybe one of us could

Re: [R] hi friends, is there any wait function in R

2009-07-14 Thread deepak m r
hi, first plot command and legend commands are working but lines command is not working i dont know how it happening so. can u please help. best regards deepak On Tue, Jul 14, 2009 at 10:32 AM, Duncan Murdochmurd...@stats.uwo.ca wrote: On 7/14/2009 10:07 AM, deepak m r wrote: Hi,   I am not

[R] exporting list of installed packages for import on another system?

2009-07-14 Thread Jan Theodore Galkowski
Is it possible to export a list of installed packages from WinXP, and use that export to import the same set of packages on Ubuntu (Jaunty)? No doubt there is custom code that could be written, but I wonder if R 2.9.1 has anything built it to do that? Is it as simple as moving something like

[R] Error when sampling from SpatialLines

2009-07-14 Thread Elke MOONS
Dear forum,   I am working in R 2.9.1 and I am trying to sample locations from a network file. Reading in nor plotting is a problem, however when I am trying to sample from the file I get the following message:   nwlim-readShapeLines(C:/Limburg_nwshape,

[R] Problem with GroupedData

2009-07-14 Thread FMH
Hi,   I have an original data frame with 8 columns of variables, which are stored in 'data1' frame.   data1 - read.csv(E:\\PHD GLASGOW UNIVERSITY\\Data\\R\\Colin\\Cailness21.csv) attach(data1) names(data1)   [1] Date   d  m  y  Time  [6] Depth  Temp  

[R] Linear Regression Problem

2009-07-14 Thread Alex Roy
Dear All, I have a matrix say, X ( 100 X 40,000) and a vector say, y (100 X 1) . I want to perform linear regression. I have scaled X matrix by using scale () to get mean zero and s.d 1 . But still I get very high values of regression coefficients. If I scale X matrix, then

[R] paste ( x )

2009-07-14 Thread Paulo E. Cardoso
maybe a very basic question but I need to parse an SQL code into a GIS from a ODBC conn. The code includes a specific sentence OPTIONS COORDSYS(Latitude / Longitude); and I need the pasted into the string. They cannot disappear. how to do this? Paulo E. Cardoso

Re: [R] Linear Regression Problem

2009-07-14 Thread Vito Muggeo (UniPa)
dear Alex, I think your problem with a large number of predictors and a relatively small number of subjects may be faced via some regularization approach (ridge or lasso regression..) hope this helps you, vito Alex Roy ha scritto: Dear All, I have a matrix say, X ( 100 X

[R] Runtime Error with multinom

2009-07-14 Thread Andreas Wittmann
Dear R-users, i try to fit a multinomial model in order to get an imputation for a missing value in factor1. library(nnet) factor1 - factor(c(a,b,c,d)) factor2 - factor(c(e,f,g,h)) size - c(3,8,2,1) factor1[3] - NA Z-ifelse(is.na(factor1), 0, 1) assign(data,

[R] hi, how can we avoid maskiing error in R

2009-07-14 Thread deepak m r
Hi, How can we avoid masking variable in R Scripting. best regards deepak __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide

Re: [R] Linear Regression Problem

2009-07-14 Thread Alex Roy
Dear Vito, Thanks for your comments. But I want to do Simple linear regression not Multiple Linear regression. Multiple Linear regression is not possible here as number of variables are much more than samples.( X is ill condioned, inverse of X^TX does not exist! ) I just want to

[R] plotting confidence intervals

2009-07-14 Thread Erin Hodgess
Hi R People: If I have a fitted values from a model, how do I plot the (1-alpha)100% confidence intervals along with the fitted values, please? Also, if the intervals are shaded gray, that would be nice too, please? I check confint, but that doesn't seem to do what I want. Thanks in advance,

Re: [R] Linear Regression Problem

2009-07-14 Thread Liaw, Andy
For the coefficient to be equal to the correlation, you need to scale y as well. You can get the correlations by something like the following and then back-calculate the coefficients from there. R x = matrix(rnorm(100*4e4), 100, 4e4) R y = rnorm(100) R rxy = cor(x, cbind(y)) Andy

Re: [R] Linear Regression Problem

2009-07-14 Thread Ravi Varadhan
I am not sure that you really want to do separate regressions for each row of X, with the same y. This does not make much sense. Why do you think multiple linear regression is not possible just because X'X is not invertible? You have 2 main options here: 1. Obtain a minimum-norm solution

Re: [R] exporting list of installed packages for import on another system?

2009-07-14 Thread Marc Schwartz
On Jul 14, 2009, at 9:43 AM, Jan Theodore Galkowski wrote: Is it possible to export a list of installed packages from WinXP, and use that export to import the same set of packages on Ubuntu (Jaunty)? No doubt there is custom code that could be written, but I wonder if R 2.9.1 has anything

Re: [R] exporting list of installed packages for import on another system?

2009-07-14 Thread Jan Theodore Galkowski
Super Marc! Thanks! Should I post this on the R Wiki some place? 'Twould be useful to others, I think. - Jan On Tue, 14 Jul 2009 11:49:49 -0400, Marc Schwartz marc_schwa...@me.com wrote: On Jul 14, 2009, at 9:43 AM, Jan Theodore Galkowski wrote: Is it possible to export a list of

Re: [R] exporting list of installed packages for import on another system?

2009-07-14 Thread Marc Schwartz
I'll leave that up to you... :-) You could add the URL of the thread to the wiki entry if you wish as well. Regards, Marc On Jul 14, 2009, at 10:57 AM, Jan Theodore Galkowski wrote: Super Marc! Thanks! Should I post this on the R Wiki some place? 'Twould be useful to others, I think.

[R] From list to variable name

2009-07-14 Thread Michelle Greve
Hello I am trying to run equations with different combinations of explanatory variables. I have managed to figure out how to generate the different combinations, and am trying to set up equations where I use these combinations. And this is where I am getting stuck. I have searched several R

Re: [R] Linear Regression Problem

2009-07-14 Thread Alex Roy
Dear Dr. Ravi Varadhan, Thanks for your comments. Here, variables (p) are in columns and samples are in rows(n). And I want to find out significant variables associated with response (y). The reason why I said multiple linear regression (MLR) is not possible : MLR or classical MLR developed with a

Re: [R] From list to variable name

2009-07-14 Thread Gabor Grothendieck
Using the built in dataset anscombe this regresses y1 on x1 and y3 ignoring the other columns: lrm(y1 ~., anscombe[c(y1, x1, y3)]) or lrm(y1 ~., anscombe[c(5, 1, 7)]) either of which eliminate having to calculate special purpose formulas. Also see the leaps package. On Tue, Jul 14, 2009 at

Re: [R] plotting confidence intervals

2009-07-14 Thread Marc Schwartz
On Jul 14, 2009, at 10:40 AM, Erin Hodgess wrote: Hi R People: If I have a fitted values from a model, how do I plot the (1-alpha)100% confidence intervals along with the fitted values, please? Also, if the intervals are shaded gray, that would be nice too, please? I check confint, but

Re: [R] hi, how can we avoid maskiing error in R

2009-07-14 Thread Charles C. Berry
On Tue, 14 Jul 2009, deepak m r wrote: Hi, How can we avoid masking variable in R Scripting. It really isn't clear what you are asking. Please follow the suggestions in the Posting Guide to frame a better question. Guessing what your issue might be, I suggest you consult

[R] Trig functions strange results

2009-07-14 Thread Nair, Murlidharan T
I am trying to calculate coordinate transformations and in the process of debugging my code using debug I found the following Browse[1] direction[i] [1] -1.570796 Browse[1] cos(direction[i]) [1] 6.123032e-17 Browse[1] cos(-1.570796) [1] 3.267949e-07 Browse[1] direction[i] [1] -1.570796 Browse[1]

Re: [R] plotting confidence intervals

2009-07-14 Thread Daniel Malter
Hi Erin, have a look at the following example: #Simulate data n=1000 x1=rnorm(n,0,0.05) x2=rnorm(n,0,0.1) x3=rnorm(n,0,0.02) e=rnorm(n,0,1) y=x1+2*x2-0.5*x3+e #Run regression reg=lm(y~x1+x2+x3) #Regression output summary(reg)$coef #Create dataset with confidence intervals and an index

Re: [R] plotting confidence intervals

2009-07-14 Thread Daniel Malter
Erin and all, I lavishly used the factor 2 for the confidence intervals. Of course this should be approximately 1.96 for the 95% CI under the assumption of normality. So just adjust the factor accordingly or according to your desired alpha level when you create the CI data frame. Otherwise, my

[R] Proper Paste for Data Member

2009-07-14 Thread Idgarad
I imported a spreadsheet into a variable sh e.g. sh$, sh$, etc... doing the following: tsSource - ts(paste(sh$,NAMEVARIABLE,sep=) ... ) fails. The paste isn't evaluating properly. What is the proper way to concatenate a data source with a member name such that they evaluate properly.

Re: [R] Proper Paste for Data Member

2009-07-14 Thread David Winsemius
On Jul 14, 2009, at 2:02 PM, Idgarad wrote: I imported a spreadsheet into a variable sh e.g. sh$, sh$, etc... doing the following: tsSource - ts(paste(sh$,NAMEVARIABLE,sep=) ... ) From prior experience, my guess is that you want collapse= rather than sep= fails. The paste

Re: [R] Trig functions strange results

2009-07-14 Thread Ben Bolker
Nair, Murlidharan T wrote: I am trying to calculate coordinate transformations and in the process of debugging my code using debug I found the following Browse[1] direction[i] [1] -1.570796 Browse[1] cos(direction[i]) [1] 6.123032e-17 Browse[1] cos(-1.570796) [1] 3.267949e-07

Re: [R] Trig functions strange results

2009-07-14 Thread jim holtman
FAQ 7.31 This is what happens with floating point number and you are only printing out 7 digits of precision; look at the results cos(-1.570796) [1] 0.003267949 cos(-1.5707961) # just incrementing the digit that was not displayed [1] 0.002267949 cos(-1.5707962) [1] 0.001267949

Re: [R] Problem with GroupedData

2009-07-14 Thread Kingsford Jones
Hi Fir, Are you sure data2 is a data frame? The error message suggests it isn't. Try class(data2) or str(data2) if you're not sure. On another note -- perhaps it's better to avoid using groupedData. I've used the nlme library for years without ever using the grouped structure. My opinion is

Re: [R] Proper Paste for Data Member

2009-07-14 Thread David Winsemius
On Jul 14, 2009, at 2:19 PM, David Winsemius wrote: On Jul 14, 2009, at 2:02 PM, Idgarad wrote: I imported a spreadsheet into a variable sh e.g. sh$, sh$, etc... doing the following: tsSource - ts(paste(sh$,NAMEVARIABLE,sep=) ... ) From prior experience, my guess is that you

Re: [R] paste ( x )

2009-07-14 Thread Thomas Roth (geb. Kaliwe)
maybe this helps x = \test\ plot(1:10, main = x) #heading contains #or cat(\test\) Thomas Roth Paulo E. Cardoso schrieb: maybe a very basic question but I need to parse an SQL code into a GIS from a ODBC conn. The code includes a specific sentence OPTIONS COORDSYS(Latitude /

[R] Comprehensive power analysis/sample size package in R?

2009-07-14 Thread ukoenig
Dear all, my colleague (a statistician - not yet using R) aked me, if there is a R package comparable to the software PASS (Power Analysis and Sample Size Procedures), comprising about 150 procedures. I found the R package pwr. Are there other (more comprehensive) power analysis packages?

[R] How to import BIG csv files with separate map?

2009-07-14 Thread giusto
Hi all, I am having problems importing a VERY large dataset in R. I have looked into the package ff, and that seems to suit me, but also, from all the examples I have seen, it either requires a manual creation of the database, or it needs a read.table kind of step. Being a survey kind of data

Re: [R] hi, how can we avoid maskiing error in R

2009-07-14 Thread deepak m r
I wrote a script in which there is a for group, In that for loop i am reading 4 files and plotting. while plotting it shows previous variable is masking like that it is showing. On Tue, Jul 14, 2009 at 1:05 PM, Charles C. Berrycbe...@tajo.ucsd.edu wrote: On Tue, 14 Jul 2009, deepak m r wrote:

Re: [R] Trig functions strange results

2009-07-14 Thread Nair, Murlidharan T
I had some doubts that it may be due to precision. The value stored in direction[i] is (0-90)*pi/180 How can I specify the precision to be used in computation to R? Thanks ../Murli -Original Message- From: jim holtman [mailto:jholt...@gmail.com] Sent: Tuesday, July 14, 2009 2:44 PM

Re: [R] How to import BIG csv files with separate map?

2009-07-14 Thread Gabor Grothendieck
Either of the following can be done in one line of code: Using the nrows and skip arguments to read.table one can read in a subset of rows. Using the colClasses argument of read.table the class NULL will suppress reading in the corresponding column. read.csv.sql from the sqldf package will

Re: [R] How to import BIG csv files with separate map?

2009-07-14 Thread Steve Lianoglou
Hi, On Jul 14, 2009, at 1:53 PM, giusto wrote: Hi all, I am having problems importing a VERY large dataset in R. I have looked into the package ff, and that seems to suit me, but also, from all the examples I have seen, it either requires a manual creation of the database, or it needs

Re: [R] hi, how can we avoid maskiing error in R

2009-07-14 Thread Steve Lianoglou
I wrote a script in which there is a for group, In that for loop i am For group? Did you mean loop there, also? reading 4 files and plotting. while plotting it shows previous variable is masking like that it is showing. Can you just paste your code into an email? It might be easier to see

Re: [R] Trig functions strange results

2009-07-14 Thread Stavros Macrakis
On Tue, Jul 14, 2009 at 1:45 PM, Nair, Murlidharan T mn...@iusb.edu wrote: I am trying to calculate coordinate transformations and in the process of debugging my code using debug I found the following Browse[1] direction[i] [1] -1.570796 Browse[1] cos(direction[i]) [1] 6.123032e-17

Re: [R] problems with contrast matrix

2009-07-14 Thread Greg Snow
Your contrasts are not linearly independent and therefore there are an infinite number of possible correct answers, this tends to confuse computers (take 1/3 times the 3rd col, plus 2/3 times the 4th col, plus 3/3 times the 5th col and compare that to the 1st col). You need to replace one of

Re: [R] Nonlinear Least Squares nls() programming help

2009-07-14 Thread spencerg
1. What does i in your formula represent? Have you worked the examples in the nls help page, and do you understand how it works? nls tries to do vector computations. 2. Unfortunately, nls often quits with errors like singular convergence. A standard way around that problem is

[R] SweaveListingUtils question

2009-07-14 Thread Karsten Weinert
Hello group, recently I read about the SweaveListingUtils package and now I would like to try it out. However I can not make it run... Below is a minimal example. The problem seems the following line, generated by the package:

[R] (simple) xml into data.frame and reverse

2009-07-14 Thread stefan.d...@gmail.com
Hello, I am trying to convert a simple data.frame (it will always be a few equally long variables) into the XML format (which I don't understand too well but need as input for another program) and reverse the operation (from XML back into data.frame). I found some code which does the first and it

[R] nnet function - help!

2009-07-14 Thread Lars Bishop
Dear experts, I'm new in R. I'd like to know if I need to standarize the input variables prior to using the nnet function or does this function standarizes the variables internally? In the first case, is there a fast way to standarize continuous and categorical inputs? Thanks Lars.

[R] SOS! error in GLM logistic regression...

2009-07-14 Thread Michael
Hi all, Could anybody tell me what happened to my logistic regression in R? mylog=glm(mytraindata$V1 ~ ., data=mytraindata, family=binomial(logit)) It generated the following error message: Error in model.frame.default(Terms, newdata, na.action = na.action, xlev = object$xlevels) : factor

Re: [R] nls, reach limit bounds

2009-07-14 Thread UyenThao Nguyen
Hi Ravi and Spencer, Thank you very much for your help. I did plot the data, and saw that the data didn't seem to have an inflection point. Yes, the data contained 6 points of duplicates, which the 4 P logistic regression is appropriate to use. I tried the dose response model (drm in drc

Re: [R] How to order an data.table by values of an column?

2009-07-14 Thread Matthew Dowle
If the question really meant to say data.table (i.e. package data.table) then its easier than the data.frame answer. dt = data.table(Categ=c(468,351,0,234,117),Perc=c(31.52,27.52,0.77,22.55,15.99)) dt[order(Categ)] Notice there is no dt$ required before dt$Categ. Also note the comma is

[R] How do I know where is R? - VB Programming

2009-07-14 Thread Haoda Fu
Dear all - Is there anyone know how to let VB or C# know where I install R automatically(i.e. auto detect R directory)? Many thanks! Best, Haoda __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] nls, reach limit bounds

2009-07-14 Thread Ravi Varadhan
I took a quick look at drcpackage and the drm function. The drm() function uses optim (BFGS method). So, that is one diffference. However, without looking at your code on how you used drm(), I cannot tell further. The fact that you got an answer using optim() does not necessarily mean that

Re: [R] How do I know where is R? - VB Programming

2009-07-14 Thread Duncan Murdoch
On 14/07/2009 7:22 PM, Haoda Fu wrote: Dear all - Is there anyone know how to let VB or C# know where I install R automatically(i.e. auto detect R directory)? On Windows if you run the installer it will record its location in the registry, under *\Software\R-core\R\, where * is HKLM or

Re: [R] How do I know where is R? - VB Programming

2009-07-14 Thread Gabor Grothendieck
For some examples of using the R registry entries see Rcmd.bat, Rversions.bat and Rversions.hta in the batchfiles distribution whose home page is: http://batchfiles.googlecode.com On Tue, Jul 14, 2009 at 7:22 PM, Haoda Fufu...@yahoo.com.cn wrote: Dear all - Is there anyone know how to let VB

Re: [R] SOS! error in GLM logistic regression...

2009-07-14 Thread Ben Bolker
losemind wrote: Hi all, Could anybody tell me what happened to my logistic regression in R? mylog=glm(mytraindata$V1 ~ ., data=mytraindata, family=binomial(logit)) It generated the following error message: Error in model.frame.default(Terms, newdata, na.action = na.action, xlev =

  1   2   >