Re: [R] ave(x, y, FUN=length) produces character output when x is character

2014-12-24 Thread Mike Miller
On Wed, 24 Dec 2014, Bert Gunter wrote: You are again misinterpreting because you have not read the docs, although this time I will grant that they are to some extent misleading. First of all, a matrix _IS_ a vector: a <- matrix(1:4, 2,2) a[3] ## vector indexing works because it is a vector

Re: [R] ave(x, y, FUN=length) produces character output when x is character

2014-12-24 Thread Bert Gunter
You are again misinterpreting because you have not read the docs, although this time I will grant that they are to some extent misleading. First of all, a matrix _IS_ a vector: > a <- matrix(1:4, 2,2) > a[3] ## vector indexing works because it is a vector [1] 3 In fact, a matrix (or array) is a

Re: [R] ave(x, y, FUN=length) produces character output when x is character

2014-12-24 Thread Mike Miller
On Wed, 24 Dec 2014, Jeff Newmiller wrote: On December 24, 2014 6:49:47 PM PST, Mike Miller wrote: On Wed, 24 Dec 2014, Mike Miller wrote: Also, regarding the sacred text, "x A numeric." is a bit terse. The same text later refers to length(x), so I suspect that "A numeric" is short for "

Re: [R] ave(x, y, FUN=length) produces character output when x is character

2014-12-24 Thread Jeff Newmiller
But all numeric types in R are vectors. So although it might be a good idea to be redundant to aid beginners, the phrase "a numeric" is accurate. --- Jeff NewmillerThe . . Go Live...

Re: [R] ave(x, y, FUN=length) produces character output when x is character

2014-12-24 Thread Mike Miller
On Wed, 24 Dec 2014, Mike Miller wrote: Also, regarding the sacred text, "x A numeric." is a bit terse. The same text later refers to length(x), so I suspect that "A numeric" is short for "A numeric vector", but that might not mean "a vector of 'numeric' type." I just realized that numeric

[R] Help with finding R tutors for microarray analysis, next generation sequencing and constructing gene interaction networks needed

2014-12-24 Thread thomas hahn
Help with finding R tutors for microarray analysis, next generation sequencing and constructing gene interaction networks needed Hi I am a visually impaired bioinformatics graduate student using microarray data for my master’s thesis aimed at deciphering the mechanism by which the yeast wild type

Re: [R] Getting HR from Cox model in R

2014-12-24 Thread Ruzan Udumyan
Dear Michael, Thank you very much for your reply. The more complete information is as follows: I want to do a mediation analysis following the below-mentioned syntax from: http://www.biomedcentral.com/content/supplementary/1471-2288-14-9-s1.pdf I did not define categorical variables as logical v

Re: [R] ave(x, y, FUN=length) produces character output when x is character

2014-12-24 Thread William Dunlap
> ave( as.character(1:5), gl(2,2,5), FUN=length ) [1] "3" "3" "2" "2" "3"The output has character type, but it is supposed to be a collection of vector lengths. ave() uses its first argument, 'x', to set the length of its output and to make an initial guess at the type of its output. The re

Re: [R] ave(x, y, FUN=length) produces character output when x is character

2014-12-24 Thread Nordlund, Dan (DSHS/RDA)
Mike, The output is only limited by available RAM and the maximum permissible length for vectors. And you can test it fairly easily. vec <- sample(1:2000,1,replace=TRUE) Dan Daniel J. Nordlund, PhD Research and Data Analysis Division Services & Enterprise Support Administration Washington

Re: [R] ave(x, y, FUN=length) produces character output when x is character

2014-12-24 Thread Mike Miller
On Wed, 24 Dec 2014, Nordlund, Dan (DSHS/RDA) wrote: For your character vector example, this will get you the counts. table(charvec)[charvec] Hope this is helpful, It does help, Dan! I came up with the same idea and expanded on it a bit to work properly with other kinds of vectors: as.v

Re: [R] ave(x, y, FUN=length) produces character output when x is character

2014-12-24 Thread Mike Miller
On Wed, 24 Dec 2014, Bert Gunter wrote: You said: "The elements of the first vector are irrelevant because they are only counted, so we should get the same result if it were a character vector, but we don't: " You don't get to invent your own rules! ?ave -- always nice to read the Help docs **

Re: [R] ave(x, y, FUN=length) produces character output when x is character

2014-12-24 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Mike > Miller > Sent: Wednesday, December 24, 2014 11:31 AM > To: R-Help List > Subject: [R] ave(x, y, FUN=length) produces character output when x is > character > > R 3.0.1 on Linux 64... > > I was wo

Re: [R] ave(x, y, FUN=length) produces character output when x is character

2014-12-24 Thread Bert Gunter
You said: "The elements of the first vector are irrelevant because they are only counted, so we should get the same result if it were a character vector, but we don't: " You don't get to invent your own rules! ?ave -- always nice to read the Help docs **before posting** -- clearly states that the

[R] ave(x, y, FUN=length) produces character output when x is character

2014-12-24 Thread Mike Miller
R 3.0.1 on Linux 64... I was working with someone else's code. They were using ave() in a way that I guess is nonstandard: Isn't FUN always supposed to be a variant of mean()? The idea was to count for every element of a factor vector how many times the level of that element occurs in the f

Re: [R] Carrying a value down a data.frame conditionally

2014-12-24 Thread William Dunlap
A while ago I wrote for a questioner on this list a function, 'f1', below, that would give the start and stop times of runs of data that started when then the data went above a threshold and stopped when it first dropped below a different (lower) threshold). It used no loops and was pretty quick.

[R] plot=FALSE in heatmap.2

2014-12-24 Thread Jinyan
Dear expert, I want to get the calucation from heatmap.2. But I do not want to do the plot. Is there any trick do this, e.g, plot=FALSE in heatmap.2? hm <- heatmap.2(dat.mat, col=greenred(75), dendrogram="none", scale="row",

[R] gam mgcv family=scat

2014-12-24 Thread Somers-Yeates, Robin
? Dear R users, I'm currently analysing some data with the gam function from the mgcv package. I'm looking at the relationship between spatially referenced budburst dates (recorded as number of days from January 1st) and two continuous variables, and their interaction, where they are found. I

[R] Calculating shortest path length among multiple graphs

2014-12-24 Thread 张伦
Hi, I have an edgelist network data (undirected) with multiple graphs like this. For each graph (i.e., denoted by doc.id), I want to calculate the shortest path length (SPL) between the nodes. By using the code attached below, I can only calculate the SPL for only 1 graph at a time. How can I handl

Re: [R] issue on installation of RCurl on Debian Wheezy

2014-12-24 Thread mbressan
yes, exactly! all these dependencies were missing plus some other were corrupted (but frankly I do not know why and how) now everything seems working fine... thanks a lot my best season's greetings m > I think you need to have curl-config installed. I had a similar > problem on Ubuntu and fo

Re: [R] Carrying a value down a data.frame conditionally

2014-12-24 Thread peter dalgaard
> On 23 Dec 2014, at 23:57 , Pooya Lalehzari wrote: > > Hello, > I have a data.frame (below) containing the two fields of "Value" and "Signal" > and I would need to create the third field of "To_Be_Produced". The condition > for producing the third field is to carry the 1 in the "Signal" field