Search Results

Search found 12 results on 1 pages for 'gd047'.

Page 1/1 | 1 

  • (R) How can I get the complement of vector y in vector x

    - by gd047
    That's x \ y using mathematical notation. Suppose x <- c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2,1,1,1,3) y <- c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1) How can I get a vector with ALL the values in x that are not in y. i.e the result should be: 2,1,1,3 There is a similar question here. However, none of the answers returns the result that I want.

    Read the article

  • Saving a datawindow as PDF in PB 10.5

    - by gd047
    I have a grid datawindow with a picture in it's background (with dimensions of an A4 page) and I would like to export both data and the picture as a (single page) PDF file. I used several combinations of the following commands but at most I got a 0-sized pdf. //dw_1.Modify("Datawindow.Export.PDF.Method = Distill! ") //dw_1.Modify("DataWindow.Export.PDF.Method = XSLFOP! ") dw_1.Object.DataWindow.Export.PDF.Method = Distill! //dw_1.Object.DataWindow.Printer = "\\prntsrvr\pr-6" dw_1.Object.DataWindow.Export.PDF.Distill.CustomPostScript="No" dw_1.SaveAs("c:\dw_one.pdf", PDF!, false) User’s guide (on page 533) says: … the data is printed to a PostScript file and automatically distilled to PDF using GNU Ghostscript… Installing Ghostscript For licensing reasons, Ghostscript is not installed with PowerBuilder. You (and your users) must download and install it before you can use this technique… Does anyone have any idea what is the procedure?

    Read the article

  • This is more a matlab/math brain teaser than a question

    - by gd047
    Here is the setup. No assumptions for the values I am using. n=2; % dimension of vectors x and (square) matrix P r=2; % number of x vectors and P matrices x1 = [3;5] x2 = [9;6] x = cat(2,x1,x2) P1 = [6,11;15,-1] P2 = [2,21;-2,3] P(:,1)=P1(:) P(:,2)=P2(:) modePr = [-.4;16] TransPr=[5.9,0.1;20.2,-4.8] pred_modePr = TransPr'*modePr MixPr = TransPr.*(modePr*(pred_modePr.^(-1))') x0 = x*MixPr Then it was time to apply the following formula to get myP , where µij is MixPr. I used this code to get it: myP=zeros(n*n,r); Ptables(:,:,1)=P1; Ptables(:,:,2)=P2; for j=1:r for i = 1:r; temp = MixPr(i,j)*(Ptables(:,:,i) + ... (x(:,i)-x0(:,j))*(x(:,i)-x0(:,j))'); myP(:,j)= myP(:,j) + temp(:); end end Some brilliant guy proposed this formula as another way to produce myP for j=1:r xk1=x(:,j); PP=xk1*xk1'; PP0(:,j)=PP(:); xk1=x0(:,j); PP=xk1*xk1'; PP1(:,j)=PP(:); end myP = (P+PP0)*MixPr-PP1 I tried to formulate the equality between the two methods and seems to be this one. To make things easier, I ignored from both methods the summation of matrix P. where the first part denotes the formula that I used, while the second comes from his code snippet. Do you think this is an obvious equality? If yes, ignore all the above and just try to explain why. I could only start from the LHS, and after some algebra I think I proved it equals to the RHS. However I can't see how did he (or she) think of it in the first place.

    Read the article

  • Reading correctly alphanumeric fields into R

    - by gd047
    A tab-delimited text file, which is actually an export (using bcp) of a database table, is of that form: 102 1 01 e113c 3224.96 12 102 1 01 e185 101127.25 12 102 2 01 e185 176417.90 12 102A 3 01 e185 26261.03 12 I tried to import it in R with a command like data <- read.delim("C:\\test.txt", header = FALSE, sep = "\t") The problem is that the 3rd column which is actually a varchar field (alphanumeric) is mistakenly read as integer (as there are no letters in the entire column) and the leading zeros disappeared. The same thing happened when I imported the data directly from the database, using odbcConnect. Again that column was read as integer. str(data) $ code: int 1 1 1 1 1 1 6 1 1 8 ... How can I import such a dataset in R correctly, so as to be able to safely populate that db table again, after doing some data manipulations?

    Read the article

  • Getting the excluded elements for each of the combn(n,k) combinations

    - by gd047
    Suppose we have generated a matrix A where each column contains one of the combinations of n elements in groups of k. So, its dimensions will be k,choose(n,k). Such a matrix is produced giving the command combn(n,k). What I would like to get is another matrix B with dimensions (n-k),choose(n,k), where each column B[,j] will contain the excluded n-k elements of A[,j]. Here is an example of the way I use tho get table B. Do you think it is a safe method to use? Is there another way? n <- 5 ; k <- 3 (A <- combn(n,k)) (B <- combn(n,n-k)[,choose(n,k):1]) That previous question of mine is part of this problem. Thank you.

    Read the article

  • Embedding googleVis charts into a web site

    - by gd047
    Reading from the googleVis package vignette: "With the googleVis package users can create easily web pages with interactive charts based on R data frames and display them either via the R.rsp package or within their own sites". Following the instructions I was able to see the sample charts, using the plot method for gvis objects. This method by default creates a rsp-file in the rsp/myAnalysis folder of the googleVis package, using the type and chart id information of the object and displays the output using the local web server of the R.rsp package (port 8074 by default). Could anybody help me (or provide some link) on the procedure someone has to follow in order to embed such charts into an existing web site (e.g. a joomla site)?

    Read the article

  • Randomized experiments in R

    - by gd047
    Here is a simple randomized experiment. In the following code I calculate the p-value under the null hypothesis that two different fertilizers applied to tomato plants have no effect in plants yields. The first random sample (x) comes from plants where a standard fertilizer has been used, while an "improved" one has been used in the plants where the second sample (y) comes from. x <- c(11.4,25.3,29.9,16.5,21.1) y <- c(23.7,26.6,28.5,14.2,17.9,24.3) total <- c(x,y) first <- combn(total,length(x)) second <- apply(first,2,function(x) total[!total %in% x]) dif.treat <- apply(second,2,mean) - apply(first,2,mean) # the first element of dif.treat is the one that I'm interested in (p.value <- length(dif.treat[dif.treat >= dif.treat[1]]) / length(dif.treat)) Do you know of any R function that performs tests like this one?

    Read the article

  • Thoughts about alternatives to barplot-with-error-bars

    - by gd047
    I was thinking of an alternative to the barplot-with-error-bars plot. To get an idea by example, I roughly 'sketched' what I mean using the following code library(plotrix) plot(0:12,type="n",axes=FALSE) gradient.rect(1,0,3,8,col=smoothColors("red",38,"red"),border=NA,gradient="y") gradient.rect(4,0,6,6,col=smoothColors("blue",38,"blue"),border=NA,gradient="y") lines(c(2,2),c(5.5,10.5)) lines(c(2-.5,2+.5),c(10.5,10.5)) lines(c(2-.5,2+.5),c(5.5,5.5)) lines(c(5,5),c(4.5,7.5)) lines(c(5-.5,5+.5),c(7.5,7.5)) lines(c(5-.5,5+.5),c(4.5,4.5)) gradient.rect(7,8,9,10.5,col=smoothColors("red",100,"white"),border=NA,gradient="y") gradient.rect(7,5.5,9,8,col=smoothColors("white",100,"red"),border=NA,gradient="y") lines(c(7,9),c(8,8),lwd=3) gradient.rect(10,6,12,7.5,col=smoothColors("blue",100,"white"),border=NA,gradient="y") gradient.rect(10,4.5,12,6,col=smoothColors("white",100,"blue"),border=NA,gradient="y") lines(c(10,12),c(6,6),lwd=3) The idea was to use bars like the ones in the second pair, instead of those in the first. However, there is something that I would like to change in the colors. Instead of a linear gradient fill, I would like to adjust the color intensity in accordance with the values of the pdf of the mean estimator. Do you think it is possible? A slightly different idea (where gradient fill isn't an issue) was to use one (or 2 back-to-back) bell curve(s) filled with (solid) color, instead of a rectangle. See for example the shape that corresponds to the letter F here. In that case the bell-curve(s) should (ideally) be drawn using something like plot(x, dnorm(x, mean = my.mean, sd = std.error.of.the.mean)) I have no idea though, of a way to draw rotated (and filled with color) bell curves. Of course, all of the above may be freely judged as midnight springtime dreams :-)

    Read the article

  • Strange findFn malfunction

    - by gd047
    I noticed a strange malfunction in using findFn function (library sos) and I can't find out the source. While it works fine on my Windows XP pc, it does not on my Vista one. library (sos) findFn("randomization test") # in both finds 72 results findFn("{randomization test}") # In XP finds 19 or about so, but in Vista whenever I use {} and more than one word inside, # I keep getting the following: found 0 matches x has zero rows; nothing to display. Warning message: In findFn("{randomization test}") : HIT not found in HTML; processing one page only. R ver = 2.10.1 and packages updated. Any ideas where the problem might be? Bonus: As it's obvious, I was looking for functions about tests for randomized experiments

    Read the article

  • using R.zoo to plot multiple series with error bars

    - by dnagirl
    I have data that looks like this: > head(data) groupname ob_time dist.mean dist.sd dur.mean dur.sd ct.mean ct.sd 1 rowA 0.3 61.67500 39.76515 43.67500 26.35027 8.666667 11.29226 2 rowA 60.0 45.49167 38.30301 37.58333 27.98207 8.750000 12.46176 3 rowA 120.0 50.22500 35.89708 40.40000 24.93399 8.000000 10.23363 4 rowA 180.0 54.05000 41.43919 37.98333 28.03562 8.750000 11.97061 5 rowA 240.0 51.97500 41.75498 35.60000 25.68243 28.583333 46.14692 6 rowA 300.0 45.50833 43.10160 32.20833 27.37990 12.833333 14.21800 Each groupname is a data series. Since I want to plot each series separately, I've separated them like this: > A <- zoo(data[which(groupname=='rowA'),3:8],data[which(groupname=='rowA'),2]) > B <- zoo(data[which(groupname=='rowB'),3:8],data[which(groupname=='rowB'),2]) > C <- zoo(data[which(groupname=='rowC'),3:8],data[which(groupname=='rowC'),2]) ETA: Thanks to gd047: Now I'm using this: z <- dlply(data,.(groupname),function(x) zoo(x[,3:8],x[,2])) The resulting zoo objects look like this: > head(z$rowA) dist.mean dist.sd dur.mean dur.sd ct.mean ct.sd 0.3 61.67500 39.76515 43.67500 26.35027 8.666667 11.29226 60 45.49167 38.30301 37.58333 27.98207 8.750000 12.46176 120 50.22500 35.89708 40.40000 24.93399 8.000000 10.23363 180 54.05000 41.43919 37.98333 28.03562 8.750000 11.97061 240 51.97500 41.75498 35.60000 25.68243 28.583333 46.14692 300 45.50833 43.10160 32.20833 27.37990 12.833333 14.21800 So if I want to plot dist.mean against time and include error bars equal to +/- dist.sd for each series: how do I combine A,B,C dist.mean and dist.sd? how do I make a bar plot, or perhaps better, a line graph of the resulting object?

    Read the article

1