[R] Sum of Product in a Matrix

2009-09-22 Thread Marcio Resende
Hi, I am new in R and I don´t know how to sum the product of two elements at the time in a matrix X=[ 1 5 9 13 2 6 10 14 3 7 11 15 4 8 12 16] I would like to do (1*5+2*6+3*7+4*8) I need to do it step by step because I will further put a conditional in the formula

Re: [R] BLUP with missing data

2009-09-22 Thread Marcio Resende
Sorry, I sent it quickly and forgot to thank in advance Marcio Marcio Resende wrote: > > hello guys, I need to do a BLUP in the simplest model > y = Xm + Zg + e > however I have missing data in the analysis which I can´t consider as > 0(zero). So I need to generate the matrix X'Z, Z'X and Z'Z

[R] reading web log file into R

2009-09-22 Thread Sebastian Kruk
If I have a web log file as follows: #Software: Microsoft Internet Information Services 5.0 #Version: 1.0 #Date: 2007-12-03 13:50:17 #Fields: date time c-ip cs-username s-ip s-port cs-method cs-uri-stem cs-uri-query sc-status sc-bytes cs-bytes time-taken cs(User-Agent) cs(Cookie) cs(Referer) "2007

[R] BLUP with missing data

2009-09-22 Thread Marcio Resende
hello guys, I need to do a BLUP in the simplest model y = Xm + Zg + e however I have missing data in the analysis which I can´t consider as 0(zero). So I need to generate the matrix X'Z, Z'X and Z'Z step by step; I can´t use crossprod(x) #neither X'X <- t(x)%*%x because I should skip the element

Re: [R] use of class variable in r as in Proc means of sas

2009-09-22 Thread Girish A.R.
Here's the code that does the job for quartiles (0,25,50,75,100). To get to your objective of (5,10,25,75,90) is left as an exercise. There are several well-written introductory books in R, in addition to the freely available presentations and other online resources. I think you should spend some

Re: [R] strange split behavior?

2009-09-22 Thread Peter Dalgaard
Peng Yu wrote: Hi, Please see the command with a comment below. I don't find 'A630039F22Rik' in y. But 'A630039F22Rik' is in z. Can somebody let me know what the problem is? Most obvious guess is that your factor y has a level that is not present in data. That is perfectly normal, even desir

Re: [R] how to save plots automatically

