search for: zhenjiang

Displaying 15 results from an estimated 15 matches for "zhenjiang".

Did you mean: zhejiang
2011 Aug 31
3
how to create data.frames from vectors with duplicates
...=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
...ontrol # 1 M 12.3 10.7 7.9 # 2 F 10.6 11.1 6.3 # 3 F 13.1 13.8 9.5 # 4 M 13.4 12.9 11.5 I know reshape() can transform the data.frame from long to wide, but it seems not able to control the order of the columns. Thanks ahead of time -- Best, Zhenjiang [[alternative HTML version deleted]]
2011 Aug 05
4
a question on list manipulation
...t 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 list name. Is there any quick way to do that? Thanks -- Best, Zhenjiang
2010 Aug 10
4
matrix problem
Hi, I have a file like this: 1 2 0.1 2 3 0.2 3 1 0.3 And I want to read it to create a matrix like this: [,1] [,2] [,3] [1,] 0 0.1 0 [2,] 0 0 0.2 [3,] 0.3 0 0 How can I do it efficiently? Thanks. -- Best, Zhenjiang [[alternative HTML version deleted]]
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
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
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
...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 deleted]]
2010 Nov 10
1
ggplot2 problem in interacting mode
...3-8 reshape_0.8.3 plyr_1.2.1 loaded via a namespace (and not attached): [1] tools_2.11.1 The interesting thing is that when I put the codes into an R script, and run with command "R CMD BATCH XX.R", it works alright. Does anyone have any idea what the problem is? Thanks~ -- Best, Zhenjiang [[alternative HTML version deleted]]
2011 Aug 24
1
read.table truncated data?
...he 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) [1] 21423 -- Best, Zhenjiang [[alternative HTML version deleted]]
2011 Aug 31
1
counting the duplicates in an object of list
...;,'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
...= list(strip = 'off'), par.strip.text = list(cex=0.7), par.settings = list(fontsize=list(text=8)), auto.key = list(rectangles = TRUE, space = 'right', columns = 1), draw.key = TRUE, scales = list(x = list(rot = 45))) -- Best, Zhenjiang [[alternative HTML version deleted]]
2010 Apr 22
1
how to reorder of groups and specify ylim for each row in lattice barchart
...m the default (0,80)? Please notice I don't want to set arguement "scales = list(y=list(relation='free'))", for the automatic various setting of ranges for different panels isn't good enough for me. Basically I'd like to manually control y ranges. Thank you! -- Best, Zhenjiang [[alternative HTML version deleted]]
2010 Apr 29
1
a question on autocorrelation acf
...)]}{\sigma^2}\, ,] If it does, then the autocorrelation of a sine function should give a cosine; however, the following code gives a cosine-shape function with its magnitude decreasing along the lag. x = c(1:500) x = x/10 x = sin(x) acf(x, type='correlation', lag.max=length(x)-1) -- Best, Zhenjiang [[alternative HTML version deleted]]
2010 Nov 10
0
error bars in lattice barchart
...anel.groups = panel.ci, panel = panel.superpose ) Sundar's solution gives me the exact same original plot without error bars, and Deepayan's solution gives me a messy plot. Did I mess up anything in these two solutions? I'd appreciate any help from you experts. Thanks -- Best, Zhenjiang [[alternative HTML version deleted]]