similar to: cross tabulate variables by subject id

Displaying 20 results from an estimated 1000 matches similar to: "cross tabulate variables by subject id"

2010 Feb 22
3
gsub patterns from vector elements w/out loop?
Dear list, I have two vectors: x <- c("one","two") y <- paste(rep(x,2),"blah") I want to replace all occurrences of each element of x in y with something else, so that y looks like this: y [1] "something else blah" "something else blah" "something else blah" [4] "something else blah" I can do this using a loop: for (
2010 Aug 24
1
Index list by other list (w/ logical elements)?
I have two lists of the same shape, like this: x <- list() x[[1]] <- c("one","two") x[[2]] <- c("three","four","five") y <- list() y[[1]] <- c(TRUE,FALSE) y[[2]] <- c(FALSE,TRUE,TRUE) I would like to index x "by" y, that is, the result in this case should be: z [[1]] [1] "one" [[2]] [1] "four"
2011 Feb 02
1
pass nrow(x) to dots in function(x){plot(x,...)}
Dear Rers, I have a function to barplot() a matrix, eg myfun <- function(x, ...) { barplot(x , ... )} (The real function is more complicated, it does things to the matrix first.) So I can do: m1 <- matrix(1:20,4) myfun(m1) myfun(m1, main="My title") I'd like to be able to add the number of rows of the matrix passed to the function to the "..." argument, eg
2009 Dec 12
1
read.csv to read output of system()?
Dear list, I have a file that is comma delimited but contains some erroneous non-delimiter commas. I would like to replace these commas with semicolons and then read the correct file into R as a data frame. I want to do this from within R, without changing the original data file. My current idea of how to do this would be to use system("sed ...") and feed the result to read.csv(), but
2009 Oct 03
2
add lines() to 1st plot in layout() after calling 2nd plot()?
Dear R users, I create a graphic with two plots side by side using layout(), like this: layout(matrix(c(1,2),1)) plot(1:10,main="left plot") lines(c(3:7,7:3),col="red") plot(10:1,main="right plot") The lines() obivously get added to the "left plot" plot. Now, I'm trying to write a function that builds up a plot bit by bit to then include it in a
2008 Oct 05
1
barchart for aggregated (sum) data in lattice?
Hi list, I have data in a dataframe t1, with a column for different amounts spent, a column what it was spent on, and a column with dates, from which I create a new column with months. Example: amount <- rep(c(10,20,30),3) what <- rep(c("food","books","cycling"),3) when <- c(rep("2008-09-05",5),rep("2008-10-07",4)) t1 <-
2009 Oct 09
3
"Use R" -- term and logo copyright?
Dear list, I would like to start some R workshops at King's College London, and to do so, I would like to use the "Use R!" logo at http://www.agrocampus-ouest.fr/math/useR-2009//useR%21%202008_fichiers/useR-middle.png Since it seems to be difficult to get a shell account at KCL, I also went ahead and registered use-r.org.uk and am starting to put together a website at
2009 Sep 02
1
get function to return object "name"?
Dear list, I've written a function that plots subjects. Something like: myplot <- function(subject) { plot(subject) } Subjects are vectors, e.g. ... s1 <- c(200,200,190,180) ... and plotting them works fine, e.g. ... myplot(s1) Now I want to have "s1" etc appear in the plot title, but I don't know how to refer to this generically (the object "name"? I tried
2009 Jun 10
1
ggplot, qplot: alpha channel for colors corresponding to factor
Hi, I have a qplot like the one in the minimal example below, except I also have faceting like this: qplot(jitter(Goodall),jitter(Better.adapt),colour=Second.adapt,facets=~Pol,data=d1) and with the real data I get quite a lot of overplotting, so I would like to add an alpha channel. In addition, I would like to be able to control which colors are used for each value of Second.adapt (which
2007 Dec 04
2
Multiple stacked barplots on the same graph?
Dear R-Users, I would like to know whether it is possible to draw several stacked barplots (i.e. side by side on the same sheet)... my data look like : Cond1 Cond1' Cond2 Cond2' Compartment 1 11,81 2,05 12,49 0,70 Compartment 2 10,51 1,98 13,56 0,85 Compartment 3 1,95 0,63 2,81 0,22 Compartment 4 2,08 0,17
2015 Jul 16
3
[LLVMdev] why LoopUnswitch pass does not constant fold conditional branch and merge blocks
Hi, I have a general question on LoopUnswtich pass. Consider the following IR snippet: define i32 @test(i1 %cond) { br label %loop_begin loop_begin: br i1 %cond, label %loop_body, label %loop_exit loop_body: br label %do_something do_something: call void @some_func() noreturn nounwind br label %loop_begin loop_exit: ret i32 0 } declare void @some_func() noreturn After running
2007 Oct 10
1
Deleting for() loop in function
Dear UseRs, I wrote following function in order to solve Data Envelopment Analysis. Reason for posting is that the function is slow when nrow(dat) is large. I wonder if other functions could substitute the for() loop in the code, such as mapply(). Can anybody help to rewrite the dea() function as efficiently as possible? The code is as follows:
2012 Sep 27
2
equivalent of Stata "by construct"
I am evaluating a switch from Stata to R. I don't need to extensive Statistical methods, but the main reason I am exploring the switch is the coding flexibility in R (e.g. Stata does not support linear/quadratic programming). I have been going over the R syntax and I had a quick question: In Stata, one has a very useful construction called "by", e.g. by month signal: gen xxx =
2002 Mar 04
2
Plotting a x axis from a vector with rownames
Hi all, suppose there is a vector y with rownames: > y cond1 cond2 cond3 cond4 78.952 87.308 86.490 74.040 how can I easily plot this vector using the rownames? plot(y) gives me a plot with a x-axis from 1 to 4 in 0.5 steps, also plot(rownames(y), y) and plot(y ~ rownames(y) don't work. I know I can build a x-axis with axis(1, ...), but in this case I need a character string like
2017 May 22
5
[poison] is select-of-select to logic+select allowed?
Some InstCombine transforms for select-of-select were added here: https://reviews.llvm.org/rL228409 But Alive says this is more poisonous: Name: selsel %s1 = select i1 %cond1, i8 C1, i8 C2 %s2 = select i1 %cond2, i8 %s1, i8 C2 => %andcond = and i1 %cond1, %cond2 %s2 = select i1 %andcond, i8 C1, i8 C2 http://rise4fun.com/Alive/JT6 Are those transforms legal? -------------- next part
2012 Mar 19
3
Issue with asin()
Hello everyone, I am working for a few days already on a basic algorithm, very common in applied agronomy, that aims to determine the degree-days necessary for a given individual to reach a given growth stade. The algorithm (and context) is explained here: http://www.oardc.ohio-state.edu/gdd/glossary.htm , and so I implemented my function in R as follows: DD <- function(Tmin, Tmax, Tseuil,
2017 Jul 24
5
Ifelse statements and combining columns
Hi everyone, I'm having some trouble with my ifelse statements. I'm trying to put 12 conditions within 3 groups. Here is the code I have so far: dat$cond <- ifelse(test = dat$cond == "cond1" | dat$cond == "cond2" | dat$cond == "cond3" dat$cond == "cond4" yes = "Uniform" no = ifelse(test =
2011 Dec 10
3
PCA on high dimentional data
Hi: I have a large dataset mydata, of 1000 rows and 1000 columns. The rows have gene names and columns have condition names (cond1, cond2, cond3, etc). mydata<- read.table(file="c:/file1.mtx", header=TRUE, sep="") I applied PCA as follows: data_after_pca<- prcomp(mydata, retx=TRUE, center=TRUE, scale.=TRUE); Now i get 1000 PCs and i choose first three PCs and make a
2016 Nov 02
3
(RFC) Encoding code duplication factor in discriminator
----- Original Message ----- > From: "Dehao Chen" <dehao at google.com> > To: "Hal Finkel" <hfinkel at anl.gov> > Cc: "llvm-dev" <llvm-dev at lists.llvm.org>, "Xinliang David Li" > <davidxl at google.com> > Sent: Tuesday, November 1, 2016 6:41:29 PM > Subject: Re: [llvm-dev] (RFC) Encoding code duplication factor in
2017 Jul 24
0
Ifelse statements and combining columns
Not a reproducible example, so a bit of guessing here, but a) don't try to assign results to variables inside the ifelse. That is, remove all the single-equals signs and "test" variables. If you really need to conditionally assign variables then use "if"... but chances are good you don't need that. b) "closure" is effectively another word