similar to: matrix problem

Displaying 20 results from an estimated 10000 matches similar to: "matrix problem"

2011 Aug 31
3
how to create data.frames from vectors with duplicates
Hi R users, suppose I have two vectors, > x=c(1,2,3,4,5) > y=c('a','b','c','a','c') How can I get a data.frame like this? > xy count a 5 b 2 c 8 I know a few ways to fulfill the task. However, I have a huge number of this kind calculations, so I'd like an efficient solution. Thanks -- Best, Zhenjiang
2011 Mar 15
3
how to reshape the data.frame from long to wide in a specific order
Hi, For example, the data.frame like: origdata.long <- read.table(header=T, con <- textConnection(' subject sex condition measurement 1 M control 7.9 1 M first 12.3 1 M second 10.7 2 F control 6.3 2 F first 10.6 2 F second 11.1 3 F control 9.5 3
2011 Aug 05
4
a question on list manipulation
Hi R users, I have a list: > x $A [1] "a" "b" "c" $B [1] "b" "c" $C [1] "c" I want to convert it to a lowercase-to-uppercase list like this: > y $a [1] "A" $b [1] "A" "B" $c [1] "A" "B" "C" In a word, I want to reverse the list names and the elements under each
2011 Aug 02
2
how to control to save plots to which dev
Hi, I have a for loop to make 2 types of plots and I'd like to save one type of plots to a pdf file and the other to another pdf file. How can I control which plot will be saved to which pdf? Thanks -- Best, Zhenjiang
2011 Apr 15
1
how to add two data.frame with the same column but different row numbers
Hi all, Suppose I have 2 data.frame , a and b, how can I add them together to get c? Thanks > a A a 1 b 2 c 3 > b A a 6 c 1 > c A a 7 b 2 c 4 -- Best, Zhenjiang [[alternative HTML version deleted]]
2011 Aug 29
1
sum of two lists
Hi R users, Suppose I have two lists and the names of list 'm' are a subset of those of 'n', how can I sum the two lists with corresponding elements added together to get list 'o'? > n = list("a"=1,"b"=3,"c"=5) > m = list('b'=4) > o $a [1] 1 $b [1] 7 $c [1] 5 Thanks -- Best, Zhenjiang [[alternative HTML version
2010 Nov 10
1
ggplot2 problem in interacting mode
Hi all, When running R interactively, I have the problem as following: > library(ggplot2) Loading required package: reshape Loading required package: plyr Attaching package: 'reshape' The following object(s) are masked from 'package:plyr': round_any Loading required package: grid Loading required package: proto > data(VADeaths) > pg <- ggplot(melt(VADeaths),
2011 Aug 24
1
read.table truncated data?
Hi R users, I was using read.table to read a file. The data.fame looked alright, but I found not all rows are read by the read.table. What's wrong with it? It didn't give me any warning or error messages. Why the data are truncated? Thanks. $ wc -l all/isoform_exp.diff 42847 all/isoform_exp.diff > a=read.table('all/isoform_exp.diff', header=T, sep='\t') > nrow(a)
2011 Aug 31
1
counting the duplicates in an object of list
Hi all, I have a list x: ?> x=list(a=c('1','2'),b=c('2','3'),c=c('1','2'),d=c('2','3')) I can get the unique elements with unique(), but how can I get the number of duplicates for each unique elements? > unique(x) [[1]] [1] "1" "2" [[2]] [1] "2" "3" Thanks -- Best, Zhenjiang
2010 Apr 20
1
the bar width of barchart plot in lattice package
Dear R users, I am trying to use the following code to make a barchar plot. The bars in the plot turn out to be a little narrow. Is there any way to modify the width of the bars? Thank you! library(lattice) scores = gl(2, 5, label=c('Sensitivity', 'PPV'), length = 100) sequences = gl(5, 1, label=c('Lemna minor', 'Dugesia japonica A', 'Gymnosporangium
2010 Apr 29
1
a question on autocorrelation acf
Hi R users, where can I find the equations used by acf function to calculate autocorrelation? I think I misunderstand acf. Doesn't acf use following equation to calculate autocorrelation? [image: R(\tau) = \frac{\operatorname{E}[(X_t - \mu)(X_{t+\tau} - \mu)]}{\sigma^2}\, ,] If it does, then the autocorrelation of a sine function should give a cosine; however, the following code gives a
2010 Apr 22
1
how to reorder of groups and specify ylim for each row in lattice barchart
R experts, Is there anyway to reorder inside each group? In the following example, the bar of year 1932 is always plotted before the bar of year 1931, may I change the order inside each groups of bars? library(lattice) barchart(yield ~ variety | site,data=barley, groups = year, layout = c(1,6),auto.key = list(points = FALSE, rectangles = TRUE, space = "right"),ylab = "Barley Yield
2012 Jun 12
4
How to index a matrix with different row-number for each column?
here's my question: suppose I have a matrix: mt<-matrix(1:12,ncol=6) now I have a vector vt<-c(1,2,2,2,1,2) which means I want to get: the 1st row for column1; the 2nd row for column2; the 2nd row for column3; the 2nd row for column4; ... that what I want is this vector: 1,4,6,8,9,12 Does anyone know how to do this fast? I know I can use for-loop to travel all columns,but
2010 Aug 18
2
functions and multiple levels
Hi, I am trying to write a function; I want to subtract the mean of each class in level 2 from the mean of each class in level 1 and square the answer, eg..... level.1 level.2 observation 1 1 0.5 1 1 0.2 1 2 0.6 1 2 0.4 2 3
2017 Feb 14
2
[PATCH 1/2] GCC 7: Add __attribute__((noreturn)) to some usage functions which call exit.
This happens with GCC 7.0.1. The errors were all of the form: qemu-speed-test.c: In function 'main': qemu-speed-test.c:153:7: error: this statement may fall through [-Werror=implicit-fallthrough=] usage (EXIT_SUCCESS); ^~~~~~~~~~~~~~~~~~~~ qemu-speed-test.c:155:5: note: here default: ^~~~~~~ --- builder/index-validate.c | 2 +-
2017 Feb 14
4
[PATCH v2 0/2] GCC 7: Misc fixes
v1 -> v2: - Use intprops macro suggested by danpb. Rich.
2014 Aug 18
3
[PATCH] drives: fix deletion of servers on error
Make sure to not skip any of the created server, and to always free the "server" array. diff --git a/src/drives.c b/src/drives.c index 4bd8328..85c1495 100644 --- a/src/drives.c +++ b/src/drives.c @@ -743,8 +743,7 @@ parse_servers (guestfs_h *g, char *const *strs, for (i = 0; i < n; ++i) { if (parse_one_server (g, strs[i], &servers[i]) == -1) { - if (i > 0) -
2004 Feb 19
1
piece wise application of functions
Dear all, After struggling for some time with *apply() and eva() without success, I decided to ask for help. I have 3 lists labeled with, each contains 3 different interpolation functions with identical names: > names(missgp0) [1] "spl.1mb" "spl.2mb" "spl.5mb" > > names(missgp1) [1] "spl.1mb" "spl.2mb" "spl.5mb" > >
2010 Jun 01
2
[LLVMdev] How to create global string array? (user question)
I am trying to create such module with API (it's equivalent to c++: const char* ss[] = {"s1","s2"};): @ss = global [2 x i8*] [i8* getelementptr inbounds ([3 x i8]* @.str1, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8]* @.str2, i32 0, i32 0)] ; <[2 x i8*]*> [#uses=0] @.str1 = private constant [3 x i8] c"s1\00", align 1 ; <[3 x i8]*> [#uses=1]
2006 Oct 01
2
Metadata & RDF
On 30/09/06, Ralph Giles <giles@xiph.org> wrote: > On Sat, Sep 30, 2006 at 12:21:53PM +0200, Danny Ayers wrote: > > > Basically I'd like to embed arbitrary (meta)data in flac files. > > I agree it would be best to define a new block type for RDF > metadata, or probably better for random attached XML data, That sounds reasonable, but... and > let the xml parser