Re: [R] date

2010-09-02 Thread Linlin Yan
try to use difftime() instead of as.difftime(). On Thu, Sep 2, 2010 at 10:32 PM, Dunia Scheid wrote: > Hello all, > > I've 2 strings that representing the start and end values of a date and > time. > For example, > time1 <- c("21/04/2005","23/05/2005","11/04/2005") > time2 <- c("15/07/2009", "03/

Re: [R] , Updating Table

2010-07-24 Thread Linlin Yan
If I am not wrong, it seems that you want to get factor counts in the whole scale of data.raw. Maybe you can do that just like this: table(data.raw) On Sat, Jul 24, 2010 at 1:44 AM, Marcus Liu wrote: > Hi everyone, > > Is there any command for updating table withing a loop?  For instance, at i,

Re: [R] getting data from table command

2010-07-10 Thread Linlin Yan
> d <- 1:4 > f <- c(2,3,3,1) > rep(d,f) [1] 1 1 2 2 2 3 3 3 4 On Sat, Jul 10, 2010 at 10:55 PM, nn roh wrote: > Hi, > > I have a question relating to R package > > If i  have the frequencies of data   how i can get the data  as following : > > 1 2 3 4      data > 2 3  3 1      frequency > > Whic

Re: [R] Creating named lists

2010-03-12 Thread Linlin Yan
Did you mean this: > n <- c('a', 'b') > structure(list(1, 2), names = n) $a [1] 1 $b [1] 2 On Fri, Mar 12, 2010 at 5:28 PM, Rune Schjellerup Philosof wrote: > I often find myself making lists similar to this > list(var1=var1, var2=var2) > > It doesn't seem list has an option, to make it use th

Re: [R] Define column names to a series of data.frames

2010-03-11 Thread Linlin Yan
Amazing! I haven't seen usage of calling `names<-` like this before. Thanks so much! On Thu, Mar 11, 2010 at 9:50 PM, Henrique Dallazuanna wrote: > Yes, just in the list. > If they want change the name in Environment GlobalEnv: > >  for(i in ls(pattern = "DF[0-9]")) >       assign(i, `names<-`(ge

Re: [R] Define column names to a series of data.frames