2009-09-22 Thread Yihui Xie
Something like for(i in 1:20){ pdf(sprintf("myplot%d.pdf",i)) # your calculation and plots here dev.off() } If you have 100 plots in total, then you should have 5 graphs in each single pdf. Regards, Yihui -- Yihui Xie Phone: 515-294-6609 Web: http://yihui.name Department of Statistics, Io

Re: [R] R PNG graph width limitation

2009-09-22 Thread Yihui Xie
I see. What you meant by "human readable" is to separate the lines and texts in the graph, and that's why you need a so wide graph. Well, I guess, as Henrik told you, the graph was indeed generated there, but your viewer was not able to show it. I also found Adobe Reader cannot display a document

[R] strange split behavior?

2009-09-22 Thread Peng Yu
Hi, Please see the command with a comment below. I don't find 'A630039F22Rik' in y. But 'A630039F22Rik' is in z. Can somebody let me know what the problem is? Regards, Peng > str(x) int [1:365494] 6 7 8 14 15 18 19 21 25 29 ... > str(y) Factor w/ 29904 levels "0610005C13Rik",..: 17261 28617 15

Re: [R] how to save plots automatically

2009-09-22 Thread David Winsemius
On Sep 22, 2009, at 9:50 PM, Weiwei Shi wrote: Hi there, I am wondering if there is a function in R to save plots automatically, like save() for R objects? I have e.g. 100 plots and I cannot put them in one pdf file so I split them, eg into 20 files, but I don't want to save one file ea

Re: [R] Question about zero-inflated poisson with REML.

2009-09-22 Thread Ben Bolker
Sunghee Kim gmail.com> writes: > > Dear All, > > As you know, glmmADMB package use ML method for estimation. > Is it possible to use REML estimation method for zero-inflated Poisson > distribution? > > For ML method, > poi_ML <- glmm.admb(los ~ psihigh + trt.mod + trt.high + psihigh*trt.mod +

Re: [R] How to read zip file?

2009-09-22 Thread Gabor Grothendieck
Linux is a type of UNIX so follow the instructions I gave for UNIX. On Tue, Sep 22, 2009 at 10:16 PM, Peng Yu wrote: > No. My machine is a linux machine. > > On Tue, Sep 22, 2009 at 9:02 PM, Gabor Grothendieck > wrote: >> If you have the 7z zip utility and are on Windows >> (or use 7z and grep o

Re: [R] How to read zip file?

2009-09-22 Thread Peng Yu
No. My machine is a linux machine. On Tue, Sep 22, 2009 at 9:02 PM, Gabor Grothendieck wrote: > If you have the 7z zip utility and are on Windows > (or use 7z and grep on UNIX): > > DF <- read.csv(pipe("7z x myfile.zip -so | findstr $")) > > > On Tue, Sep 22, 2009 at 9:30 PM, Peng Yu wrote: >> H

Re: [R] How to read zip file?

2009-09-22 Thread Gabor Grothendieck
If you have the 7z zip utility and are on Windows (or use 7z and grep on UNIX): DF <- read.csv(pipe("7z x myfile.zip -so | findstr $")) On Tue, Sep 22, 2009 at 9:30 PM, Peng Yu wrote: > Hi, > > Suppose that I have a csv file that is compressed with zip, is there a > way to read it in R without

Re: [R] Ford Fulkerson

2009-09-22 Thread David Winsemius
On Sep 22, 2009, at 9:37 PM, shuva gupta wrote: Hi, Is there any R implementation of the well-known algorithm from the Operations Research literature, the Ford-Fulkerson algorithm of maximum flow in networks with capacities. Thanks. http://lmgtfy.com/?q=%22Ford-Fulkerson%22+%22r-project%

[R] how to save plots automatically

2009-09-22 Thread Weiwei Shi
Hi there, I am wondering if there is a function in R to save plots automatically, like save() for R objects? I have e.g. 100 plots and I cannot put them in one pdf file so I split them, eg into 20 files, but I don't want to save one file each time. Can I use a function to do such save.plot as pdf?

[R] Ford Fulkerson

2009-09-22 Thread shuva gupta
Hi, Is there any R implementation of the well-known algorithm from the Operations Research literature, the Ford-Fulkerson algorithm of maximum flow in networks with capacities. Thanks. [[alternative HTML version deleted]] __ R-help@r-

[R] How to read zip file?

2009-09-22 Thread Peng Yu
Hi, Suppose that I have a csv file that is compressed with zip, is there a way to read it in R without first decompressing it to a file. Regards, Peng __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] barplot with chopped bars

2009-09-22 Thread Lars Skjærven
Yes.. I got it working for dates. I don't want dates though. :) so I figured out I could just use timeformat %Y.. except that it freaks out when I go over year . bah... so... any tips for what way to go for modifying this? I find it hard to believe that no one before me had this problem.. mayb

Re: [R] barplot with chopped bars

2009-09-22 Thread Jim Lemon
On 09/23/2009 09:24 AM, Lars Skjærven wrote: Great. Thanks for a quick reply. That will work I guess. Although, can I use float values instead of dates? so that the "gantt.info" starts and end values are floats instead of dates? or will I have to work around this ? Hi Lars, Try this for time

Re: [R] chage the output file name

2009-09-22 Thread Duncan Murdoch
On 22/09/2009 8:19 PM, Rolf Turner wrote: On 23/09/2009, at 12:14 PM, Henrique Dallazuanna wrote: Try this: treeName <- "PINE" write.table(d, file = sprintf("C:/%sheight.txt", treeName)) Why not use the (less esoteric) paste() function? The printf() family of functions are one of the good

Re: [R] chage the output file name

2009-09-22 Thread Rolf Turner
On 23/09/2009, at 12:14 PM, Henrique Dallazuanna wrote: Try this: treeName <- "PINE" write.table(d, file = sprintf("C:/%sheight.txt", treeName)) Why not use the (less esoteric) paste() function? cheers, Rolf Turner ##

Re: [R] Subsetting dataframes based on column names

2009-09-22 Thread Henrique Dallazuanna
You can use intersect also: dat.a[intersect(names(dat.a), names(dat.b))] On Tue, Sep 22, 2009 at 6:58 PM, Corey Sparks wrote: > Dear R users, > I am interested in taking the columns from multiple dataframes, the problem > is that the different dataframes have different combinations of the same

Re: [R] chage the output file name

2009-09-22 Thread Henrique Dallazuanna
Try this: treeName <- "PINE" write.table(d, file = sprintf("C:/%sheight.txt", treeName)) On Tue, Sep 22, 2009 at 5:29 PM, Marcio Resende wrote: > > After I run my script I save all my output e.g. > > write.table(d, file = "C:/PINEheight.txt) > write.table(v, file = "C:/PINEvolume.txt) > write.ta

Re: [R] Correlate two time series

2009-09-22 Thread milton ruser
Have you looked at ts() ? On Tue, Sep 22, 2009 at 5:49 PM, Maggie wrote: > I was wondering how to correlate two time series in R? I have to > plotted waver files I need to correlate to one another to see how well > they align.. > > Any guidance would be very much appreciated! > > ___

Re: [R] Creating loops with strings

2009-09-22 Thread Duncan Murdoch
On 22/09/2009 4:50 PM, Rakknar wrote: Hello. I'm trying to run a series of commands in two different datasets. For make it efficient I want to make a loop for it. Until now the only command for loops i found it's the for() command it's only for series of numbers and not a series of strings, W

[R] Correlate two time series

2009-09-22 Thread Maggie
I was wondering how to correlate two time series in R? I have to plotted waver files I need to correlate to one another to see how well they align.. Any guidance would be very much appreciated! __ R-help@r-project.org mailing list https://stat.ethz.ch/m

[R] chage the output file name

2009-09-22 Thread Marcio Resende
After I run my script I save all my output e.g. write.table(d, file = "C:/PINEheight.txt) write.table(v, file = "C:/PINEvolume.txt) write.table(v, file = "C:/PINEdiameter.txt) write.table(v, file = "C:/PINEdensity.txt) and then I would like to run again with another tree and save again e.g write

Re: [R] Superimposing (aligning) two graphs

2009-09-22 Thread milton ruser
Hi Maggie: 1) plot() combined with lines() may do the job. 2) google "R graph gallery" bests milton On Tue, Sep 22, 2009 at 5:23 PM, Maggie wrote: > Hello, I need to superimpose two graphs (plotted representations of > waver files) so I can see how much they align. Is there a quick and > di

