[R] Displaying a table using traitr

2010-05-23 Thread Amitoj S. Chopra
I am trying to display a table with traitr. I am using the function tableitem apart of traitr. I am not sure how to enter it. I enter my data as a table in R (as list2) but im not sure how to use that function tableitem(list2) but that doesnt seem to work. I would rather not edit it just display t

Re: [R] AM/PM strptime %p failing 2.11.0 WinXP

2010-05-23 Thread Prof Brian Ripley
On Mon, 24 May 2010, Samuel Dennis wrote: I am attempting to import dates in the following format to R: 5/20/2010 6:45:32 PM Unfortunately I am unable to get the AM/PM function (%p) to work correctly under either 2.11.0 or 2.8.1. strptime("5/20/2010 6:45:32 PM", "%m/%d/%Y %I:%M:%S %p") [1] NA

Re: [R] sum of certain length

2010-05-23 Thread Gabor Grothendieck
If the days are consecutive with no missing rows then the dates don't need to be calculated and it could be represented as a ts series with a frequency of 7. Just aggregate it down to a frequency of 1: rain <- ts(dat$rain, freq = 7) aggregate(rain, 1) If there are missing rows (or even the

[R] ROC curve

2010-05-23 Thread Changbin Du
HI, Dear R community, I want to know how to select the optimal decision threshold from the ROC curve? At what threshold will give the highest accuracy? Thanks! -- Sincerely, Changbin -- [[alternative HTML version deleted]] __ R-help@r-projec

Re: [R] high-dimensional contingency table

2010-05-23 Thread David Winsemius
On May 23, 2010, at 8:41 PM, Claudia Rodriguez wrote: Dear Friends. I am just starting to use R. And in this occasion I want to construct a high-dimensional contingency table, because I want to crate a mosaic plot with the vcd package. My table is in this format: año ac.repcat.gru

Re: [R] SAS for R-users

2010-05-23 Thread Thomas Levine
Thanks for the suggestions! This will keep me busy for a while. Tom 2010/5/15 Muenchen, Robert A (Bob) : >> Thomas Levine wrote: >>Bob Muenchen says that 'Ralph O’Brien says that >>in a few years there will be so many students >>graduating knowing mainly R that [he]’ll need to >>write, “SAS for R

Re: [R] AM/PM strptime %p failing 2.11.0 WinXP