2010-03-11 Thread Linlin Yan
It seems that the names of original data frames have not changed in this way. I guess textConnection() could help, like this: for (name in objects(pattern = "df[0-9]")) eval(parse(textConnection(paste('names(', name, ') <- column_names' On Thu, Mar 11, 2010 at 9:25 PM, Henrique Dallazuanna w

Re: [R] Group by

2010-03-11 Thread Linlin Yan
> DF V1 V2 V3 1 10:03:13 3.4 1002 2 10:03:14 5.6 1001 3 10:05:27 7.2 999 4 10:05:33 8.2 998 > DF2 <- t(sapply(split(DF[,-1], gsub('(.{5}).*', '\\1:00', DF$V1)), colSums)) > data.frame(V1 = rownames(DF2), DF2) V1 V2 V3 10:03:00 10:03:00 9.0 2003 10:05:00 10:05:00 15.

Re: [R] Average regions of non-zeros

2010-03-08 Thread Linlin Yan
Nice shot of cumsum(). Just improve it a little: > x <- c(0,0,1,2,3,0,0,4,5,6) > x.groups <- split(x, (x != 0) * cumsum(x == 0))[-1] > x.groups $`2` [1] 1 2 3 $`4` [1] 4 5 6 > lapply(x.groups, mean) $`2` [1] 2 $`4` [1] 5 On Mon, Mar 8, 2010 at 11:02 AM, jim holtman wrote: > Try this: > >> x <

Re: [R] How to match vector with a list ?

2010-03-08 Thread Linlin Yan
Maybe you can create a helper vector first: > helper <- structure(names = unlist(j), rep(names(j), sapply(j, length))) > helper acbd "j1" "j1" "j2" "j2" > helper[i] aabbbccd "j1" "j1" "j2" "j2" "j2" "j1" "j1" "j2" On Sat, Mar 6, 2010 at 1:42 AM, Carlos

Re: [R] Reducing a matrix

2010-02-27 Thread Linlin Yan
Try this: df[!duplicated(df[,'x']),] On Sun, Feb 28, 2010 at 8:56 AM, Juliet Ndukum wrote: > I wish to rearrange the matrix, df, such that all there are not repeated x > values. Particularly, for each value of x that is reated, the corresponded y > value should fall under the appropriate column

Re: [R] question to make a vector without loop

2010-02-26 Thread Linlin Yan
For general purpose of recursion formula, you could do it like this: > make.vector <- function(w, n, a, b) c(w, sapply(1:(n-1), function(x) w <<- w > * a / (b + x))) > make.vector(w = 1, n = 4, a = 24, b = 1) [1] 1 12 96 576 On Fri, Feb 26, 2010 at 11:23 PM, wrote: > Hello all, > > I want t

Re: [R] replicate matrix

2010-02-20 Thread Linlin Yan
You can just rep() it, and c() with extra data, and then matrix() it again: > m <- matrix(c(1,4,3,6),2) > matrix(c(rep(m, 3), c(2, 5)), nrow(m)) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [1,]1313132 [2,]4646465 On Sun, Feb 21, 2010 at 10:58 AM,

Re: [R] How to store an array like this?

2010-02-19 Thread Linlin Yan
It's not an array, but a list: lapply(2:n, function(x) matrix(1:x^2,x)) On Sat, Feb 20, 2010 at 3:17 PM, song song wrote: > maybe its not an array > > like > > m[1]=matrix(1:4,2,2) > m[2]=matrix(1:9,3,3) > . > . > . > m[k]=matrix(1:k^2,k,k) > > likes > > for (k in 1:n){ >  s=matrix(1:k^2,k,k) > }

Re: [R] Printing 2 digits after decimal point

2010-02-15 Thread Linlin Yan
format(x, nsmall = 2) On Mon, Feb 15, 2010 at 5:41 PM, wrote: > > Hi there, > > i'm not getting along with the following problem. > I'd like to print a real number, e.g. > x <- 12.3 > with exactly two digits after the decimal point, e.g. > 12.30 > I've tried the whole format(), formatC() and pret

Re: [R] How to: highlight R syntax on webpages ?

2010-02-12 Thread Linlin Yan
I have saw it now. Thank you for your excellent works. On Fri, Feb 12, 2010 at 9:15 PM, Tal Galili wrote: > Hi Linlin, > I am afraid I wasn't clear. > In my post I fixed the current WP-Syntax plugin so it WILL support the R > syntax :) > The link to the article is: > http://www.r-statistics.com/2

Re: [R] How to: highlight R syntax on webpages ?

2010-02-12 Thread Linlin Yan
To achieve this goal, it seems there are several ways, such as WP-Syntax (http://wordpress.org/extend/plugins/wp-syntax/), SyntaxHighlighter2 (http://mohanjith.com/2009/03/syntaxhighlighter2.html), etc. However, these plugins seem not support R language by default, so you may have to write some cod

Re: [R] apply command

2010-01-19 Thread Linlin Yan
I guess that the matrix dimension changed because matrix in R are filled by columns. Since you try: apply(b, 1, function(y) sort(y, na.last=F)) The second parameter make it scan matrix b row by row but store result by columns, which make the result be a matrix transposed. If you try: apply(b, 2, fu

Re: [R] as.Date question

2009-12-24 Thread Linlin Yan
I am afraid that although in same literally, they are indeed different functions: as.Date.POSIXct and as.Date.POSIXlt. But I am not sure why they are designed like this, which causes the confusion as you mentioned. On Thu, Dec 24, 2009 at 11:02 PM, MAL wrote: > Mark, not sure that's the answer. >

Re: [R] How to find the significant digits of a number?

2009-12-16 Thread Linlin Yan
Try this: > f <- function(x) length(gregexpr("[[:digit:]]", as.character(x))[[1]]) > f(3.14) [1] 3 > f(3.1415) [1] 5 > f(3.14159265) [1] 9 On Wed, Dec 16, 2009 at 1:39 PM, Xiang Wu wrote: > Is there a function in R that could find the significant digit of a specific > number? Such as for 3.1415,

Re: [R] Is there lazy copy in R?

2009-12-14 Thread Linlin Yan
It means that R does have the lazy copy mechanism, which I didn't know, and I think it can be very useful to make R running more quickly. On Tue, Dec 15, 2009 at 12:15 PM, Peng Yu wrote: >> a=1:10 >> b=a >> a=1:10 >> tracemem(a)# I assume the following is address 'a' points to > [1] "<0x05cf2798>

Re: [R] Removing objects from a list based on nrow

2009-11-29 Thread Linlin Yan
(sapply(lst, nrow) < 3)] > list() >> > > Notice the list is now empty.  Instead use: > >> lst[sapply(lst, nrow) >=3] > [[1]] >  letter number > 1      A      1 > 2      B      2 > 3      C      3 > 4      D      4 > 5      E      5 > > [[2]] >

Re: [R] column of dates into time series

2009-11-29 Thread Linlin Yan
There is no year() function. Maybe you can try format() instead. On Sun, Nov 29, 2009 at 8:44 PM, DispersionMap wrote: > > i have a column of dates in this format: > > data[,"Raised.Date"] <- as.Date(data[,"Raised.Date"], "%d/%m/%Y"); > data[1:10,"Raised.Date"] > [1] "2006-07-07" "2006-07-07" "20

Re: [R] Removing objects from a list based on nrow

2009-11-29 Thread Linlin Yan
Try these: sapply(lst, nrow) # get row numbers which(sapply(lst, nrow) < 3) # get the index of rows which has less than 3 rows lst <- lst[-which(sapply(lst, nrow) < 3)] # remove the rows from the list On Sun, Nov 29, 2009 at 4:36 PM, Tim Clark wrote: > Dear List, > > I have a list containing data

Re: [R] List Name help

2009-11-23 Thread Linlin Yan
On Tue, Nov 24, 2009 at 1:01 AM, Henrique Dallazuanna wrote: > Try this: > > test[grep("d2", names(test))] > Or it can be simply like this: test[names(test) == "d2"] > On Mon, Nov 23, 2009 at 2:53 PM, Rajasekaramya > wrote: >> >> Hi There, >> >> I have a named List object.I want to access all

Re: [R] Removing "+" and "?" signs

2009-11-22 Thread Linlin Yan
Try this: gsub("[?]", " ", x) On Mon, Nov 23, 2009 at 7:01 AM, Steven Kang wrote: > Hi all, > > > I get an error message when trying to replace *+* or *?* signs (with empty > space) from a string. > > x <- "asdf+,jkl?" > > gsub("?", " ", x) > > > Error message: > > Error in > gsub("?", " ", x) :

Re: [R] [Rd] How to generate dependency file that can be used by gnu make?

2009-11-16 Thread Linlin Yan
I don't think this function is same as gcc's option -MM. Because gcc checks pre-compile command #include, in which the filename can be fetched definitely. But in your scenario, the filename may be from some variables, which can not be determined by the R script only. Maybe you can write a tool by y

Re: [R] pairs

2009-11-15 Thread Linlin Yan
Hope this help: > m <- matrix(c(2,1,3,9,5,7,7,8,1,8,6,5,6,2,2,7),4,4) > p <- c(2, 6) > apply(m == p[1], 1, any) & apply(m == p[2], 1, any) [1] TRUE FALSE TRUE FALSE If you want the number of rows which contain the pair, sum() could be used: > sum(apply(m == p[1], 1, any) & apply(m == p[2], 1,

Re: [R] How to get the string '\'?

2009-11-15 Thread Linlin Yan
Regular expression needs double the '\' again, so try this: gsub('/','',string) On Mon, Nov 16, 2009 at 7:35 AM, Peng Yu wrote: > My question was from replacing a pattern by '\\'. How to replace '/' > in string by '\'? > > string='abc/efg' > gsub('/','\\',string) > ___

Re: [R] How to strip everything after second whitespace?

2009-11-06 Thread Linlin Yan
Try this: > gsub("([a-z]*\\s[a-z]*).*", "\\1", nam) [1] "Smith John" "Smith David" "Smith Ryan" On Fri, Nov 6, 2009 at 4:11 PM, johannes rara wrote: > How to split everything after second whitespace char using regular > expression? I want to remove A, B, C and D from these names: > > nam <- c("S

Re: [R] How to exclude certain columns by column names?

2009-11-02 Thread Linlin Yan
Try this: > x[, colnames(x) != 'a'] [1] 3 4 On Tue, Nov 3, 2009 at 9:31 AM, Peng Yu wrote: > I can exclude columns by column number using '-'. But I wondering if > there is an easy way to exclude some columns by column names. > >> x=cbind(c(1,2),c(3,4)) >> x >     [,1] [,2] > [1,]    1    3 > [2,

Re: [R] exact string match?

2009-10-30 Thread Linlin Yan
How about using operator == On Sat, Oct 31, 2009 at 5:00 AM, bamsel wrote: > > Dear R users: > I need to compare character strings stored in 2 separate data frames. I need > an exact match, so finding "a" in "animal" is no good. > I've tried regexpr, match, and grepl, but to no avail. > Anybody k

Re: [R] how to do this?

2009-09-11 Thread Linlin Yan
Try this: > y[matrix(c(seq_along(x), x), ncol = 2)] [1] 2 16 12 On Fri, Sep 11, 2009 at 4:17 PM, Luca Braglia wrote: > Hello R-users > > I have a situation like this > > x=c(1,3,2) > > y=data.frame("a"=1:3, "b"=4:6, "c"=7:9)*2 > > So we have > >> t(t(x)) >     [,1] > [1,]    1 > [2,]    3 > [3,]

Re: [R] NotePad++ Syntax file

2009-08-10 Thread Linlin Yan
I think NppToR may be a good choice. http://sourceforge.net/projects/npptor/ On Tue, Aug 11, 2009 at 6:37 AM, Farley, Robert wrote: > > > Does anyone have an R Syntax Highlighting file {userDefineLang.xml} for > NotePad++??  I've started one, but I'm not so happy with it. > > > > > Robert Farley

Re: [R] Function to standardize matriz?

2009-07-29 Thread Linlin Yan
Did you mean this: > m <- matrix(1:12, 3, 4) > m / max(m) [,1] [,2] [,3] [,4] [1,] 0.0833 0.333 0.583 0.833 [2,] 0.1667 0.417 0.667 0.917 [3,] 0.2500 0.500 0.750 1.000 On Thu, Jul 30, 2009 at 12:52 PM, Sam wrote: > Hi, > th

Re: [R] vector

2009-07-29 Thread Linlin Yan
rep(A, each=2) On Thu, Jul 30, 2009 at 12:15 AM, Inchallah Yarab wrote: > Hi , > > i have a vector A=(a1,a2,a3,a4) and i want to create another vector > B=(a1,a1,a2,a2,a3,a3,a4,a4) !!! > i know that it is simple but i begin with R so i nned your help!! > > thank you for your help !!! > > > >    

Re: [R] Lists

2009-07-25 Thread Linlin Yan
How about like this: for (i in seq_along(a)) { result <- as.list(a[1:i]) cat("iterator", i, ":\n") print(result) } On Sat, Jul 25, 2009 at 6:48 AM, Alberto Lora M wrote: > Hi Everybody > > I have the following problem > > suppose that we > > a<-c("uno","dos","tres") > > I am working with a

Re: [R] How to append to a list dynamically?

2009-06-17 Thread Linlin Yan
Function parameters in R are passed by value, not by reference. In order to resolve it, just remove "clusters" from the parameter list, and use "clusters[i] <<- ..." to change the value of global variable. On Wed, Jun 17, 2009 at 7:52 PM, Nick Angelou wrote: > > Hi, > > I have a problem with dynam

Re: [R] how to get output from a nested loop

2009-06-09 Thread Linlin Yan
How about like this: > t1 <- data.frame(row.names=c('c1','c2','c3','c4'), mk1=c(1,1,0,0), > mk2=c(0,0,0,1), mk3=c(1,1,1,1), mk4=c(0,0,0,0), mk5=c(0,0,0,1), S=c(4,5,3,2)) > t1 mk1 mk2 mk3 mk4 mk5 S c1 1 0 1 0 0 4 c2 1 0 1 0 0 5 c3 0 0 1 0 0 3 c4 0 1 1 0 1

Re: [R] Help with if statements

2009-06-09 Thread Linlin Yan
Try this: for (i in 1:dim(ALLRESULTS)[1]) { ALLRESULTS[i,23] <- length(ALLRESULTS[i,][ALLRESULTS[i,16:22] <= 0.05]) } On Wed, Jun 10, 2009 at 12:17 AM, Amit Patel wrote: > > Hi > I am trying to create a column in a data frame which gives a sigificane score > from 0-7. It should read values from

Re: [R] seq(...) strange logical value

2009-06-08 Thread Linlin Yan
How about this: > "%==%" <- function(x, y) { if (length(x) > 1) { sapply(x, function(z) isTRUE(all.equal(z, y))); } else { sapply(y, function(z) isTRUE(all.equal(z, x))); } } > seq(0, 1, by=0.1) %==% 0.1 [1] FALSE TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALS

Re: [R] FW: R.dll Reg.,

2009-06-03 Thread Linlin Yan
What's wrong with the copyright? And how could that trouble your linking? On Wed, Jun 3, 2009 at 2:53 PM, RamaR Guru wrote: > > From: techzone2...@hotmail.com > To: r-h...@stat.math.ethz.ch; r-help-requ...@stat.math.ethz.ch > Subject: R.dll Reg., > Date: Wed, 3 Jun 2009 11:57:52 +0530 > > Sir, >

Re: [R] how to checking whether elements of a vector changed or not.

2009-06-02 Thread Linlin Yan
> c(x[1], x[-length(x)]) != x [1] FALSE FALSE FALSE TRUE TRUE FALSE TRUE On Mon, Jun 1, 2009 at 11:57 PM, liujb wrote: > > Hello, > > I have a vector: > x <- c("A", "A", "A", "B", "A", "A", "C") > > I'd like to compare each of elements of vector x from its previous element > (except for the 1s

Re: [R] How to set a filter during reading tables

2009-05-31 Thread Linlin Yan
I think you can use readLines(n=1) in loop to skip unwanted rows. On Mon, Jun 1, 2009 at 12:56 AM, wrote: > Thanks, Juliet. > It works for filtering columns. > I am also wondering if there is a way to filter rows. > Thanks again. > -james > >> One can use colClasses to set which columns get read

Re: [R] how to sort data frame order by column?

2009-05-31 Thread Linlin Yan
e.g. dat[ order(dat$a), ] On Sun, May 31, 2009 at 2:34 PM, Угодай n/a wrote: > I have a data frame, for exampe > >> dat <- data.frame(a=rnorm(5),b=rnorm(5),c=rnorm(5)) >           a            b          c > 1 -0.1731141  0.002453991  0.1180976 > 2  1.2142024 -0.413897606  0.7617472 > 3 -0.942848

Re: [R] logical vector as a matrix

2009-05-29 Thread Linlin Yan
On Sat, May 30, 2009 at 2:48 AM, Grześ wrote: > > I have a vector like this: > h <- c(4, 6, NA, 12) > and I create the secound logical vector like this: > g <- c(TRUE, TRUE, FALSE, TRUE) Why don't you create vector g like this: g <- ! is.na(h) > > And my problem is that I would like to get  a new

Re: [R] Sort matrix by column 1 ascending then by column 2 decending

2009-05-27 Thread Linlin Yan
0.2 Any comment is welcome! ;) On Wed, May 27, 2009 at 11:04 PM, Linlin Yan wrote: >> m <- matrix( c(2, 1, 1, 3, .5, .3, .5, .2), 4) >> m >     [,1] [,2] > [1,]    2  0.5 > [2,]    1  0.3 > [3,]    1  0.5 > [4,]    3  0.2 >> m[unlist(sapply(sort(unique(m[,1

Re: [R] How to exclude a column by name?

2009-05-27 Thread Linlin Yan
Hope this helps: > df <- data.frame(matrix(1:10,2)) > df X1 X2 X3 X4 X5 1 1 3 5 7 9 2 2 4 6 8 10 > df[,-2] X1 X3 X4 X5 1 1 5 7 9 2 2 6 8 10 > df[,-which(names(df)=="X2")] X1 X3 X4 X5 1 1 5 7 9 2 2 6 8 10 On Wed, May 27, 2009 at 6:37 PM, Zeljko Vrba wrote: > Given an

Re: [R] How to write a loop?

2009-05-27 Thread Linlin Yan
Why did you use different variable names rather than index of list/data.frame? On Wed, May 27, 2009 at 6:34 PM, Maithili Shiva wrote: > Dear R helpers, > > Following is a R script I am using to run the Fast Fourier Transform. The csv > files has 10 columns with titles m1, m2, m3 .m10. > > Wh

Re: [R] Help needed on R output

2009-05-26 Thread Linlin Yan
Did you mean this: > write.table(t, eol=",\n", row.names=FALSE, col.names=FALSE) "", "01001001011011101100", "1001001011010101", "1101110100000011", "000100100101001001011001", "000101101101101001101001",

Re: [R] Help needed on R output

2009-05-25 Thread Linlin Yan
> t <- c( + "", + "01001001011011101100", + "1001001011010101", + "1101110100000011", + "000100100101001001011001", + "000101101101101001101001") > { + cat ('rom_array := (\n'); + for (i in 1:length(t)) { +

Re: [R] exists function on list objects gives always a FALSE

2009-05-19 Thread Linlin Yan
SmoothData$span is not an object which can be checked by exists(), but part of an object which can be checked by is.null(). On Wed, May 20, 2009 at 12:07 AM, Žroutík wrote: > Dear R-users, > > in a minimal example exists() gives FALSE on an object which obviously does > exist. How can I check on

Re: [R] Concatenating two vectors into one

2009-05-18 Thread Linlin Yan
It seems that "c(x,y)" is not correct: > z<-c(x,y) > z [1] "A" "B" "C" "D" "E" "F" "1" "2" "3" "4" "5" "6" On Mon, May 18, 2009 at 7:17 PM, Simon Pickett wrote: > z<-c(x,y) > > cheers, Simon. > > > - Original Message - From: "Henning Wildhagen" > To: > Sent: Monday, May 18, 2009 12:09

Re: [R] Concatenating two vectors into one

2009-05-18 Thread Linlin Yan
> z <- paste(x, y, sep = '') > z [1] "A1" "B2" "C3" "D4" "E5" "F6" On Mon, May 18, 2009 at 7:09 PM, Henning Wildhagen wrote: > Dear users, > > a very simple question: > > Given two vectors x and y > > x<-as.character(c("A","B","C","D","E","F")) > y<-as.factor(c("1","2","3","4","5","6")) > > i wan

Re: [R] converting numeric to integer

2009-05-17 Thread Linlin Yan
aillist addres r-h...@stat.math.ethz.ch. > > cheers and thanks, > Thomas > > > Linlin Yan wrote: >> >> I see. What you want is the integer with same sign as the original >> numeral, and whose absolute value is the least integer which is not >> less than a

Re: [R] converting numeric to integer

2009-05-16 Thread Linlin Yan
How about ceiling(x), which return the smallest integer not less than x? On Sun, May 17, 2009 at 2:49 AM, Thomas Mang wrote: > Hello, > > Suppose I have x, which is a variable of class numeric. The calculations > performed to yield x imply that mathematically it should be an integer , but > due t

Re: [R] (no subject)

2009-05-16 Thread Linlin Yan
On Sat, May 16, 2009 at 12:05 PM, Debbie Zhang wrote: > > Dear R users, > > Does anyone know how to write a function involving derivative? > > i.e. I want to implementing Newton's method in R, so my function is something > like > > x<- x-y/y' > > I am not sure how to write y' in my function. Can

Re: [R] Simulation

2009-05-14 Thread Linlin Yan
Since you got the most suitable way to get x, why can't you get the variances in the same way? Just like: v = vector() for (i in 1:length(x)) v[i] = var(x[[i]]) BTW, it is much better to use lapply, like this: lapply(x, var) On Thu, May 14, 2009 at 8:26 PM, Debbie Zhang wrote: > > Thanks f

Re: [R] Duplicates and duplicated

2009-05-14 Thread Linlin Yan
The operator %in% is very good! And that can be simpler like this: x %in% x[duplicated(x)] [1] FALSE FALSE FALSE TRUE TRUE FALSE FALSE FALSE FALSE FALSE On Thu, May 14, 2009 at 4:43 PM, Andrej Blejec wrote: > Try this > > x%in%x[which(y)] > > >From your example > >> x=c(1,2,3,4,4,5,6,7,8,9) >>

Re: [R] Duplicates and duplicated

2009-05-13 Thread Linlin Yan
On Thu, May 14, 2009 at 2:16 PM, christiaan pauw wrote: > Hi everybody. > I want to identify not only duplicate number but also the original number > that has been duplicated. > Example: > x=c(1,2,3,4,4,5,6,7,8,9) > y=duplicated(x) > rbind(x,y) > > gives: >    [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,

Re: [R] Simulation

2009-05-13 Thread Linlin Yan
Does every 100 numbers in rnorm(100 * 1000, 0, 1) have the N(0,1) distribution? On Wed, May 13, 2009 at 11:13 PM, Debbie Zhang wrote: > > > Dear R users, > > Can anyone please tell me how to generate a large number of samples in R, > given certain distribution and size. > > For example, if I wan