similar to: Q: appending to non-existent vector?

Displaying 20 results from an estimated 50000 matches similar to: "Q: appending to non-existent vector?"

2007 Mar 01
7
count the # of appearances...
Hi there, is there a possibility to count the number of appearances of an element in a vector ? i mean of any given element.. deliver all elements which are exactly xtimes in this vector ? thx in advance !!
2010 Jan 08
3
Newbie question on precision
Hi all, How can I get R to change the default precision value? For example: > x=0.99999999999999999 > 1-x [1] 0 > Is there a way that I can get a non-zero value using some parameter, or some package? many thanks. [[alternative HTML version deleted]]
2008 Jun 23
2
Writing Vector to a File
Dear experts, I try not to trouble the list again after this question. I want to print this vector into a file > myvec [1] --Control --Control --Control --Control --Control HBA2 HBA1 [8] HBA1 --Control HBB --Control HBB HBA1 MBP [15] --Control HBA1 HBA2 HBB PTGDS GAPDH UBC [22] --Control GAPDH TPT1 HUWE1 PRM1 CKM
2011 Aug 24
3
Efficient way to Calculate the squared distances for a set of vectors to a fixed vector
I am pretty new to R. So this may be an easy question for most of you. ? I would like to calculate the squared distances of a large set (let's say 20000) of vectors (let's say dimension of 5) to a fixed vector. ? Say I have a data frame MY_VECTORS with 20000 rows and 5 columns, and one 5x1 vector y. I would like to efficiently calculate the squared distances?between each of the 20000
2010 Mar 10
1
How can I sort a character type vector?
Dear All, I want to sort a character type vector. the vector is [1] 4 5 6 8 9 11 Y 1 13 15 16 20 X 2 3 10 14 19 XY 7 12 18 17 22 [25] 21 and I want to sort 1-22 X Y XY or 1-22 X XY Y. How can I do that? Thanks,
2002 Oct 17
3
Non-central distributions
Hi Folks, I note that, while the "chisq" functions dchisq(x, df, ncp=0, log = FALSE) pchisq(q, df, ncp=0, lower.tail = TRUE, log.p = FALSE) qchisq(p, df, ncp=0, lower.tail = TRUE, log.p = FALSE) rchisq(n, df, ncp=0) all have a slot for the non-centrality parameter "ncp", of the functions for the t and F distributions: dt(x, df, log = FALSE)
2003 Nov 20
5
Find value in vector (or matrix)
Hi all, Is there a function to check if a particular value is contained in a vector? I've looked at grep in the hope that I could use a Perl-like syntax, but obviously it's different... I'd like to do something like: y <- c("a","b","c") if("a" in y) { # "a" is not in y } Also, is there a way to
2009 Jul 18
2
Zinb for Non-interger data
Sorry bit of a Newbie question, and I promise I have searched the forum already, but I'm getting a bit desperate! I have over-dispersed, zero inflated data, with variance greater than the mean, suggesting Zero-Inflated Negative Binomial - which I attempted in R with the pscl package suggested on http://www.ats.ucla.edu/stat/R/dae/zinbreg.htm However my data is non-integer with some pesky
2007 Mar 15
1
Creating q and p functions from a self-defined distribution
Hello all, I am fishing for some suggestions on efficient ways to make qdist and pdist type functions from an arbitrary distribution whose probability density function I've defined myself. For example, let's say I have a distribution whose pdf is: dRN <- function(x,d,v,s) # d, v, and s are parameters return(d/x^2/sv/sqrt(2*pi)*exp(-(d-v*x)^2/2/(sv^2*x^2))) this is a legitimate
2009 Jul 23
1
error message: .Random.seed is not an integer vector but
Thanks much Ted. I actually had just tried what you suggest here before you posted, and resolved the problem. Thanks also for the other tips. I wrote x = as.vector(c(1:12)) because I thought that the mode of x might be the problem, the error message pointing to .Random.seed notwithstanding. On a related note, I did a brief test a couple weeks back where I ran a million random samples of 3 from
2009 Jul 23
5
error message: .Random.seed is not an integer vector but of type 'list'
I'm trying to run this simple random sample procedure and keep getting the error message shown. I don't understand this; I've designated x as a numeric vector, so what is going on here? Thanks. > x = as.vector(c(1:12));x [1] 1 2 3 4 5 6 7 8 9 10 11 12 > mode(x) [1] "numeric" > sample(x, 3) Error in sample(x, 3) : .Random.seed is not an integer vector
2007 Sep 16
1
programming question
Dear list, I have a vector of numbers, let's say: myvec <- c(2, 8, 24, 26, 51, 57, 58, 78, 219) My task is to reduce this vector to non-reducible numbers; small numbers can cross-out some of the larger ones, based on a function let's say called reduce() If I apply the function to the first element 2, my vector gets shorted to: > (myvec <- reduce(myvec[1])) [1] 2 24 51
2011 Jan 19
1
Printing "pretty' vectors in Sweave
I am trying to print a nice looking vector in Sweave. c <- 1:4 I want to see (1, 2, 3, 4) in TeX. . If I use paste(c, ",", sep="") I get "1," "2," "3," "4," If use cat(c, sep=",") I can't seem to assign it to an object, 1,2,3,4> myvec <- cat(c, sep=",") 1,2,3,4> myvec NULL and if I bypass the
2008 Mar 15
0
Appending new values to an existing factor vector
Hello, I've recently come across a situation where I'm trying to read in [genotype data] files that have around 80,000,000 lines, 4 fields, with a high proportion of repeated strings, here's a sample: rsXXXXXXX SAMPLE0001 CG 0.05302 rsXXXXXX SAMPLE0001 CC 0.06817 rsXXXXXXXX SAMPLE0001 CC 0.01369 rsXXXXXXY SAMPLE0001 GG
2008 May 29
1
Help for R on Windows for non-Win-enabled!
Hi Folks, I need help with a query about R on Windows, specifically about graphics devices. I'm advising someone remotely (so it's all by email) who is running R on Windows, while I am not (Linux only). Things have reached the stage where saving graphics plots as Windows metafiles is looming. I've been told that the result of "?device" in Windows is as follows (which is
2008 Apr 28
3
R on X11 under Linux (newbie)
I just installed R on my 64 bit SUSE Linux system -- I compiled with the default x windows support on.. This may be a newbie question (apologies in advance)-- but how does this show up in X? I have SSH'd in to my box and set my display -- I can run xcalc OK -- but when I hit the R binary it just goes to the command line -- if does not give me an x-window. I suspect I need another
2011 May 02
2
vector decreasing by a factor
Hi, I'm quite new to R so this question will sound quite fundamental. I need to create a vector of length 160. The first element should be (1+r)^159 and each element thereafter should decrease by a factor of (1+r) until the 160th element that should be 1. Is there a function similar to seq() but increasing or decreasing by factors? I need to do this in one step i.e, not using loops. Any help
2010 Oct 24
6
Contour Plot on a non Rectangular Grid
Dear All, I would like to plot a scalar (e.g. a temperature) on a non-rectangular domain (or even better: I would simply like to be able to draw a contour plot on an arbitrary 2D domain). I wonder if there is any tool to achieve that with R. I did some online search in particular on the list archives, found several queries similar to this one but was not able to find any conclusive answer. I
2015 May 04
2
[LLVMdev] Incorrect code generated for arm64
Hi all, I’ve narrowed down a problem in my code to the following test case: - - - - typedef struct {float v[2];} vec2; typedef struct {float v[3];} vec3; vec2 getVec2(); vec3 getVec3() { vec2 myVec = getVec2(); vec3 res; res.v[0] = myVec.v[0]; res.v[1] = myVec.v[1]; res.v[2] = 1; return res; } - - - - Compiling this with any level of optimization for arm64 gives incorrect code,
2007 Jul 31
2
Q: obtaining non-transparent background in png
I am not understanding something about generating PNG plots. I have tried several ways to obtain something other than a transparent background, but nothing I've done seems to change the background. For example: dev.print(png, width=800, height=600, bg='red', filename='example.png') which I thought would give a red background, simply gives the same transparent background I