[R] Question about the negative binomial hurdle model with random effect using REML.

2009-09-22 Thread Sunghee Kim
Dear All, I am wondering about the fitting negative binomial(NB) hurdle model with random effect using REML estimation method in R. We can fit regular hurdle model without random effect using ML method as following. hurdle(pkg) But, I couldn't figure out how I can fit NB hurdle model with ra

[R] Question about zero-inflated poisson with REML.

2009-09-22 Thread Sunghee Kim
Dear All, As you know, glmmADMB package use ML method for estimation. Is it possible to use REML estimation method for zero-inflated Poisson distribution? For ML method, poi_ML <- glmm.admb(los ~ psihigh + trt.mod + trt.high + psihigh*trt.mod + psihigh*trt.high + 1, random = ~1, group="site", fam

[R] Creating loops with strings

2009-09-22 Thread Rakknar
Hello. I'm trying to run a series of commands in two different datasets. For make it efficient I want to make a loop for it. Until now the only command for loops i found it's the for() command it's only for series of numbers and not a series of strings, witch it's what i'm needing. It would be som

[R] Superimposing (aligning) two graphs

2009-09-22 Thread Maggie
Hello, I need to superimpose two graphs (plotted representations of waver files) so I can see how much they align. Is there a quick and dirty way to do it in R? thanks so much for your help! __ R-help@r-project.org mailing list https://stat.ethz.ch/ma

Re: [R] barplot with chopped bars

2009-09-22 Thread Lars Skjærven
Great. Thanks for a quick reply. That will work I guess. Although, can I use float values instead of dates? so that the "gantt.info" starts and end values are floats instead of dates? or will I have to work around this ? Thanks again, Lars On Tue, Sep 22, 2009 at 2:42 PM, David Winsemius wrote: >

Re: [R] Singular model.matrix of nested designs

2009-09-22 Thread Peng Yu
On Tue, Sep 22, 2009 at 5:00 PM, Uwe Ligges wrote: > > > Peng Yu wrote: >> >> Hi, >> >> I want to do ANOVA for nested designs like following. I don't >> understand why the matrix (t(X) %*% X) is singular. Can somebody help >> me understand it? > > > Yes: > > A=1 is never combined with B=4, B=5, or

Re: [R] Semi continous variable- define bounds using lpsolve

2009-09-22 Thread Hans W. Borchers
But of course, it is always possible to emulate a semi-continuous variable by introducing a binary variable and use some "big-M" trick. That is, with a new binary variable b we add the following two conditions: x3 - 3.6 * b >= 0 and x3 - 10 * b <= 0 # Big-M trick, here M >= 10

Re: [R] Subsetting dataframes based on column names

2009-09-22 Thread David Winsemius
On Sep 22, 2009, at 5:58 PM, Corey Sparks wrote: Dear R users, I am interested in taking the columns from multiple dataframes, the problem is that the different dataframes have different combinations of the same variable names, here's a simple example: a<-rep(1:10) b<-rep(1:10) c<-rep(21:3

Re: [R] Singular model.matrix of nested designs

2009-09-22 Thread Uwe Ligges
Peng Yu wrote: Hi, I want to do ANOVA for nested designs like following. I don't understand why the matrix (t(X) %*% X) is singular. Can somebody help me understand it? Yes: A=1 is never combined with B=4, B=5, or B=6 A=2 is never combined with B=1, B=2, or B=3 hence you cannot estimate y

[R] Subsetting dataframes based on column names

2009-09-22 Thread Corey Sparks
Dear R users, I am interested in taking the columns from multiple dataframes, the problem is that the different dataframes have different combinations of the same variable names, here's a simple example: a<-rep(1:10) b<-rep(1:10) c<-rep(21:30) d<-rep(31:40) dat.a<-data.frame(a,b,c,d) names(d

Re: [R] No parametric methods

2009-09-22 Thread David Winsemius
On Sep 22, 2009, at 11:35 AM, Alon Ben-Ari wrote: Hello I am interested in finding out a method of power analysis (effect size and sample size calculation ) using R in non parametric methods? I am running R 2.8.1 running on linux open SUSE Any libraries or documentation , I was not bale

Re: [R] R crashes when packages 'impute' and 'GeneMeta' are used together.

2009-09-22 Thread Vassilis Golfinopoulos
Dear all, it seems that my original diagnosis (using impute together with GeneMeta) was not correct. Something else is causing the crash (R-console stops working). I will return for questions (probably at the Bioconductor mailing list) after I have investigated the problem further. Thank you

Re: [R] barplot with chopped bars

2009-09-22 Thread David Winsemius
I think you might be looking for a Gantt chart: http://finzi.psych.upenn.edu/R/library/plotrix/html/gantt.chart.html On Sep 22, 2009, at 5:14 PM, Lars Skjærven wrote: Dear R users, I want to make a barplot with bars that can be non-continuous. An example will be the presence and absence of s

Re: [R] Data frame column name as function argument?

2009-09-22 Thread David Winsemius
On Sep 22, 2009, at 5:07 PM, bamsel wrote: Any help is very much appreciated. The following is a toy example: #1. Create a data frame with two named columns (x,y): DF <- data.frame(cbind(x=1:5, y=6:10)) DF x y 1 1 6 2 2 7 3 3 8 4 4 9 5 5 10 #2. Define a function to compute the sum o

Re: [R] barplot with chopped bars

2009-09-22 Thread Jim Lemon
On 09/23/2009 07:14 AM, Lars Skjærven wrote: Dear R users, I want to make a barplot with bars that can be non-continuous. An example will be the presence and absence of some events over time, e.g. a bunch of people that are either in the office or not in the office, for some period of time. I wan

Re: [R] any way to make it work faster (deleting rows that contain certain values)

2009-09-22 Thread Charles C. Berry
On Tue, 22 Sep 2009, Dimitri Liakhovitski wrote: Hello, dear R'ers, index<-expand.grid(1:7,1:4,1:4,1:4,1:4,1:4,1:4,1:4,1:4,1:4,1:4) In this case, dim(index) is 7,340,032 (!) and 11. I realize it's huge. Then, I am trying to get rid of the undesired combinations of columns. They should not con

Re: [R] Help with output height

2009-09-22 Thread Scott Sherrill-Mix
Cutting and pasting is probably a bad idea with 2000 lines of code. You might want to save your 2000 lines to a file and then source it. e.g. source('myHugeFile.R') I think (I don't have a GUI version handy) there's a dropdown menu option for sourcing files in the File menu of the GUI too if you'

[R] barplot with chopped bars

2009-09-22 Thread Lars Skjærven
Dear R users, I want to make a barplot with bars that can be non-continuous. An example will be the presence and absence of some events over time, e.g. a bunch of people that are either in the office or not in the office, for some period of time. I want to visualize this in a bar plot like this: P

[R] Data frame column name as function argument?

2009-09-22 Thread bamsel
Any help is very much appreciated. The following is a toy example: > #1. Create a data frame with two named columns (x,y): > DF <- data.frame(cbind(x=1:5, y=6:10)) > DF x y 1 1 6 2 2 7 3 3 8 4 4 9 5 5 10 > #2. Define a function to compute the sum of a given column: > foo.fnc = function

Re: [R] Semi continous variable- define bounds using lpsolve

2009-09-22 Thread Hans W. Borchers
I played around a bit with the original 'lp-solve' program --- i.e., not the R package but the program to be downloaded from Sourceforge ---, at least version 5.5.0.15 through its IDE. I was not even able to reproduce the example on semi-continuous variables in the reference documentation at

Re: [R] Evaluating expresssions as parameter values

2009-09-22 Thread Erich Neuwirth
Thanks, that completely solves the problem. On Sep 22, 2009, at 10:27 PM, Gabor Grothendieck wrote: Try parse(text=...): f <- function(fo, data, groups) { g <- do.call("xyplot", list(as.formula(fo), groups = parse(text = groups), data)) print(g) } f("yield ~ va

Re: [R] fft help

2009-09-22 Thread Rolf Turner
On 17/09/2009, at 3:39 AM, delic wrote: I wrote a script that I anticipating seeing a spike at 10Hz with the function 10* sin(2*pi*10*t). I can't figure out why my plots do not show spikes at the frequencies I expect. Am I doing something wrong or is my expectations wrong? (a) Is this a

Re: [R] Evaluating expresssions as parameter values

2009-09-22 Thread Gabor Grothendieck
Try parse(text=...): f <- function(fo, data, groups) { g <- do.call("xyplot", list(as.formula(fo), groups = parse(text = groups), data)) print(g) } f("yield ~ variety | site", data = barley, groups = "year") On Tue, Sep 22, 2009 at 4:20 PM, Erich Neuwirth wrote

Re: [R] Evaluating expresssions as parameter values

2009-09-22 Thread Erich Neuwirth
Thank you, this works for my example. On Sep 22, 2009, at 9:17 PM, Gabor Grothendieck wrote: > > f <- function(fo, data, groups) { > g <- do.call("xyplot", list(as.formula(fo), groups = as.name > (groups), data)) > print(g) > } But xyplot allows expressions for the groups parameter a

[R] Help with output height

2009-09-22 Thread Paula Fergnani Salvia
Hello everyone I have a problem using the R console. I have written 2000 lines in a notepad, this lines are commands for reading dbf files. When I paste these lines in the R console I can only visualize the end of the output, this is because the R console has a default number of rows which is sm

Re: [R] how to convert character string with only month and year into date

2009-09-22 Thread Sean Zhang
David, Gabor, and Henriuqe, Thanks a lot for help! Another (inelegant) way is to use ts() and then supply the start and end time. this inelegant way works (I guess at least for equally spaced data.) . -Sean On Tue, Sep 22, 2009 at 3:19 PM, David Winsemius wrote: > > On Sep 22, 2009, at 3:03 PM

Re: [R] how to convert character string with only month and year into date

2009-09-22 Thread David Winsemius
On Sep 22, 2009, at 3:03 PM, Sean Zhang wrote: Dear R helpers. I am new to plotting time data using R. wonder how to convert character time info into date in R. I searched over the web but did not find answer. the input character string is something like 03_1993 or 03-1993, so the precisio

Re: [R] how to convert character string with only month and year into date

2009-09-22 Thread Gabor Grothendieck
Try this: > library(zoo) # as.yearmon > > as.yearmon("03_1993", "%m_%Y") [1] "Mar 1993" > as.Date(as.yearmon("03_1993", "%m_%Y")) [1] "1993-03-01" On Tue, Sep 22, 2009 at 3:03 PM, Sean Zhang wrote: > Dear R helpers. > > I am new to plotting time data using R. > wonder how to convert character ti

Re: [R] Evaluating expresssions as parameter values

2009-09-22 Thread Gabor Grothendieck
Try this: f <- function(fo, data, groups) { g <- do.call("xyplot", list(as.formula(fo), groups = as.name(groups), data)) print(g) } f("yield ~ variety | site", data = barley, groups = "year") On Tue, Sep 22, 2009 at 3:03 PM, Erich Neuwirth wrote: > I need to play games with a

Re: [R] how to convert character string with only month and year into date

2009-09-22 Thread Henrique Dallazuanna
Try this: strptime(paste(1, c("03_1993")),"%d %m_%Y") strptime(paste(1, c("03-1993")),"%d %m_%Y") On Tue, Sep 22, 2009 at 4:03 PM, Sean Zhang wrote: > Dear R helpers. > > I am new to plotting time data using R. > wonder how to convert character time info into date in R. > I searched over the web

Re: [R] R PNG graph width limitation

2009-09-22 Thread Henrik Bengtsson
You *have to* report sessionInfo() when you ask for this kind of help. It might be that the PNG is actually generated, but it is the viewer that cannot display it. You can check with other viewers or editors. You can also try to downscale using ImageMagick, e.g. convert -geometry 10% large.png

[R] how to convert character string with only month and year into date

2009-09-22 Thread Sean Zhang
Dear R helpers. I am new to plotting time data using R. wonder how to convert character time info into date in R. I searched over the web but did not find answer. the input character string is something like 03_1993 or 03-1993, so the precision is at month level. I tried the following but failed

[R] Evaluating expresssions as parameter values

2009-09-22 Thread Erich Neuwirth
I need to play games with an expression similar to the following one: print(xyplot(DepVar ~ Group|Covar, groups=Othergroup, data=mydf, pch = 18 ,main="Testcase",auto.key = TRUE)) The problem is that the formula argument (the first argument) an the groups argument are passed over from a

Re: [R] cut and re-factor data

2009-09-22 Thread johannes rara
Try e.g. function recode from package car. 2009/9/22 Chris Hane : > Hello R-users, > I have a data frame with a factor of ages in 5 year increments, and various > count data for each age group. I only have this summary information in R at > the moment. > > I want to create a new factor that aggreg

Re: [R] microarray analysis in R without replicates

2009-09-22 Thread johannes rara
Try asking bioconductor list http://www.bioconductor.org/docs/postingGuide.html -Johannes 2009/9/22 Rainer Tischler : > Dear all, > > I have received a microarray data set in standard Affymetrix CEL-format > consisting of only six samples  without any replicates (same organism and > cell type,

Re: [R] how to force R to evaluate variable?

2009-09-22 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of YUPU LIANG > Sent: Tuesday, September 22, 2009 11:24 AM > To: r-help@r-project.org > Subject: [R] how to force R to evaluate variable? > > Hi, > > I want to construct a list as

Re: [R] how to force R to evaluate variable?

2009-09-22 Thread Uwe Ligges
Henrique Dallazuanna wrote: Try this: as.list(c(object_1, object_2)) On Tue, Sep 22, 2009 at 3:23 PM, YUPU LIANG wrote: Hi, I want to construct a list as Lst <- list(name_1=object_1, ..., name_m=object_m) If name_1 is a variable with value "NAME1", how can I ask R to use "NAME1" instead

Re: [R] how to force R to evaluate variable?

2009-09-22 Thread Duncan Murdoch
On 9/22/2009 2:23 PM, YUPU LIANG wrote: Hi, I want to construct a list as Lst <- list(name_1=object_1, ..., name_m=object_m) If name_1 is a variable with value "NAME1", how can I ask R to use "NAME1" instead of 'name_1' as the name of the list element? Lst <- list(object_1, ..., object_m)

Re: [R] how to force R to evaluate variable?

2009-09-22 Thread Henrique Dallazuanna
Try this: as.list(c(object_1, object_2)) On Tue, Sep 22, 2009 at 3:23 PM, YUPU LIANG wrote: > Hi, > > I want to construct a list as > > Lst <- list(name_1=object_1, ..., name_m=object_m) > > If name_1 is a variable with value "NAME1", how can I ask R to use > "NAME1" instead of 'name_1' as the n

[R] how to force R to evaluate variable?

2009-09-22 Thread YUPU LIANG
Hi, I want to construct a list as Lst <- list(name_1=object_1, ..., name_m=object_m) If name_1 is a variable with value "NAME1", how can I ask R to use "NAME1" instead of 'name_1' as the name of the list element? Thanks! Yupu [[alternative HTML version deleted]] _

[R] any way to make it work faster (deleting rows that contain certain values)

2009-09-22 Thread Dimitri Liakhovitski
Hello, dear R'ers, index<-expand.grid(1:7,1:4,1:4,1:4,1:4,1:4,1:4,1:4,1:4,1:4,1:4) In this case, dim(index) is 7,340,032 (!) and 11. I realize it's huge. Then, I am trying to get rid of the undesired combinations of columns. They should not contain identical values in any 2 columns. Also if colu

Re: [R] R PNG graph width limitation

2009-09-22 Thread Yihui Xie
Well, if you don't care about its width, I'd suggest you use the pdf() device instead, e.g. # 200 inches! pdf("hugeplot.pdf", width = 200, height = 200) par(mar = rep(0, 4)) plot(rnorm(1), pch = 19) dev.off() Regards, Yihui -- Yihui Xie Phone: 515-294-6609 Web: http://yihui.name Department o

Re: [R] How to sort the elements in a matrix?

2009-09-22 Thread David Winsemius
On Sep 22, 2009, at 1:20 PM, FMH wrote: Dear All, Let ab is the combination of matrices a and b. a <- matrix(c(1,2,3,4), nrow = 2, ncol = 2) b <- matrix(c(4,3,1,2), nrow = 2, ncol = 2) ab <- rbind(a, b) From matrix ab, could someone give some advice on the way to sort all elements in colu

Re: [R] Plotting waver files

2009-09-22 Thread Uwe Ligges
blahbleh wrote: Is there a good tutorial or just sample code on how to plot .wav files in R? I would really appreciate it! See for example packages tuneR or seewave Best wishes, Uwe Ligges __ R-help@r-project.org mailing list https://stat.ethz.

Re: [R] Create directory and copy files in R

2009-09-22 Thread milton ruser
Tammy Try avoid directories with spaces... may be this solve your problem. Case not, write us again. bests milton On Mon, Sep 21, 2009 at 10:05 AM, Tammy Ma wrote: > > > HI, All R users, > > My problem is: > > > fn > [1] "C:/Documents and > Settings/lma/Desktop/FamilyAEntrepreneurs/Entrepreneu

Re: [R] run R script automatically by double-clicking WinXP desktop icon

2009-09-22 Thread cryan
that helps, thanks. I can put a final line in my batch file that opens a viewer for the png graph. I was hoping to find a way to do make it run in the Rgui (picky, I know.) My graph is clearer in the default graph device that pops up in the Rgui; it's blurry in the Windows viewer for png files

Re: [R] How to sort the elements in a matrix?

2009-09-22 Thread Daniel Malter
ab[order(ab[,1]),] - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von FMH Gesendet: Tuesday, September 22, 2009 1:20 PM An: r-help@r-project.org B

Re: [R] How to sort the elements in a matrix?

2009-09-22 Thread Steve Lianoglou
Hi, On Sep 22, 2009, at 1:20 PM, FMH wrote: Dear All, Let ab is the combination of matrices a and b. a <- matrix(c(1,2,3,4), nrow = 2, ncol = 2) b <- matrix(c(4,3,1,2), nrow = 2, ncol = 2) ab <- rbind(a, b) From matrix ab, could someone give some advice on the way to sort all elements in

[R] How to sort the elements in a matrix?

2009-09-22 Thread FMH
Dear All, Let ab is the combination of matrices a and b. a <- matrix(c(1,2,3,4), nrow = 2, ncol = 2) b <- matrix(c(4,3,1,2), nrow = 2, ncol = 2) ab <- rbind(a, b)   >From matrix ab, could someone give some advice on the way to sort all elements >in column 2, by the sequence of the elements in c

Re: [R] Problem in using BATCH command

2009-09-22 Thread Yihui Xie
BATCH is not an R object, and it is not for use in R console. As Henrik mentioned, you should use it in the command line. Open a terminal window/command window (depending on your OS), and type "R CMD BATCH ..." there. If you are using Windows, cd to the 'bin' directory of R first (or put the 'bin'

Re: [R] R PNG graph width limitation

2009-09-22 Thread Yihui Xie
Given the DPI=72, do you really need a graph that's wider than 450 inches? Or can you really read a picture that is so wide? Regards, Yihui -- Yihui Xie Phone: 515-294-6609 Web: http://yihui.name Department of Statistics, Iowa State University 3211 Snedecor Hall, Ames, IA On Tue, Sep 22, 2009

Re: [R] cox memory

2009-09-22 Thread David Winsemius
I did not test to see if the design of the data.frame you offered was valid input to your model, since you did not provide a means to test it within R. I only meant to say that creating a very long vector with identical entries should not be necessary if the newdata argument were constructe

Re: [R] How to combine matrices?

2009-09-22 Thread Zhiliang Ma
rbind(a, b, c) another function you might be interested in is cbind. cheers, On Tue, Sep 22, 2009 at 9:40 AM, FMH wrote: > Dear All, > > Let a, b and c are three matrices with same no. of column but different no. > of row. > > a <- matrix(1, 1, 2) > b <- matrix(2, 2, 2) > c <- matrix(3, 3, 2)

Re: [R] Create directory and copy files in R

2009-09-22 Thread Henrik Bengtsson
See copyDirectory() in the R.utils package. /hb On Tue, Sep 22, 2009 at 9:43 AM, Yihui Xie wrote: > You assigned values to 'fn' and 'dpath' outside the function body and > use these names as the arguments of your function, so actually 'cyfun' > does not know what 'fn' and 'path' are. The solution

Re: [R] How to combine matrices?

2009-09-22 Thread Henrique Dallazuanna
abc <- rbind(a, b, c) On Tue, Sep 22, 2009 at 1:40 PM, FMH wrote: > Dear All, > > Let a, b and c are three matrices with same no. of column but different no. > of row. > > a <- matrix(1, 1, 2) > b <- matrix(2, 2, 2) > c <- matrix(3, 3, 2) > > Could someone help me to combine these matrices toget

Re: [R] How to combine matrices?

2009-09-22 Thread Daniel Malter
is rbind(a,b,c) what you mean? Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von FMH Gesendet: Tuesday, September 22, 2009 12:40 PM An: r-h

Re: [R] Create directory and copy files in R

2009-09-22 Thread Yihui Xie
You assigned values to 'fn' and 'dpath' outside the function body and use these names as the arguments of your function, so actually 'cyfun' does not know what 'fn' and 'path' are. The solution is to put them in the arguments as default values: cyfun <- function(fn = "C:/Documents and Settings/lma

[R] How to combine matrices?

2009-09-22 Thread FMH
Dear All, Let a, b and c are three matrices with same no. of column but different no. of row. a <- matrix(1, 1, 2) b <- matrix(2, 2, 2) c <- matrix(3, 3, 2) Could someone help me to combine these matrices together as a single matrix? Thank you Fir __

Re: [R] Latex using expression

2009-09-22 Thread Henrique Dallazuanna
Try this: plot(x, y, xlab=expression(x=sqrt(x[0], 4)),ylab=expression(y=sqrt(x[0], 4))) On Tue, Sep 22, 2009 at 1:07 PM, amor Gandhi wrote: > Hi all, > > I would like to write the following latex code in a plot x=\sqrt[4]{x[0]} > using > > x0 <- rgamma(1000,2,1) > y0 <- rgamma(100,2,1) > x <- x

[R] R PNG graph width limitation

2009-09-22 Thread zphnabr
Hi folks, I am trying to do a clustering and generate a long dendrogram in R on Linux server: = data<-read.table(file="mean_ratio.txt.noheader",row.names=1,sep="\t",quote="\"") hc<-hclust(dist(data),"ward") png(file="mean_ratio.txt.noheader.ward.png",bg="white",pointsize=8,width=32767,hei

[R] glm analysis repeated for 900 variables

2009-09-22 Thread Terwisscha van Scheltinga, A.
Dear R users, Could you help my with the following problem? I want to repeat a glm analysis with 2 independent variables for all 900 variables (snps) in my data set. So, I want to check whether snp1 has a different effect on my outcome variable in patients and controls(phenotype). And repeat that

[R] cox memory

2009-09-22 Thread Λεωνίδας Μπαντής
If I use the following newdata=data.frame(chemo1=0, horm1=0, age1=mean(age1), grade1=0, positive1=1, size1=mean(size1)   ) then I get Error in model.frame.default(Terms, newdata, ...) :   variable lengths differ (found for 'log(tstop + 1)') In addition: Warning message: 'newdata' had 1 rows b

Re: [R] Problem in using BATCH command

2009-09-22 Thread Henrik Bengtsson
You probably want to use the source() command in R. R CMD BATCH is used from the command line - it's rare that people use it (unless they really know what they are doing). /Henrik On Tue, Sep 22, 2009 at 9:01 AM, Manuj Sharma wrote: > I tried to use BATCH command to run an input file (a simple

[R] cut and re-factor data

2009-09-22 Thread Chris Hane
Hello R-users, I have a data frame with a factor of ages in 5 year increments, and various count data for each age group. I only have this summary information in R at the moment. I want to create a new factor that aggregates the age factors if the existing factors have insufficient counts. Then I

Re: [R] Coordinates of the current plot

2009-09-22 Thread Duncan Murdoch
On 9/22/2009 11:04 AM, p...@orbit.umbr.cas.cz wrote: Hi, Is is possible to obtain/ get coordinates of the current graphics? I am using plot function for hclust object and I want to add some additional graphics but I cannot figure out what ylim and xlim is used for actual ploting of tree. I know

[R] Coordinates of the current plot

2009-09-22 Thread petr
Hi, Is is possible to obtain/ get coordinates of the current graphics? I am using plot function for hclust object and I want to add some additional graphics but I cannot figure out what ylim and xlim is used for actual ploting of tree. I know that I can probably used ploting of dendrogram instead

[R] tkmessageBox font size

2009-09-22 Thread srpd TCLTK
Hi, I´m using the tkmessageBox widget of package tcltk. I would like to change the font size of the message. How can I do it? Thanks in advance, Srpd Partilhe as suas memórias com quem quer que deseja. Com quem quer que deseja. ___

[R] Latex using expression

2009-09-22 Thread amor Gandhi
Hi all, I would like to write the following latex code in a plot x=\sqrt[4]{x[0]} using x0 <- rgamma(1000,2,1) y0 <- rgamma(100,2,1) x <- x0^0.25 y <- y0^0.25  plot(x, y,xlab=expression(x=sqrt[4]{x[0]}),ylab=expression(y=sqrt[4]{y[0]})) Many thanks, Amor [[alternative HTML vers

Re: [R] How to handle missing values for the GeneMeta package?

2009-09-22 Thread Payam Minoofar
I am not sure if this is the solution you want, but complete.cases will remove rows that contain any NA values at all from a matrix. These lines get rid of NA values in my little function: predmat1 <<- as.matrix(predmat[complete.cases(predmat,respmat),]) respmat1 <<- as.matrix(re

[R] Problem in using BATCH command

2009-09-22 Thread Manuj Sharma
I tried to use BATCH command to run an input file (a simple text file) which contained a few R commands. I first saw the BATCH help page using > ?BATCH The help page mentioned the Usage as: Batch Execution of RR CMD BATCH [options] infile [outfile] The Detailed section mentioned the follow

Re: [R] How to get the current script file name in the script?

2009-09-22 Thread Gabor Grothendieck
Try this one line R script: print(sub(".*=", "", commandArgs()[4])) Also see the geopt package for fancier handling of arguments. On Tue, Sep 22, 2009 at 11:47 AM, Peng Yu wrote: > Hi, > > Right now, I hardcode the file name in the script. But when I change > the script name, I have to change t

  1   2   >