2010-05-23 Thread Mario Valle
I know it is not very useful to you, but on Vista with 2.11.patched it works: > strptime("5/20/2010 6:45:32 PM", "%m/%d/%Y %I:%M:%S %p") [1] "2010-05-20 18:45:32" > strptime("5/20/2010 6:45:32", "%m/%d/%Y %I:%M:%S") [1] "2010-05-20 06:45:32" > > sessionInfo() R version 2.11.0 Patched (2010-04-26

[R] AM/PM strptime %p failing 2.11.0 WinXP

2010-05-23 Thread Samuel Dennis
I am attempting to import dates in the following format to R: 5/20/2010 6:45:32 PM Unfortunately I am unable to get the AM/PM function (%p) to work correctly under either 2.11.0 or 2.8.1. > strptime("5/20/2010 6:45:32 PM", "%m/%d/%Y %I:%M:%S %p") [1] NA but > strptime("5/20/2010 6:45:32", "%m/%d/

[R] high-dimensional contingency table

2010-05-23 Thread Claudia Rodriguez
Dear Friends. I am just starting to use R. And in this occasion I want to construct a high-dimensional contingency table, because I want to crate a mosaic plot with the vcd package. My table is in this format: año ac.repcat.gru conteos 1 2005 Rparejas 253 2 2005 Npa

Re: [R] Error in FUN(X[[1L]], ...) : STRING_ELT() can only be applied to a 'character vector', not a 'integer'

2010-05-23 Thread sedm1000
Thanks for your time with this. Erik's solution works best to deal with the input... I'll try to reshape the output back into the appropriate columns. David, fold(sq$s1) only outputs the result for the first sequence in the list I'm afraid. The 'fold' function doesn't deal well with spaces... Th

[R] library location and error messages when loading packages

2010-05-23 Thread Daisy Englert Duursma
Hello, I am running R on a server that several people share. Previously we all had separate libraries for R. I have set up R so everyone on the server shares the same library and I downloaded the latest version of R and installed it on the main drive of our server in the "Program Files" folder (o

Re: [R] sum of certain length

2010-05-23 Thread Bill.Venables
This is one way to do it. Suppose your data is in the file "rainfall.txt", as set out below. Then > dat <- read.table("rainfall.txt", header = TRUE) > dat <- within(dat, { + date <- as.Date(paste(year, month, day, sep="-")) + week <- factor(as.numeric(date - date[1]) %/% 7) + }) > wRain <-

[R] retrieve path analysis coefficients (package agricolae)

2010-05-23 Thread Zack Holden
Dear list, I'd like to use path.analysis in the package agricolae in batch format on many files, retrieving the path coefficients for each run and appending them to a table. I don't see any posts in the help files about this package or the path.analysis package. I've tried creating an object out of

[R] sum of certain length

2010-05-23 Thread Roslina Zakaria
Hi r-users,   I have this data below.  I would like to obtain the weekly rainfall sum.  That is I would like to find sum for day 1 to day 7, day 8 - day15, and so on.    year month day rain 1  1922 1   1  0.0 2  1922 1   2  0.0 3  1922 1   3  0.0 4  1922 1   4  0.0 5  1922 1  

Re: [R] "order" issue

2010-05-23 Thread Zoppoli, Gabriele (NIH/NCI) [G]
after read.delim: 'data.frame': 60 obs. of 4 variables: $ Cell : Factor w/ 60 levels "BR:BT_549","BR:HS578T",..: 23 51 20 25 34 16 44 3 60 55 ... $ hsa-miR-204: num -4.37 -4.34 -4.33 -4.29 -4.26 ... $ hsa-miR-210: num -0.223 1.575 1.66 1.668 0.373 ... $ Tissue : Factor w/ 9 lev

[R] Split-plot design in GLM with only fixed factors.

2010-05-23 Thread Ivan Allaman
Good evening gentlemen! I have a test in split-plot with randomized block design where my answer is a binomial variable. I wonder if there is any way I can calculate the probability of my factors considering the design errors in the case are two. I looked at various threads here and elsewhere, a

Re: [R] "order" issue

2010-05-23 Thread David Winsemius
On May 23, 2010, at 6:32 PM, Zoppoli, Gabriele (NIH/NCI) [G] wrote: This is what I get: str(x) chr [1:60, 1:4] "ME:SK_MEL_5" "ME:SK_MEL_28" "ME:SK_MEL_2" ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:60] "48" "47" "46" "50" ... ..$ : chr [1:4] "Product" "hsa.miR.204" "hsa.miR.210" "Tissu

Re: [R] "order" issue

2010-05-23 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Zoppoli, > Gabriele (NIH/NCI) [G] > Sent: Sunday, May 23, 2010 3:44 PM > To: ted.hard...@manchester.ac.uk > Cc: R-help@r-project.org > Subject: Re: [R] "order" issue > > crazy s

Re: [R] "order" issue

2010-05-23 Thread Zoppoli, Gabriele (NIH/NCI) [G]
crazy stuff!!! I tried to reload the txt file, and now it's working... this is the original (attached) thanks! Gabriele Zoppoli, MD Ph.D. Fellow, Experimental and Clinical Oncology and Hematology, University of Genova, Genova, Italy Guest Researcher, LMP, NCI, NIH, Bethesda MD Work: 301-451-85

Re: [R] "order" issue

2010-05-23 Thread Zoppoli, Gabriele (NIH/NCI) [G]
This is what I get: str(x) chr [1:60, 1:4] "ME:SK_MEL_5" "ME:SK_MEL_28" "ME:SK_MEL_2" ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:60] "48" "47" "46" "50" ... ..$ : chr [1:4] "Product" "hsa.miR.204" "hsa.miR.210" "Tissue" It doesn't make much sense to me... I would like to have the se

Re: [R] "order" issue

2010-05-23 Thread Ted Harding
On 23-May-10 21:39:06, Zoppoli, Gabriele (NIH/NCI) [G] wrote: > Hi everybody, this is a real dummy thing. > > I sorted a matrix based on a given column, and what I get is right, > until it comes to columns of negative and positive values; than, > "order" orders everything from max to min in the ne

Re: [R] "order" issue

2010-05-23 Thread Zoppoli, Gabriele (NIH/NCI) [G]
I tried this, but it doesn't change the "division" between negative and positive values (see that you have first positive from max to min, and then negative from min to max, as if "order" considered only the absolute values...) Product hsa.miR.204 hsa.miR.210 Tissue 48 "ME:SK_MEL_5

Re: [R] "order" issue

2010-05-23 Thread Jim Holtman
do 'str' on your object to see if you have factors where you think you have numerics. What is the problem you are trying to solve? Sent from my iPhone. On May 23, 2010, at 17:39, "Zoppoli, Gabriele (NIH/NCI) [G]" > wrote: Hi everybody, this is a real dummy thing. I sorted a matrix based o

[R] "order" issue

2010-05-23 Thread Zoppoli, Gabriele (NIH/NCI) [G]
Hi everybody, this is a real dummy thing. I sorted a matrix based on a given column, and what I get is right, until it comes to columns of negative and positive values; than, "order" orders everything from max to min in the negative values, and then AGAIN from max to min in the positive values!

Re: [R] creating a reverse geometric sequence

2010-05-23 Thread David Winsemius
On May 23, 2010, at 1:43 PM, Erik Iverson wrote: Hello, Can anyone think of a non-iterative way to generate a decreasing geometric sequence in R? For example, for a hypothetical function dg, I would like: > dg(20) [1] 20 10 5 2 1 where I am using integer division by 2 to get each subsequ

Re: [R] creating a reverse geometric sequence

2010-05-23 Thread Ben Bolker
Erik Iverson ccbr.umn.edu> writes: > Can anyone think of a non-iterative way to generate a decreasing geometric > sequence in R? Reduce("%/%",rep(2,4),init=20,accum=TRUE) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-he

Re: [R] plotCI overlay

2010-05-23 Thread Ben Bolker
Rick Reiss exponent.com> writes: > > > I'm using the plotCI function and I'd like to overlay additional means > with CIs onto an existing plotCI-created plot in a different color. Is > this possible? Thanks. > > Rick > > Assuming you mean the one from the plotrix package: use add=TRUE

Re: [R] creating a reverse geometric sequence

2010-05-23 Thread Dan Davison
Erik Iverson writes: > Hello, > > Can anyone think of a non-iterative way to generate a decreasing > geometric sequence in R? > > For example, for a hypothetical function dg, I would like: > >> dg(20) > [1] 20 10 5 2 1 > > where I am using integer division by 2 to get each subsequent value in > t

[R] plotCI overlay

2010-05-23 Thread Rick Reiss
I'm using the plotCI function and I'd like to overlay additional means with CIs onto an existing plotCI-created plot in a different color. Is this possible? Thanks. Rick __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-hel

Re: [R] creating a reverse geometric sequence

2010-05-23 Thread Duncan Murdoch
Erik Iverson wrote: Hello, Can anyone think of a non-iterative way to generate a decreasing geometric sequence in R? For example, for a hypothetical function dg, I would like: > dg(20) [1] 20 10 5 2 1 where I am using integer division by 2 to get each subsequent value in the sequence.

[R] creating a reverse geometric sequence

2010-05-23 Thread Erik Iverson
Hello, Can anyone think of a non-iterative way to generate a decreasing geometric sequence in R? For example, for a hypothetical function dg, I would like: > dg(20) [1] 20 10 5 2 1 where I am using integer division by 2 to get each subsequent value in the sequence. There is of course: d

Re: [R] Subsetting with a list of vectors

2010-05-23 Thread David Winsemius
On May 23, 2010, at 10:00 AM, Kang Min wrote: Hi, I have a dataset that looks like the one below. data plot plantno.species H 31 ABC D 2 DEF Y 54 GFE E 12 ERF Y 98 FVD H

Re: [R] Subsetting with a list of vectors

2010-05-23 Thread Kang Min
Thanks, but what I want is not 100 groups of 7 samples. Let's say in my samp2 I get [[1]] "D" "H" "K" "S" "E" "U" "O" [[2]] "H" "S" "R" "V" "A" "L" "B" etc... I want to select all rows from 'data' containing "D" "H" "K" "S" "E" "U" "O" first, then "H" "S" "R" "V" "A" "L" "B" and so on. On May

Re: [R] Subsetting with a list of vectors

2010-05-23 Thread jim holtman
try this: > x <- read.table(textConnection("plot plantno.species + H 31 ABC + D 2 DEF + Y 54 GFE + E 12 ERF + Y 98 FVD + H 4 JKU + J 7 J

[R] Subsetting with a list of vectors

2010-05-23 Thread Kang Min
Hi, I have a dataset that looks like the one below. data plot plantno.species H 31 ABC D 2 DEF Y 54 GFE E 12 ERF Y 98 FVD H 4 JKU J 7 J

Re: [R] Re : Indexing array to 1000

2010-05-23 Thread David Winsemius
On May 22, 2010, at 10:48 PM, Mohan L wrote: Dear All, I have an array some thing like this: avglog January February March April May June July August September 60102 83397 56774 48785 49010 40572 38175 47037 51402 The class of "avglog" a

Re: [R] Re : Re : Re : Nomogram with multiple interactions (package rms)

2010-05-23 Thread Frank E Harrell Jr
On 05/23/2010 06:29 AM, Marc Carpentier wrote: Thanks for the answer. Unfortunately, I'm not yet skilled enough to do such a thing. I had a look on the code and I'll try to understand it, as a good exercise. I thought about sending fake fit objects to nomogram() derived from the original one :

Re: [R] Error in FUN(X[[1L]], ...) : STRING_ELT() can only be applied to a 'character vector', not a 'integer'

2010-05-23 Thread David Winsemius
On May 23, 2010, at 3:27 AM, Erik Iverson wrote: Hello, sedm1000 wrote: Sorry - I figured that this to be a more common defined error than anything specific to the data/function... Thanks for looking at this. The data and function are below. Creating a single line of the data.frame at a

Re: [R] Regression with sparse matricies

2010-05-23 Thread Douglas Bates
As Frank mentioned in his reply, expecting to estimate tens of thousands of fixed-effects parameters in a logistic regression is optimistic. You could start with a generalized linear mixed model instead library(lme4) fm1 <- glmer(resp ~ 1 + (1|f1) + (1|f2) + (1|f1:f2), mydata, binomial)) If you

Re: [R] need help in understanding R code, and maybe some math

2010-05-23 Thread Douglas Bates
On Sun, May 23, 2010 at 5:09 AM, Peter Ehlers wrote: > On 2010-05-23 0:56, john smith wrote: >> >> Hi, >> I am trying to implement Higham's algorithm for correcting a non positive >> definite covariance matrix. >> I found this code in R: >> >> http://projects.cs.kent.ac.uk/projects/cxxr/trac/brows

[R] Re : Re : Re : Nomogram with multiple interactions (package rms)

2010-05-23 Thread Marc Carpentier
Thanks for the answer. Unfortunately, I'm not yet skilled enough to do such a thing. I had a look on the code and I'll try to understand it, as a good exercise. I thought about sending fake fit objects to nomogram() derived from the original one : - orignal : f2<- cph(Surv(d.time,death) ~ sex*(r

Re: [R] How sample without replacement on more than one variables?

2010-05-23 Thread Bernardo Rangel Tura
On Sun, 2010-05-23 at 00:56 -0700, dusadrian wrote: > This might help, depending on your exact needs: > > v1 <- sample(letters[1:2], 10, replace=TRUE) > > v2 <- sample(letters[3:4], 10, replace=TRUE) > > v3 <- sample(letters[5:6], 10, replace=TRUE) > > aa <- data.frame(v1=v1, v2=v2, v3=v3) And now

Re: [R] Increasing the maximum number of rows

2010-05-23 Thread Tal Galili
Hello Jim, It sounds like a good time to go read about the packages bigmemory and/or ff Best, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.

Re: [R] need help in understanding R code, and maybe some math

2010-05-23 Thread Peter Ehlers
On 2010-05-23 0:56, john smith wrote: Hi, I am trying to implement Higham's algorithm for correcting a non positive definite covariance matrix. I found this code in R: http://projects.cs.kent.ac.uk/projects/cxxr/trac/browser/trunk/src/library/Recommended/Matrix/R/nearPD.R?rev=637 I managed to un

Re: [R] Increasing the maximum number of rows

2010-05-23 Thread jim holtman
You are trying to create an object with 1G elements. Given that these are integers, this will require about 4GB of space. If you are running on a 32-bit system, which has a total phyical limit of 2-3GB depending on what options you are running (at least on Windows), then you have exceeded the lim

Re: [R] How sample without replacement on more than one variables?

2010-05-23 Thread dusadrian
This might help, depending on your exact needs: > v1 <- sample(letters[1:2], 10, replace=TRUE) > v2 <- sample(letters[3:4], 10, replace=TRUE) > v3 <- sample(letters[5:6], 10, replace=TRUE) > aa <- data.frame(v1=v1, v2=v2, v3=v3) > aa v1 v2 v3 1 a d e 2 a d e 3 a c e 4 b d e 5

Re: [R] How sample without replacement on more than one variables?

2010-05-23 Thread Erik Iverson
thmsfuller...@gmail.com wrote: Hello All, sample() only sample on one variable x. But I'm interested in sampling more than one variable without replacement. Suppose I have 3 vectors x, y, z. I want to draw samples from all three vectors such that the combination of the three elements in each dr

Re: [R] Error in FUN(X[[1L]], ...) : STRING_ELT() can only be applied to a 'character vector', not a 'integer'

2010-05-23 Thread Erik Iverson
Hello, sedm1000 wrote: Sorry - I figured that this to be a more common defined error than anything specific to the data/function... Thanks for looking at this. The data and function are below. Creating a single line of the data.frame at a time will work (i.e. fold(s)) For multiple line data.f

Re: [R] Selecting first 7 elements

2010-05-23 Thread Kang Min
Thanks a lot, it works! On May 23, 3:10 pm, Erik Iverson wrote: > > "[" is a function, and you want to use it on each element of the list, > > so... > > > lapply(x, "[", c(1:7)) > > and the call to c() is of course not necessary, since ":" will generate a > vector. > > __

Re: [R] importing columns as factors

2010-05-23 Thread Erik Iverson
Caitlin Sadowski wrote: I have a large csv table I am trying to read into R. I would like each column to be of type factor. However, most columns have only numeral entries (e.g. likert scales), so are automatically imported as type numeric. Is there a way to convert ALL columns to be of type fact

[R] How sample without replacement on more than one variables?

2010-05-23 Thread thmsfuller...@gmail.com
Hello All, sample() only sample on one variable x. But I'm interested in sampling more than one variable without replacement. Suppose I have 3 vectors x, y, z. I want to draw samples from all three vectors such that the combination of the three elements in each draw is not the same as any previou

Re: [R] Selecting first 7 elements

2010-05-23 Thread Erik Iverson
"[" is a function, and you want to use it on each element of the list, so... lapply(x, "[", c(1:7)) and the call to c() is of course not necessary, since ":" will generate a vector. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailma

Re: [R] Selecting first 7 elements

2010-05-23 Thread Erik Iverson
Kang Min wrote: Hi, I have a list of 100, each list has 20 elements, and I would like to select the first 7 elements in each list. Let's take the alphabet as an example. x <- lapply(1:100, function(i) sample(LETTERS)) I tried x[[1:7]], but it doesn't work. Can anyone enlighten me on how to do

[R] importing columns as factors

2010-05-23 Thread Caitlin Sadowski
I have a large csv table I am trying to read into R. I would like each column to be of type factor. However, most columns have only numeral entries (e.g. likert scales), so are automatically imported as type numeric. Is there a way to convert ALL columns to be of type factor, without having to conv