similar to: ggplot2 problem

Displaying 20 results from an estimated 800 matches similar to: "ggplot2 problem"

2005 Dec 29
2
loop
Dear All, I have to use loop over an array so I am using following procedure count<-1 repeat{ count<-count + 1 c(g[count],1:i[count]) ->qw if(count>5)break } as a result qw is [1] 0.9643836 1.0000000 2.0000000 3.0000000 4.0000000 5.0000000 [7] 6.0000000 7.0000000 8.0000000 9.0000000 10.0000000 11.0000000 [13] 12.0000000 13.0000000 14.0000000 15.0000000 16.0000000
2006 Feb 06
2
novice questions about programming in "R"
folks, I have been struggling with the "R" documentation for too long now and I need a simple answer on two questions. The documentation does not have adequate examples. Please help. given two equal vector lists: A <- c(0,1,2,3) B <- c(5,6,7,8) [Question #1] how do I dump them to a text file with the following format:
2012 Sep 11
1
lapply with different size lists?
Hello, I have 2 functions (a and b) a = function(n) { matrix (runif(n*2,0.0,1), n) } > > > b = function (m, matrix) { > n=nrow (matrix) > p=ceiling (n/m) > lapply (1:p, function (l,n,m) { > inf = ((l-1)*m)+1 > if (l<p) sup=((l-1)*m)+m > else sup=n >
2008 Feb 12
4
summary statistics
below is my data frame. I would like to compute summary statistics for mgl for each river mile (mean, median, mode). My apologies in advance- I would like to get something like the SAS print out of PROC Univariate. I have performed an ANOVA and a tukey LSD and I would just like the summary statistics. thanks stephen RM mgl 1 215 0.9285714 2 215 0.7352941 3 215 1.6455696 4 215
2006 Sep 17
2
histogram frequency weighing
Fellow R-helpers, Suppose we create a histogram as follows (although it could be any vector with zeroes in it): R> lenh <- hist(iris$Sepal.Length, br=seq(4, 8, 0.05)) R> lenh$counts [1] 0 0 0 0 0 1 0 3 0 1 0 4 0 2 0 5 0 6 0 10 0 9 0 4 0 [26] 1 0 6 0 7 0 6 0 8 0 7 0 3 0 6 0 6 0 4 0 9 0 7 0 5 [51] 0 2 0 8 0 3 0 4 0 1 0 1 0 3
2007 Jan 30
2
Rbind for appending zoo objects
Hi R, y1 <- zoo(matrix(1:10, ncol = 2), 1:5) colnames(y1)=c("a","b") y2 <- zoo(matrix(rnorm(10), ncol = 2), 6:10) colnames(y2)=c("b","a") > y1 a b 1 1 6 2 2 7 3 3 8 4 4 9 5 5 10 > y2 b a 6 0.9070204 0.3527630 7 1.2405943 0.8275001 8 -0.1690653 -0.1724976 9 -0.6905223 -1.1127670 10
1998 Sep 25
1
format(numericmatrix, ...) : proposal for a change
Since format, i.e., format.default(.), is a pretty basic function I thought I'd ask before just changing it... aa <- cbind(1:7, rnorm(7)) format(aa) or format(aa, digits=7) looks like [,1] [,2] [1,] " 1.0000000" " 0.2406669" [2,] " 2.0000000" "-0.4973221" [3,] " 3.0000000" " 0.4672260" [4,] "
2011 Nov 04
6
Matrix element-by-element multiplication
is there a way to do element-by-element multiplication as in Gauss and MATLAB, as shown below? Thanks. --- a 1.0000000 2.0000000 3.0000000 x 1.0000000 2.0000000 3.0000000 2.0000000 4.0000000 6.0000000 3.0000000 6.0000000 9.0000000 a.*x 1.0000000 2.0000000 3.0000000 4.0000000
2017 Nov 16
3
Manera eficiente de añadir el valor anterior por grupo
Buenas Tengo un Data table de la siguiente manera: datos<-data.table(grupo=rep(c("a","b"),5),x=c(1:10),y=rnorm(10,2,1)) Lo que quiero es añadir una fila por cada grupo y en esa nueva fila, al valor de la x ponerle el valor anterior de la y Lo que hago es añadir una nueva fila por grupo, con: datos[,.SD[1:(.N+1)],by=grupo] Y para añadir el valor anterior uso la función
2011 Jan 28
3
sapply puzzlement
Hi, I have this data.frame with two variables in it, > z V1 V2 1 10 8 2 NA 18 3 9 7 4 3 NA 5 NA 10 6 11 12 7 13 9 8 12 11 and a vector of means, > means <- apply(z, 2, function (col) mean(na.omit(col))) > means V1 V2 9.666667 10.714286 My intention was substracting means from z, so instictively I tried > z-means V1 V2 1 0.3333333
2012 May 10
0
Time series and stl in R: Error only univariate series are allowed
I am doing analysis on hourly precipitation on a file that is disorganized. However, I managed to clean it up and store it in a dataframe (called CA1) which takes the form as followed: Station_ID Guage_Type Lat Long Date Time_Zone Time_Frame H0 H1 H2 H3 H4 H5 H6 H7 H8 H9 H10 H11 H12 H13 H14 H15 H16 H17 H18 H19 H20 H21 H22 H23 1
2010 Jan 29
7
Simple question on replace a matrix row
Hello, I have a matrix mat1 of dim [1,8] and mat2 of dim[30,8], I want to replace the first row of mat2 with mat1, this is what I do: mat2[1,]<-mat1 but it transforms mat2 in a list I don't understand, I want it to stay a matrix... ----- Anna Lippel -- View this message in context: http://n4.nabble.com/Simple-question-on-replace-a-matrix-row-tp1427857p1427857.html Sent from the R help
2011 Sep 23
1
Correlation of variables with repeated measures.
Hello I have a dataframe that looks like this: Date Min Subj VAR1 VAR2 VAR3 1 8/30/2011 5min 1 34.41042 126.08490 55.3548387 2 8/30/2011 10min 1 34.53030 133.81343 61.6000000 3 8/30/2011 15min 1 34.66297 118.38193 11.8000000 4 8/30/2011 20min 1 34.82770 110.77767 6.6000000 5 8/30/2011 5min 2 36.36994 116.24861 41.2258065 6 8/30/2011 10min 2
2010 Jul 14
1
Entropy of a Markov chain
Does anyone have any "R" code for computing the entropy of a simple first or second order Markov chain, given a transition matrix something like the following (or the symbol vector from which it is computed)? AGRe ARIe CSRe DIRe DSCe eos HRMe SPTe TOBe AGRe 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000
2010 Jan 20
1
sum column by colnames
Hi, I've this dataframes: > data1 1 2 3 4 5 6 5 0.4963017 0 0 0.2481509 1.9852069 0.4963017 10 0.0000000 0 0 0.0000000 0.6317266 0.0000000 15 0.0000000 0 0 0.0000000 0.0000000 0.0000000 20 0.0000000 0 0 3.3955301 0.0000000 0.0000000 25 0.0000000 0 0 0.0000000 0.0000000 0.0000000 30 0.0000000 0 0 0.0000000 0.0000000
2012 May 15
2
Renaming names in R matrix
I have the following matrix: > dat [,1] [,2] [,3] [,4] foo 0.7574657 0.2104075 0.02922241 0.002705617 foo 0.0000000 0.0000000 0.00000000 0.000000000 foo 0.0000000 0.0000000 0.00000000 0.000000000 foo 0.0000000 0.0000000 0.00000000 0.000000000 foo 0.0000000 0.0000000 0.00000000 0.000000000 foo 0.0000000 0.0000000 0.00000000 0.000000000 and given this:
2009 Jun 29
2
How to read a list into R??
Dear R helpers: I have tried many times to find some way to read a list into R. But I faid. Here is an example: I have a file 'List.txt' which includes data as follows: [[1]] [1] 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.5 0.0 0.0 0.0 [19] 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 [[2]] [1] 0.0000000 0.5000000 0.0000000 0.0000000
2011 Jan 11
1
Writing diagonal matrix in opposite direction
Hi, is there any direct R function to write an diagonal matrix in an opposite way? for example I want to get like:   > diag(rnorm(5))[,5:1]            [,1]       [,2]       [,3]      [,4]       [,5] [1,]  0.0000000  0.0000000  0.0000000  0.000000 -0.1504687 [2,]  0.0000000  0.0000000  0.0000000 -2.139669  0.0000000 [3,]  0.0000000  0.0000000 -0.2102133  0.000000  0.0000000 [4,]  0.0000000
2010 Nov 12
1
wind rose (oz.windrose) scale
Dear list, I trying to make a wind rose plot whit the command oz.windrose, from plotrix package. My data, a matrix of percentages with the rows representing speed ranges and the columns indicating wind directions was generated using bin.wind.records command from same package: [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,] 0.4405286 0.0000000 0.1468429 0.4405286 0.4405286
2006 Mar 12
1
Misalignment of secondary axis on boxplot
Dear R-help, I am trying to overlay a secondary y-axis over a boxplot. The problem is that the point of the line does not correspond to the centrepoint of the boxplot, which makes presentation and interpretation sloppy. Could someone point out where I am going wrong please? #DATA