Re: [R] Maximum No.of code in R

2009-09-21 Thread Petr PIKAL
Well, code with 50+ ifelse statements (probably nested) seems to me quite weird. I believe that such scheme could be solved differently but without real code it is nothing to suggest. r-help-boun...@r-project.org napsal dne 18.09.2009 13:51:45: > On 9/18/2009 5:49 AM, premmad wrote: > > I tried

[R] Odp: What is the best way to get a subset of a data.frame?

2009-09-17 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 17.09.2009 04:14:24: > Hi, > > I want to construct a data.frame 'y' by using x$x and x$y. I think > that there might be better ways to do it (because, for example, we can > use a_matrix[3:5,] to extract certain rows, where 'a_matrix' is a > matrix). Can

[R] Odp: boxplot

2009-09-17 Thread Petr PIKAL
Hi I do not know rma but from help page boxplot requires as input a formula, list (only some list of numerics), data frame or numeric vector. I am not sure if your object is one of these. If not you need to convert it to object which is acceptable for boxplot. Regards Petr r-help-boun...@r-p

[R] change character to factor in data frame

2009-09-09 Thread Petr PIKAL
Dear all I have a simple problem which I thought is easy to solve but what I tried did not work. I want to change character variables to factor in data frame. It goes easily from factor to character, but I am stuck in how to do backwards conversion. Here is an example irisf<-iris irisf[,2]<-f

Re: [R] cbind formula definition

2009-09-09 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 09.09.2009 10:07:49: > Hi Henrique, > > Thanks for your reply. > I tried you suggestion but it didn't work with the poLCA package. > > Maybe i didn't express myself good. > > The normal syntax is: > > f <- cbind(V1,V2,V3)~1 > poLCA(f,data) You compl

Re: [R] Data separated by spaces, getting data into R using field lengths

2009-09-08 Thread Petr PIKAL
Hi what about reading each line by readLine and then split it to desired portions? x<-paste(letters, collapse="") substring(x, c(1,3,5),c(2,4,15)) Regards Petr r-help-boun...@r-project.org napsal dne 08.09.2009 14:21:53: > This data is from database and the maximum length of a field is > def

Re: [R] Andrews plot

2009-09-07 Thread Petr PIKAL
Thank you. hadley wickham napsal dne 07.09.2009 15:50:03: > On Mon, Sep 7, 2009 at 8:36 AM, Petr PIKAL wrote: > > Dear all > > > > Colleague of mine ask me if R is capable of Andrews plot like > > andrewsplot(x) in Matlab. > > > > Quick search did no

[R] Andrews plot

2009-09-07 Thread Petr PIKAL
Dear all Colleague of mine ask me if R is capable of Andrews plot like andrewsplot(x) in Matlab. Quick search did not reveal anything but before I start to write any routine I would like to ask this ingenious audience if there is any implementation of Andrews plots somewhere. I know about p

Re: [R] Problems with Boxplot

2009-09-07 Thread Petr PIKAL
the formats shown are more scientific > in focus. I still haven't been able to find a way of getting a "comma > style". AFAIK you can not format these in boxplot directly. You need to plot without y axis and in axis you can use formating with prettyNum. I found quite easily from s

Re: [R] Party plots

2009-09-04 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 04.09.2009 13:53:24: > > Nordlund, Dan (DSHS/RDA) wrote: > > > > > > You need to put the filename in quotes > > > > file = "C:/Documents and Settings/aelmore/Desktop/foo.pdf" > > > > Hope this is helpful, > > > > Dan > > > Oh yes, this was very h

Re: [R] saving large matrices with decimal numbers

