Re: [R] wgcna

2011-07-12 Thread mistrm
Hi Peter and Raquel I am following the same tutorial and seem to have the same error appear and I am using 30 permutations (code below). Is it a bug or something that I can easily fix? I'm not quite sure how to interpret the error. multiExpr = list(A1=list(data=t(ctl)),A2=list(data=t(sz))) multiC

[R] suggestions regarding reading in a messy file

2011-07-12 Thread Juliet Hannah
I have a file in stata format, which I have read in, and I am trying to create a text file. I have exported the data using various delimiters, but I'm unable to read it back in. I originally read in the file with: library(foreign) myData <- read.dta("mydata.dta") I then exported it with write.tab

Re: [R] fixed effects Tobit, Honore style?

2011-07-12 Thread Daniel Malter
Not that I know of, but the paper says that they are easy to compute. If you did, you could contribute the code. Best, Daniel David Hugh-Jones-3 wrote: > > Hi all, > > Is there any code to run fixed effects Tobit models in the style of Honore > (1992) in R? > (The original Honore article is he

Re: [R] simple save question

2011-07-12 Thread David Winsemius
On Jul 12, 2011, at 2:31 PM, Tom La Bone wrote: Here is a worked example. Can you point out to me where in temp rmean is stored? Thanks. It is not. You need to read the ?print.survfit page: Value x, with the invisible flag set to prevent printing. (The default for all print functions i

Re: [R] qplot and for loops

2011-07-12 Thread Joshua Wiley
Hi, You actually did the loop correctly. The problem is that the graphs were created very quickly so you only see the last one. One way around this is to make R wait for user input. You can turn this on and off for a particular device using: par(ask = TRUE) See ?par for details on this. To c

Re: [R] qplot and for loops

2011-07-12 Thread David Winsemius
On Jul 12, 2011, at 3:21 PM, wwreith wrote: I have 4 columns and 56 rows of made up data that I want to plot as a series of bar graphs. The idea is to create one bar graph for each of the 4 columns using a for loop. I tried the following command in RStudio and when I type x in the console

Re: [R] suggestions regarding reading in a messy file

2011-07-12 Thread David Winsemius
On Jul 12, 2011, at 4:37 PM, Juliet Hannah wrote: I have a file in stata format, which I have read in, and I am trying to create a text file. I have exported the data using various delimiters, but I'm unable to read it back in. I originally read in the file with: library(foreign) myData <- rea

Re: [R] apply (or similar preferred) for multiple columns

2011-07-12 Thread Daniel Malter
Probably not the most elegant, but a workable solution. Assume you have a matrix x of dimensions 10 x 10. Assume further you want to calculate the mean for each successive block of two columns. One way to do this is to create a matrix that indicates the column numbers from/to which to apply the fun

Re: [R] wgcna

2011-07-12 Thread Peter Langfelder
Hi Meeta, yes, there was a bug in the package. Please install the newest version and try again. Best, Peter On Tue, Jul 12, 2011 at 1:20 PM, mistrm wrote: > Hi Peter and Raquel > > I am following the same tutorial and seem to have the same error appear and > I am using 30 permutations (code be

Re: [R] qplot and for loops

2011-07-12 Thread Joshua Wiley
On Tue, Jul 12, 2011 at 2:01 PM, Reith, William [USA] wrote: > Do I need to define x in any way before I do the loop? No, you should not need to define x explicitly. Just pass the data frame you want to qplot. David was absolutely right though that inside a loop, you should wrap the call to qpl

Re: [R] apply (or similar preferred) for multiple columns

2011-07-12 Thread Gabor Grothendieck
On Tue, Jul 12, 2011 at 5:27 AM, Dimitris.Kapetanakis wrote: > Dear all, > > I would like to use the apply or a similar function belonging to this > family, but applying for each column (or row) but let say for each q > columns. For example I would like to apply a function FUN for the first q > co

[R] foreach not recognizing functions in memory

2011-07-12 Thread Bos, Roger
All, I am not understanding the scoping used in foreach when it is used inside a function. I keep getting "could not find function" errors for functions that are in memory when I try to use foreach within a function call. I have a simple example below. "testFun" is in memory and works when call

Re: [R] foreach not recognizing functions in memory

2011-07-12 Thread David Winsemius
On Jul 12, 2011, at 5:28 PM, Bos, Roger wrote: All, I am not understanding the scoping used in foreach when it is used inside a function. I keep getting "could not find function" errors for functions that are in memory when I try to use foreach within a function call. I have a simple exa

Re: [R] foreach not recognizing functions in memory

2011-07-12 Thread Adrienne Wootten
Roger, I think I know why you are having a problem. Your foreach is using %dopar% and judging from your output you have active parallel processing. When running something in paralell, the master is the processor used by the Rgui, and the slaves are in the background. My guess is the the functio

Re: [R] Storing and managing custom R functions for re-use

2011-07-12 Thread Steve Taylor
My solution to the clutter problem is this: at start-up time, create a list of functions, attach the list and then delete the list. I haven't delved into making packages yet. if (any(search()=="MyFunctions")) detach(MyFunctions) MyFunctions <- list() MyFunctions$ "%like%" <- function(x,y) { s

Re: [R] Storing and managing custom R functions for re-use

2011-07-12 Thread Bert Gunter
These sorts of tasks can be automated. See: ?Startup -- Bert On Tue, Jul 12, 2011 at 2:48 PM, Steve Taylor wrote: > My solution to the clutter problem is this: at start-up time, create a list > of functions, attach the list and then delete the list.  I haven't delved > into making packages ye

Re: [R] Question re complex survey design and cure models

2011-07-12 Thread Thomas Lumley
On Wed, Jul 13, 2011 at 6:13 AM, Sze Liu wrote: > Hello all, > I am using AddHealth data to fit a cure, aka split population model using > nltm.  I am not sure how to account for the complex survey > design - does anyone have any suggestions?  Any help would be greatly > appreciated! This will

Re: [R] Cross K Ripley's function and "spatio-temporal interaction power"

2011-07-12 Thread Rolf Turner
On 13/07/11 00:57, ruocco wrote: Dear All, I have a collections of spatial data. I have to analyze pairs of these point patterns to test their spatial interaction. I was moving towards the cross K Ripley's function. The problem, however, are the following: 1) What is the best way to get a singl

Re: [R] fitdistr() Error

2011-07-12 Thread Peter Maclean
There is no missing value nor zero values.   - Original Message From: Uwe Ligges To: Peter Maclean Cc: r-help@r-project.org Sent: Tue, July 12, 2011 2:58:10 AM Subject: Re: [R] fitdistr() Error Any NA values or values outside the support region of your distribution? UWe On 11.07.2

[R] spatial logit help

2011-07-12 Thread Salifu Wahab
Please I am new to R. I got the following code from a friend:   gmat <- cbind(gmat,p*(1-p)*wxb) for (j in seq(1:ncol(gmat))) {   gmat[,j] <- fitted(lm(gmat[,j]~zmat)) }   It is for spatial logit.   After defining all the matrices in it such as P, wxb, gmat, and zmat, I tried to run it in R and go

[R] LOESS function Newton optimization

2011-07-12 Thread KenjiPsyD
I have a question about running an optimization function on an existing LOESS function defined in R. I have a very large dataset (1 million observations) and have run a LOESS regression. Now, I want to run a Newton-Raphson optimization to determine the point at which the slope change is the greates

Re: [R] simple save question

2011-07-12 Thread Tom La Bone
Thank you for the reply Dr. Winsemius. Can you take your answer a step further and, in the context of the simple, reproducible example, illustrate how it is done? I would appreciate it. Tom -- View this message in context: http://r.789695.n4.nabble.com/simple-save-question-tp3429148p3663645.htm

Re: [R] spatial logit help

2011-07-12 Thread David Winsemius
On Jul 12, 2011, at 7:26 PM, Salifu Wahab wrote: Please I am new to R. I got the following code from a friend: gmat <- cbind(gmat,p*(1-p)*wxb) for (j in seq(1:ncol(gmat))) { gmat[,j] <- fitted(lm(gmat[,j]~zmat)) } It is for spatial logit. After defining all the matrices in it such as P, wx

[R] problem plotting points based on different values

2011-07-12 Thread Hrishi lokhande
Hello Friends, I am new to R and stuck with a problem. i have two columns drug_A and drug_B, i have plotted a scatter plot using the ggplot2 function. My problem is with the third column, it is the p-value column. I want to color and size points differently based on the p_value, the p_value ran

Re: [R] simple save question

2011-07-12 Thread David Winsemius
On Jul 12, 2011, at 5:43 PM, Tom La Bone wrote: Thank you for the reply Dr. Winsemius. Can you take your answer a step further and, in the context of the simple, reproducible example, illustrate how it is done? I would appreciate it. Of course. Would be happy to take a stab at it but

[R] Rcompression on MAC - where is it?

2011-07-12 Thread Eduardo M. A. M. Mendes
Hello I need to run an r-file that works on Windows on MAC. The first lines of the file are: library(R.matlab) library(Rcompression) Somehow I cannot find where Rcompression is. Am I missing something? Many thanks Ed __ R-help@r-project.org mail

Re: [R] Rcompression on MAC - where is it?

2011-07-12 Thread David Winsemius
On Jul 12, 2011, at 8:40 PM, Eduardo M. A. M. Mendes wrote: Hello I need to run an r-file that works on Windows on MAC. Does that mean you are using a virtual box to run Windoze on Mac hardware? The first lines of the file are: library(R.matlab) library(Rcompression) Somehow I cannot

Re: [R] What's wrong with my code? (Edited version-added my data)

2011-07-12 Thread Susie
Hey Josh, Thank you so much for the help! Now I have edited my codes--breaking into smaller pieces:) R does not state the error again:) However, the problem comes, please see my codes below-- You've suggested earlier that I should move the "eight" part outside the loop; I changed the "eight"

Re: [R] What's wrong with my code? (Edited version-added my data)

2011-07-12 Thread Sarah Goslee
Take a closer look at your R code. Each loop is returning only the last value, so you're doing the same thing over and over for the last value from the previous loop. Write just the code for *one* set of graphs. Look at what needs to change to do the next set. Write a function that takes those arg

Re: [R] What's wrong with my code? (Edited version-added my data)

2011-07-12 Thread Joshua Wiley
Dear Susie, I'm glad the pieces are working. Sorry if I wasn't clear before, when I said break down into smaller pieces, I meant for testing and figuring out what's wrong. If you have everything in separate loops, they will be completed individually, so reading all the datasets will be done a

[R] exponent function help??

2011-07-12 Thread mousy0815
I'm trying to make a function that will output the exponent... so f2(2,2) = 4 and f2(2,3)=8. But I don't want to just use the x^n function, I want to do it another way, and without a recursion. I did the follow code but for some reason it doesn't work. Help please? f2 <- function(x, n) #without r

Re: [R] simple save question

2011-07-12 Thread David Winsemius
On Jul 12, 2011, at 5:43 PM, Tom La Bone wrote: Thank you for the reply Dr. Winsemius. Can you take your answer a step further and, in the context of the simple, reproducible example, illustrate how it is done? I would appreciate it. Tom The easy way is: > sfit <- summary(fit) > sfit$ta

Re: [R] Hardy Weinberg Case Control Test in gap R package

2011-07-12 Thread Jim Silverton
Hi, I am using the gap R package to do the Hardy Weinberg Case Control test for many SNP. I am not sure what the values initial1 and initial2 should be for the test. I tried values but they failed. I emailed the author but to no avail. There seems to be some documentation that is deleted at the to

[R] question on formula and terms.formula()

2011-07-12 Thread pangdu
I'm trying to create a formula object to pass on to a function that applies the function terms.formula() to it. f <- function(formula, ...) { ... mf <- match.call() term <- terms.formula(mf$formula) ... } However, my code below gives an error. form <- as.formula("y~x") f(form, ...) The error

Re: [R] exponent function help??

2011-07-12 Thread Ben Bolker
mousy0815 gmail.com> writes: > I'm trying to make a function that will output the exponent... so f2(2,2) = 4 > and f2(2,3)=8. But I don't want to just use the x^n function, I want to do > it another way, and without a recursion. I did the follow code but for some > reason it doesn't work. Help pl

Re: [R] installation of package 'mapproj' had non-zero exit status

2011-07-12 Thread Ray Brownrigg
On Wed, 13 Jul 2011, B77S wrote: > ## Hello.. I have asked a similar question, but this is not fixed as > before. > > ## I am running the following using Ubuntu OS: > > R version 2.13.1 (2011-07-08) > Copyright (C) 2011 The R Foundation for Statistical Computing > ISBN 3-900051-07-0 > Platform: x

<    1   2