2009-09-04 Thread Petr PIKAL
Hi image<-matrix(0.1, 768,1024) > image[1:10, 1:10] [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 [2,] 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 [3,] 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 [4,] 0.1 0.1 0

Re: [R] Problems with Boxplot

2009-09-04 Thread Petr PIKAL
Hi it is rather difficult to understand what you mean by your questions/answers without real reproducible code. r-help-boun...@r-project.org napsal dne 03.09.2009 13:41:11: > > I'm posting answers to my own Q's here - as far as I have answers - first so > that people don't spend time on them,

[R] Odp: How can I appoint a small part of the whole data

2009-09-03 Thread Petr PIKAL
Hi use any of suitable selection ways that are in R. E.g. data[data$gender==1, ] selects only female values data$wage[(data$gender==1) & (data$race=1)] selects black female wages. and see also ?subset Regards Petr r-help-boun...@r-project.org napsal dne 03.09.2009 10:51:59: > Dear all, >

[R] Odp: "biplot" graphical options?

2009-09-02 Thread Petr PIKAL
Hi I had similar problem some time ago. I was advised to use eqscplot but it did not suite my purpose so I used a little twist of biplot. (I added a result) fit<-princomp(some.data, cor=T) biplot(fit, xlabs=rep("", no.of.poins)) #biplot without points #some scaling of plot parameters rrr<-a

[R] Odp: Normalized Y-axis for Histogram Density Plot

2009-09-02 Thread Petr PIKAL
Hi that is a question which comes almost so often as "why R does not think that my numbers are equal". So even I, non statistician, can deduct that hist with probability =T can have any y axis range but the sum below curve has to be below 1. Regards Petr r-help-boun...@r-project.org napsal dn

[R] Odp: data frame

2009-09-01 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 01.09.2009 10:39:42: > > HI, R user, > > I generate the vectors with the same length. I want to put each vector into > each column of data frame. Why it doesnt work`? > > rm<-data.frame() > > for(a in 1:6){ > rm[,a]<-getmeasure(p1,a,speech) > >

Re: [R] Sequence generation

2009-08-31 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 29.08.2009 21:49:54: > On Sat, Aug 29, 2009 at 8:14 PM, njhuang86 wrote: > > > > Hey guys, > > > > I was wondering how to create this sequence: 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, > > 2, 3... with the '1, 2, 3' repeated over 10 times. > > rep(1:3,10) # rep

Re: [R] Best R text editors?

2009-08-28 Thread Petr PIKAL
Tinn-R Petr r-help-boun...@r-project.org napsal dne 28.08.2009 09:16:38: > On Thu, 27 Aug 2009 12:43:41 -0700 Jonathan Greenberg > wrote: > > JG> Quick informal poll: what is everyone's favorite text editor for > JG> working with R? I'd like to hear from people who are using editors > JG> tha

[R] Odp: draw n-1 lines with n X and n Y

2009-08-26 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 25.08.2009 18:15:25: > > I want to draw lines using a matrix with the X-axe on the first column, and > the the Y-axe on the second column. > These lines have to link the n points of a graph, so they are n-1, but the > resout using these two commands:

[R] Odp: Select top three values from data frame

2009-08-26 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 26.08.2009 10:36:22: > Hi, > > I'm trying to find an easy way to do this. > > I want to select the top three values of a specific column in a subset > of rows in a data.frame. I'll demonstrate. > > ABC > x21 > x41 > x3

[R] Odp: table, sum, cat function

2009-08-25 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 25.08.2009 12:07:11: > Hi, > > the second step in my exercice is to calculate the sum of the amout for each > class et not the frequency > > i have this vector > > x y > 1 100 > 2 1500 > 3 3250 > 4 625

[R] Odp: Re : Odp: Re : table function

2009-08-25 Thread Petr PIKAL
> the goal of this exercice that to count the number of missing value, number > betwwen 0-1000 , 1000-3000, >3000. > > Thank you again for your help > > > > > > De : Petr PIKAL > > Cc : r-help@r-project.org > Envoy

Re: [R] Creating a simple line graph

2009-08-25 Thread Petr PIKAL
Hi Do not use cbind as it results in matrix and it can have only data of one type, in your case character. Use MeanEst2000.Sz=data.frame(Sz,Pred) instead. And you probably could go step further to put everything into one data frame DF <- data.frame(Sz,Pred, Obs) then with(DF, plot(Pred, O

[R] Odp: Fw: Re: Simulating data for sampling (stupid question)

2009-08-25 Thread Petr PIKAL
Well you shall consult (surprisingly :-) ?sample function and for rating ?runif function as was pointed out earlier Regards Petr r-help-boun...@r-project.org napsal dne 25.08.2009 05:14:00: > Dear All > Â > I know that you do not have to help me (as this is not a pure R problem)Â but > p

[R] Odp: Re : table function

2009-08-25 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 25.08.2009 10:08:36: > Hi Mark, > > > Thank you for your answer !! it works but if i have "NA" in the vector z what > i shoud do to count its number in Z? You do not have NA in z, you manage to convert it somehow to factor. Please try to read about

[R] Odp: When factor is better than other types, such as vector and frame?

2009-08-24 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 23.08.2009 05:00:11: > Hi, > > It is easy to understand the types vector and frame. > > But I am wondering why the type factor is designed in R. What is the > advantage of factor compare with other data types in R? Can somebody > give an example in whi

Re: [R] Convert list to data frame while controlling column types

2009-08-24 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 23.08.2009 17:29:48: > On 8/23/2009 9:58 AM, David Winsemius wrote: > > I still have problems with this statement. As I understand R, this > should be impossible. I have looked at both you postings and neither of > them clarify the issues. How can you ha

[R] Odp: A question on List

2009-08-21 Thread Petr PIKAL
Hi mapply("*", vect, mat, SIMPLIFY=F) Regards Petr r-help-boun...@r-project.org napsal dne 21.08.2009 10:53:19: > > Suppose I have following list : > > mat <- vector("list") > for (i in 1:4) mat[[i]] <- matrix(rnorm(25),5) > mat > > > mat > [[1]] > [,1] [,2] [,3]

Re: [R] Histogram problem

2009-08-20 Thread Petr PIKAL
making your own histogram function it is hard to say what do you want. I am pretty sure you are inventing a wheel. Regards Petr Conrad Addo napsal dne 20.08.2009 16:29:36: > Petr > > Actually I wanted to find why the NUm vector was adding incrementally, not > about the CSV. &

[R] Odp: Histogram problem

2009-08-20 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 20.08.2009 15:33:38: > I'm trying to create a histogram from the following code, but my data keeps > adding the Num vector and plotting that. My data in the CSV file is just > one vector. Does anyone know why? Well, I think that only you know why CS

Re: [R] Embedding lists in matrices and matrices in lists

2009-08-20 Thread Petr PIKAL
ur procedures. Regards Petr > http://paste.ubuntuusers.de/396117/ It even runs (though errors occur if > I add th process r into the main loop, but I'm still not done with it...). > > Petr PIKAL schrieb: > > Hi > > > > > > No. It is the problem of scoping. AFAIK function

Re: [R] Embedding lists in matrices and matrices in lists

2009-08-19 Thread Petr PIKAL
ons for manipulation with lists. E.g. structure lm(...) results in list and summary(lm(...)) is again a list with quite complicated structure. If I understand it correctly, during your computation you will have as a result matrices with arbitrary dimensions. I would make a list lll<-vec

Re: [R] scale or not to scale that is the question - prcomp

2009-08-19 Thread Petr PIKAL
OIS Thank you both for pointing me to it. I did not notice this as the unscaled position of points was quite clear and strightforward according to my knowledge of data. The scaled plot is slightly more distorted and the relationships are not so obvious. Thank you both Petr Pikal petr.pi

Re: [R] scale or not to scale that is the question - prcomp

2009-08-19 Thread Petr PIKAL
Ok Thank you for your time. Best regards Petr Pikal Duncan Murdoch napsal dne 19.08.2009 16:29:07: > On 8/19/2009 10:14 AM, Petr PIKAL wrote: > > Duncan Murdoch napsal dne 19.08.2009 15:25:00: > > > >> On 19/08/2009 9:02 AM, Petr PIKAL wrote: > >> > Tha

Re: [R] scale or not to scale that is the question - prcomp

2009-08-19 Thread Petr PIKAL
Duncan Murdoch napsal dne 19.08.2009 15:25:00: > On 19/08/2009 9:02 AM, Petr PIKAL wrote: > > Thank you > > > > Duncan Murdoch napsal dne 19.08.2009 14:49:52: > > > >> On 19/08/2009 8:31 AM, Petr PIKAL wrote: > >>> Dear all > >>&g

Re: [R] scale or not to scale that is the question - prcomp

2009-08-19 Thread Petr PIKAL
Thank you Duncan Murdoch napsal dne 19.08.2009 14:49:52: > On 19/08/2009 8:31 AM, Petr PIKAL wrote: > > Dear all > > > > I would say the answer depends on the meaning of the variables. In the > unusual case that they are measured in dimensionless units, it mi

Re: [R] Embedding lists in matrices and matrices in lists

2009-08-19 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 19.08.2009 13:04:39: > Strange, it doesn't work for me: > > Error in database[4, 4][[1]][1, ] : incorrect number of dimensions > Execution halted > > R version 2.9.0 (2009-04-17) on Arch Linux, no additional packages > installed. database[4,4][[1]][,

[R] scale or not to scale that is the question - prcomp

2009-08-19 Thread Petr PIKAL
"ano" while highest group has low value of sio2. But when I do the same with scale=T fit<-prcomp(~iep+sio2+al2o3+p2o5+as.numeric(dus), data=rglp, factors=2, scale=T) biplot(fit, choices=2:3,xlabs=rglp$vzorek, cex=.8) I get completely different picture which is not possible t

[R] Odp: Remove columns

2009-08-19 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 18.08.2009 10:14:26: > Hi Everbody > > Could somebody help me.? > > I need to remove the columns where the sum of it components is equal to > zero. > > For example > > > a<-matrix(c(0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,1,1,0,0,1,0), ncol=4) > > a >

Re: [R] vector replacement 1/0 to P/A

2009-08-18 Thread Petr PIKAL
Hi As matrix is vector with dim attribute mymat<-ifelse(mymat==0, "A","P") should be sufficient. Even with data frame it works mydf<-data.frame(mymat) mydf<-ifelse(mydf==0, "A","P") mydf X1 X2 X3 [1,] "P" "P" "A" [2,] "A" "A" "A" [3,] "A" "A" "P" [4,] "A" "A" "P" [5,] "P" "P" "P" R

[R] Odp: Replacing NA values in one column of a data.frame

2009-08-18 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 17.08.2009 17:41:59: > > Dear all, > > I'm trying to replace NA values with - in one column of a data frame. I've Well, Jim sent you a solution but I would rise a question, why do you want to do that. R has many instruments how to smoothly handl

[R] Odp: How to use R to perform prediction based on history data

2009-08-18 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 15.08.2009 04:27:39: > Say I have a csv file, each row contains several fields, one of them > are whether the row is success. > > In history data, I have all the fields including the result of whether > it is success. In future data, I only have fields

[R] Odp: (no subject)

2009-08-18 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 18.08.2009 10:35:11: > Dear all, > > I have a problem with the function read.xls from the gdata package, error > message see below. Two examples: > > First, I try to read my data, which does not work; > Secondly, I tried the example code/data with th

[R] Odp: how to draw pentagon?

2009-08-18 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 18.08.2009 06:13:09: > Hi everyone, > I want you all help me to give an idea, how to draw pentagon with points? > Maybe can use function, but I'm stuck. Maybe. Maybe you can use a pencil, instead. Basically this plot(1:10, type="n") polygon(c(2,3,5,6

[R] Odp: Polygon function

2009-08-18 Thread Petr PIKAL
r-help-boun...@r-project.org napsal dne 17.08.2009 16:18:43: > Dear all, > I would like to plot credible interval for a function estimate in R. I > would like to plot the credible intervals as shaded region using polygon > function. Does anyone ever used that? I tried several times but I could > n

[R] Odp: function merge()

2009-08-18 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 18.08.2009 14:32:43: > Hi, > > Actually, i use the function merge like this: > > (Data1 <- Data1[1:7,1:3]) > Policy.Number AXA.Entity Country > 1106077BNL BNL > 2 4001023 CH BNL > 3106006 UK B

[R] Odp: vector replacement 1/0 to P/A

2009-08-18 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 17.08.2009 16:22:39: > Hi, > Can someone suggest an efficient way to substitute a vector/matrix > which contains 1's and 0's to P's and A's (resp.)? vec<-sample(0:1, 20, replace=T) vec [1] 1 1 0 1 0 1 0 1 0 0 1 1 0 0 0 0 0 0 1 0 vec<-ifelse(vec==0, "A",

[R] Odp: Lattice in a loop does not produce output

2009-08-18 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 18.08.2009 14:13:12: > I cannot understand why xyplot does not work within a simple for loop. > > This works up to the for loop; inside the for loop the png files are > opened and closed, but nothing is plotted. No error messages are written > to the co

Re: [R] package lattice can't be loeaded

2009-07-31 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 31.07.2009 08:27:24: > The error message is: "Error in library(lattice) : there is no package called 'lattice'" > > I have installed it twice because it did not work the first time, so I was not > sure if it worked. > And YES, the folder lattice is in

[R] Odp: What is the best method to produce means by categorical factors?

2009-07-30 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 30.07.2009 10:19:21: > I am attempting to replicate some of my experience from SAS in R and assume > there are best methods for using a combination of summary(), subset, and > which() to produce a subset of mean values by categorical or ordinal > factor

Re: [R] regexpr virtue

2009-07-29 Thread Petr PIKAL
returns the position in the string x where that regular > expression begins. Feed that to substring() and you get the desired > result. Both substring() and regexpr() work on vectors of strings. > > Best regards, > Chuck Taylor > TIBCO Spotfire Seattle > > > -Origi

Re: [R] regexpr virtue

2009-07-29 Thread Petr PIKAL
trapply(s, "[0-9]*$", simplify = c) > > > > On Wed, Jul 29, 2009 at 9:10 AM, Petr PIKAL wrote: > > Hi all > > > > I have got something like that (actually those are column names) > > > > [51] "X19.2.300b...80" "X19.2.

Re: [R] regexpr virtue

2009-07-29 Thread Petr PIKAL
> > x > [1] "X19.2.400v...80" > > strsplit(x,"\\...")[[1]][3] > [1] "80" > > HTH, > > Jorge > > On Wed, Jul 29, 2009 at 9:10 AM, Petr PIKAL wrote: > Hi all > > I have got something like that (actually those are colum

[R] regexpr virtue

2009-07-29 Thread Petr PIKAL
Hi all I have got something like that (actually those are column names) [51] "X19.2.300b...80" "X19.2.400v...80" "X19.2.400b...80" "X19.2.300v...90" "X19.2.300b...90" [56] "X19.2.400v...90" "X19.2..400b..90" "X19.2.300v...100" "X19.2.300b...100" "X19.2.400v

[R] Odp: aggregating strings

2009-07-28 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 28.07.2009 17:34:35: > I am currently summarising a data set by collapsing data based on common > identifiers in a column. I am using the 'aggregate' function to summarise > numeric columns, i.e. "aggregate(dat[,3], list(dat$gene), mean)". I also w

Re: [R] pairs plot

2009-07-28 Thread Petr PIKAL
rsion and unzip it to library subdirectory. > Then: > library(TeachingDemos) shall be executed without problem Regards Petr > > > --- On Tue, 7/28/09, Jose Narillos de Santos wrote: > > > From: Jose Narillos de Santos > > Subject: Re: [R] pairs plot

Re: [R] create dataset permanently in package (i.e. default or our own package)

2009-07-28 Thread Petr PIKAL
Hi If you want to use brute force without much knowledge about packages make your own directory in librarary directory select any package in your library directory and copy it to directory you just made leave only INDEX and DESCRIPTION files and R and Data directorires change DESCRIPTION file ac

[R] Odp: Sort a column in a dataframe

2009-07-28 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 28.07.2009 12:40:59: > Dear Users > > This is my dataset called mydata4. I want to sort the dataframe on the first > column PxMid which is basically a column with dates. > > I've tried mydata4<-mydata4[order(mydata4$PxMid),] but it doesnt work. Could

[R] Odp: vary the parameters for a function

2009-07-28 Thread Petr PIKAL
Hi maybe outer? Regards Petr r-help-boun...@r-project.org napsal dne 28.07.2009 11:36:10: > > > > > > > How I can vary the parameters for a function? > > I have a function with 5 parameters I want to turn the function for a range of > numbers for one of these parameters!! i want to ha

Re: [R] pairs plot

2009-07-28 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 28.07.2009 09:55:11: > Hi Greg I saw, read, the TeachingDemos you suggesttef but when run pairs2 > function on my R module says "Can´t find function pairs2" > > How can I load the module or function pairs2? Did you do library(TeachingDemos)? Regards

[R] Odp: Cumulative row sums, row differences

2009-07-28 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 28.07.2009 09:18:43: > > > I tried searching but I couldn't quite find what I was looking for. > > Here's a dummy data matrix (with row and column labels): > > y >0 1 2 3 4 > 21 3 4 8 5 5 > 22 3 6 8 6 NA > 23 4 5 11 4 3 > 24 4 2 1 4 6 > 25

Re: [R] labelling points plotted in a 2D plan

2009-07-27 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 25.07.2009 23:15:04: > Thanks for the answer Tal! > But I can't get it to work correctly! :( > Please bear with me this is the first time I am using R! and I am in a rush > to correct a paper > in fact on the plane I am plotting a table > > fullpointed=

Re: [R] [Rd] How to create a permanent dataset in R.

2009-07-27 Thread Petr PIKAL
Hi I use saved R file stand.R which looks like this "stand" <- list( b110 = c(49.45000, 21.46, 11.468333, 24.33500, 28.112240), b120 = c(49.77333, 19.386667, 7.736667, 20.87500, 21.753788), b130 = c(49.60833, 18.365000, 5.708333, 19.23167, 17.265409), b140 = c(5

Re: [R] contour plot

2009-07-23 Thread Petr PIKAL
Hi maybe package akima with function interp can help you Regards Petr r-help-boun...@r-project.org napsal dne 23.07.2009 11:04:25: > That problem is that for every y I get a different x and thus cant > create an array as in the help page examples. > I was just wondering, whether there is a poss

[R] Odp: simple question about exporting data...

2009-07-23 Thread Petr PIKAL
Hi Strange. Before starting with R about 10 years ago I used Excel for for graphing too. As soon as I learned few tricks and read intro documents I abandoned Excel for graphing almost completely. Now even for simple visualisations of data I copy them ***from*** spreadsheet to R. But as you mak

Re: [R] how to use a list to create a plot

2009-07-21 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 21.07.2009 14:37:35: > > > Graves, Gregory wrote: > > I issued the following command to obtain the std dev for each month. > > > > > > > > psd<-numSummary(Sal, groups=month, statistics=c("sd")) > > > numSummary is not in base R, is it? If not, whi

Re: [R] Re gression for loop test HELP! URGENT!

2009-07-21 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 21.07.2009 09:18:51: > > Hi Daniel, > Thanks for the insight. My apologies for the unclearness of my original > question. > I have calculated the fit and se.fit values, see below > predict(fm,newdata=test, se.fit=TRUE, type=c("response")) > If I wasn't

[R] Odp: Save results

2009-07-16 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 16.07.2009 11:31:25: > I imagine I make a function whose results are a Matrix Z > > How cn I save in a txt or excel file the result of apply my function? > > something similar to save Z.txt. write.table(tab, "clipboard", sep = "\t", row.names = F) to

Re: [R] For loop for distinguishing negative numbers

2009-07-16 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 15.07.2009 17:59:39: > > see ?ifelse > > you didn't specify what happens if a value is exactly zero in the dataset > and so i've just bundled it in with the negative case: > > x <- rnorm(20, 0, 1) > y<-ifelse(x<=0, 10, 5) For this simple case you ca

Re: [R] hi friends, is there any wait function in R

2009-07-15 Thread Petr PIKAL
c graphics so it should not be necessary. > >> > >> If you are getting blank plots when you shouldn't, that's a bug. If you can > >> put together a reproducible example that shows its a bug in R, rather than a > >> bug in your script, it will li

[R] Odp: hi friends, is there any wait function in R

2009-07-14 Thread Petr PIKAL
Hi For this type of problems I do multipage pdf. pdf("file", ) for (i in ...) { do all stuff including plot } dev.off() and then check the plots afterwards. Recently there was some post about how to wait but you do not want only wait you want also to interactively change plotting parameter

Re: [R] read.delim skips first column (why?)

2009-07-14 Thread Petr PIKAL
Hi > str(read.table("test.txt", header=T)) 'data.frame': 9 obs. of 12 variables: $ snp : Factor w/ 9 levels "rs1113188","rs1113397",..: 9 5 7 8 3 4 6 1 2 $ gene : Factor w/ 1 level "TRP2": 1 1 1 1 1 1 1 1 1 $ chromosome : int 3 3 3 3 3

[R] Odp: Combine two matricies

2009-07-13 Thread Petr PIKAL
Hi matrix is virtually a vector so you can find index of values of x and add those values to propper places in ax ax <- a idx <- which(!is.na(x)) ax[idx] <- x[idx] ax [,1] [,2] [,3] [1,]321 [2,]422 [3,]552 Regards Petr r-help-boun...@r-project.org napsa

[R] Odp: Problems in plotting with abline

2009-07-13 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 13.07.2009 10:45:50: > Dear R-users, > I am using R(a package igraph) to calculate certain > topological features of networks. When I try to draw a plot between these > features I get an error. Following is the code I am using : >

Re: [R] for (n in SystemResults$EnTime) return EnTime[n] until reaching "(all)"

2009-07-13 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 12.07.2009 22:24:29: > On Sun, Jul 12, 2009 at 1:05 PM, David Winsemius wrote: > > > > On Jul 12, 2009, at 3:35 PM, David Winsemius wrote: > > > >> > >> On Jul 12, 2009, at 2:53 PM, Mark Knecht wrote: > >> > >>> > >>> As a test I tried to print down to

[R] Odp: while( ) to get a vector until the sum of elements are <= X ?

2009-07-10 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 10.07.2009 12:07:03: > I have a vector of values > > > > X = seq(1:10) > > > > I want to get another vector V of with sample (with replacement) of X but > with a constrain: V will have as much elements as those necessary to V sum > exactly 10. >

Re: [R] Strange t-test error: "grouping factor must have exactly 2 levels" while it does...

2009-07-10 Thread Petr PIKAL
Hi you have to look to your data when I used your function to some artificial data I got expected result > myfun(visko,"konc") Levels = 2 [[1]] [1] NA [[2]] Welch Two Sample t-test data: data[[nam[v]]] by data[[g]] t = -1.7778, df = 4.541, p-value = 0.1415 alternative hypothesis:

[R] Odp: row data manipulation in data frame

2009-07-10 Thread Petr PIKAL
Hi maybe ?cumsum, or ?diff or ?aggregate Regards Petr r-help-boun...@r-project.org napsal dne 10.07.2009 10:56:34: > R users, > I am a beginner in R. I have a time series data on various macro variables > like GDP, unemployment rate, consumer spending, imports, exports etc. I am > interested

Re: [R] Best way to export values from a function?

2009-07-09 Thread Petr PIKAL
Hi Godmar Back napsal dne 09.07.2009 14:09:42: > On Thu, Jul 9, 2009 at 4:50 AM, Petr PIKAL wrote: > Hi > > r-help-boun...@r-project.org napsal dne 09.07.2009 02:57:33: > > Not so weird. What do you expect from > > c(1:5, 10:20, 30:50) > > You mean wha

Re: [R] Best way to export values from a function?

2009-07-09 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 09.07.2009 02:57:33: > On Wed, Jul 8, 2009 at 8:34 PM, Jason Rupert wrote: > > > > Maybe there is a great website out there or white paper that discusses this > but again my Google skills (or lack there of) let me down. > > Yeah, R is difficult to se

Re: [R] error: no such index at level 2

2009-07-09 Thread Petr PIKAL
Hi Godmar Back napsal dne 08.07.2009 15:28:50: > On Wed, Jul 8, 2009 at 4:22 AM, Petr PIKAL wrote: > Hi > > r-help-boun...@r-project.org napsal dne 07.07.2009 19:06:17: > > > Hi, > > > > I am confused about how to select elements from a list. > > >

[R] Odp: Fitting a trend-line

2009-07-08 Thread Petr PIKAL
Hi see ?lm and ?abline Regards Petr r-help-boun...@r-project.org napsal dne 08.07.2009 11:31:19: > Hi all, > I am new to R. How does one go about fitting a trend-line to a > scatter plot? Any help is appreciated. > > Thanks and regards, > > Anupam > >[[alternative HTML version de

[R] Odp: error: no such index at level 2

2009-07-08 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 07.07.2009 19:06:17: > Hi, > > I am confused about how to select elements from a list. > > I'm trying to select all rows of a table 'crossRsorted' such that the > mean of a related vector is > 0. The related vector is accessible as > a list element l[

Re: [R] How to separate the string?

2009-07-07 Thread Petr PIKAL
ring to each alphabet > where each alphabet will be in different column. > > thanks alot. > > regards, > Hema. > On Tue, Jul 7, 2009 at 4:12 PM, Petr PIKAL wrote: > Hi > > r-help-boun...@r-project.org napsal dne 07.07.2009 09:54:30: > > > Hi everyone, >

[R] Odp: Multiplication of data frame with vector

2009-07-07 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 07.07.2009 10:05:09: > > Dear group: > sorry for my beginners question, but I'm rather new to R and was searching > high and low without success: > > I have a data frame (df) with variables in the rows and observations in the > columns like (the ac

[R] Odp: How to separate the string?

2009-07-07 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 07.07.2009 09:54:30: > Hi everyone, > Hi want to separate the string(column1) for example Well, how did you get the data in R? Are they in separated columns of data.frame? What do you mean by "separate"? > > column1 column2 column3 column4 column5 co

Re: [R] OK - I got the data - now what? :-)

2009-07-07 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 06.07.2009 01:58:38: > On Sun, Jul 5, 2009 at 1:44 PM, hadley wickham wrote: > >> I think the root cause of a number of my coding problems in R right > >> now is my lack of skills in reading and grabbing portions of the data > >> out of arrays. I'm ne

[R] Odp: R on flash

2009-07-03 Thread Petr PIKAL
Quicvk and dirty Insall R to PC and copy the appropriate directory to flash disk. Regards Petr r-help-boun...@r-project.org napsal dne 03.07.2009 14:34:59: > Hi! > > Is there some R version for flashdisk, pendrive etc ? > > -- > Regards, > > Raphael Saldanha > saldanha.plan...@gmail.com >

Re: [R] Odp: Getting the month out of my date as a number not characters

2009-07-02 Thread Petr PIKAL
"%m") [1] "02" > as.numeric(format(strptime("20/2/06 11:16:16.683", "%d/%m/%y %H:%M:%OS"), "%m")) [1] 2 Regards Petr > > > Petr PIKAL wrote: > Hi > > r-help-boun...@r-project.org napsal dne 02.07.2009 12:40:05: > >

[R] Odp: Getting the month out of my date as a number not characters

2009-07-02 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 02.07.2009 12:40:05: > I have a data frame (hf) that is all set up and the dates are working > fine - however I need to extract the months and hours (2 separate > columns) as numbers - however they are coming out as characters. > > I have tried both t

Re: [R] ?max (so far...)

2009-07-01 Thread Petr PIKAL
Hi what about do inside some function a subset of your whole data frame fff <- function( data, rows) { data.1 <- data[1:rows,] get all necessary stuf on data.1 return what you want } You can put a dimension check if you want the function to be more robust Regards Petr r-help-boun...@r-pr

[R] Odp: re moving value from a vector

2009-06-29 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 29.06.2009 10:58:50: > > Hallo, > > I have a vector of several iterations and I have to remove /filter out all > the values < than 10, > how can I do this? vector[vector>=10] does what you want but word "vector of iterations" frightens me a little

[R] Odp: code that will use two data sets which differ in size.

2009-06-26 Thread Petr PIKAL
Petr Pikal petr.pi...@precheza.cz 724008364, 581252140, 581252257 r-help-boun...@r-project.org napsal dne 26.06.2009 05:31:27: > Hi all, > > This is a really basic question but I can't figure it out. > > I am trying to write a piece of code that will use two datasets, z

[R] Odp: to raise in a loop more than 1

2009-06-26 Thread Petr PIKAL
Hi does expand.grid(z=seq(0,6,2), y=seq(0,8,4), x=seq(0,10,2)) do what you want? Petr r-help-boun...@r-project.org napsal dne 26.06.2009 11:15:42: > I would raise x,y and z in a loop but I won't raise of 1. I tried this but it > doesn't work > > mydata=matrix(nrow=1500,ncol=3) > i=1 > for(

[R] Odp: subsetting data frame using a vector of column names / values

2009-06-24 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 24.06.2009 14:16:15: > Hello > > I have a data frame d with columns "var1", "var2", "var3" > > Then I have two vectors: > columns <- c("var2", "var3") > values <- c(0, 1) > > > Is there a compact way to subset the data frame > using these two vectors

Re: [R] first value...

2009-06-23 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 23.06.2009 16:04:49: > Try this: > > which(diff(is.na(inc)) < 0) Shall it be which(diff(is.na(inc)) < 0)+1 or sum(is.na(inc))+1 or any other suitable construct with is.na Regards Petr > > On Tue, Jun 23, 2009 at 11:00 AM, Alfredo Alessandrini

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-22 Thread Petr PIKAL
omething like this. > fff2<-function(x) length(unique(x))==1 > system.time(print(fff2(x))) [1] FALSE user system elapsed 0.390.080.47 Regards Petr > On Fri, Jun 19, 2009 at 8:18 AM, Petr PIKAL wrote: > Hi > > utkarshsinghal napsal dne > 17.06.2009 15:29:

Re: [R] Testing if all elements are equal in a vector/matrix

2009-06-19 Thread Petr PIKAL
Hi utkarshsinghal napsal dne 17.06.2009 15:29:34: > I will wait for the next version-2.9.1 and presently using Petr's suggestion, i.e., > (x[1]*length(x))==sum(x) > which significantly reduced the run time. > > The problem is now there might be only small differences ,say, of the order of >

[R] Odp: Error "the condition has length > 1 and only the first element will be used"

2009-06-19 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 19.06.2009 09:26:57: > Ahoy. I'm trying to run a function for each country in a multinational > dataset. Keeping it simple, an example is > > > for(j in 11:14) { > if(data$country_str == "j") { > > mu <- mean(data$ecdfs1) > } else { > mu <- 0 > } > }

Re: [R] ifelse(is.na), with function inside

2009-06-19 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 17.06.2009 14:59:35: > > This is my function: > > zywnoscCalosc <- function( zywnosc, sklepik, sklslodycze) { > > b=as.vector(sklslodycze) > > fun=function(a,b){ > a=2+b > } > zywnosc=ifelse(is.na(sklepik),NA,fun(a,b))#Here I have a problem

<    5   6   7   8   9   10   11   12   13   14   >