Re: [R] How to get the input of a function right?

2012-03-29 Thread Petr PIKAL
Hi Hi Michael and Sarah, Thank you for offering help. I finally managed to construct an example with all essentials of my problem: x1-c(1,2,3,4) x2-c(2,3,4,5) x3-c(3,4,5,6) x-rbind(x1,x2,x3) time-c(1,3,9) fit-function(xx,t,tcc){slope - coefficients(lm(log(xx) ~ 0 + t))[1] You

Re: [R] matrix(unlist(strsplit())) 'missing value' issue

2012-03-28 Thread Petr PIKAL
What problem? Nabble is not available to all and here is not much to cook from. Nobody any solution for my problem?? -- View this message in context: http://r.789695.n4.nabble.com/matrix-unlist- strsplit-missing-value-issue-tp4509065p4511668.html Sent from the R help mailing list

Re: [R] R Error : DATA to MATRIX

2012-03-26 Thread Petr PIKAL
On similar lines, how do I assign the position of the an occurence of a value say 7 in a data vector to another data vector? nFields [1] 6 6 6 6 6 6 7 7 6 6 6 7 6 6 6 6 I need the output data vector showing occurence of 7 as: [1] 7 8 12 which(nFields==7) Regards Petr I tried

Re: [R] many curves to the same plot

2012-03-26 Thread Petr PIKAL
Hi If you went through help page you probably could find it yourself in shorter time then you spend writing email and waited for others to write back. see ?plot.stepfun Dear all, I would like to plot under the same plot many curves like mycdf-ecdf(runif(100)) plot(mycdf)

[R] Odp: question

2012-03-23 Thread Petr PIKAL
How do you run a regression in R? By invoking appropriate function for regression. ??reggression Regards Petr [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] R Error : DATA to MATRIX

2012-03-23 Thread Petr PIKAL
Hi See in text. Dear Sir/Madam, I'm getting a problem with a R-code which converts a data frame to a matrix. It first generate a (m^(n-m) * m) matrix A and then regenerate another matrix B having less dimension than A which satisfy some condition. Now I wish to assign each row of B

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-23 Thread Petr PIKAL
Hi Added a little more to my code (see below). It now automatically sets the name of the file. It also does a better job of spacing the text for pattern and patient x line at the top of the graph. I really like the way this looks now. I just need to figure out how to loop through the

Re: [R] Plotting patient drug timelines using ggplot2 (or some other means) -- Help!!!

2012-03-23 Thread Petr PIKAL
Hi Hi Michael and Petr, You both seem to have hit on the idea of splitting the TestData in order to do by group processing. Trouble is that ggplot2 doesn't seem to like lists very much. When I run the code: TempData - split(TestData, TestData$key_line) TempData for(temp in

Re: [R] Not colour but symbols

2012-03-22 Thread Petr PIKAL
Hi Hi Thank you Bert and Thomas for your help, I did what I wanted with this code. test-c(4,8,9,6,7) barplot(test,density =20,angle=45) But I want to cross the lines in each bar. Maybe there is some other option in some add-on package but you can simply add a second barplot

Re: [R] Macro or Loop info/help needed

2012-03-22 Thread Petr PIKAL
Hi It is better instead of vague description of your file to use dput(t4) or at least str(t4) for showing internals. If I understand correctly your data frame will have columns eventXyear, eventZyear... and qXayr. qXayr have values 73, 74, ... and you want to change values in eventXyear to 1

Re: [R] Problem in loop

2012-03-22 Thread Petr PIKAL
Hi Dear R users I want change the entries in a matrix. I did a matrix A=0 1 5 .3 0 0 0 .5 0 A1-A A2-A*0.90 A2 12 3 1 0.00 0.90 4.5 2 0.27 0.00 0.0 3 0.00 0.45 0.0 I need replace elements one by one in a loop I tried the

Re: [R] Problem reading mixed CSV file

2012-03-19 Thread Petr PIKAL
Hi This is quite a CPu consuming process. My system got hung up for the big file I have. Within the for loop that you have suggested, can't I have a case statement for different value of nfields to be read and specify what format does the variable needs to be read? something like case

Re: [R] line plot over a barplot

2012-03-16 Thread Petr PIKAL
Hi Dear all, I have data in the following format : X-axisY-axis 010% 0-20 20% 20-4030% 40-6040% . and so on. I want to plot a bar graph of the above. Also I would want to add a trendline passing

Re: [R] aggregate

2012-03-15 Thread Petr PIKAL
Hi Dear all I am having a vector with large length and I would like to ask you if I can aggregate the values by constant sized windows. For example for the following vector, I would like to take 30 points until the end and find their mean. myData-seq(1:10)

Re: [R] Source code

2012-03-15 Thread Petr PIKAL
Hi Hi everyone, I need to see the source code of function Does anybody know how can I find so. Thanks a lot. What function? mean.default function (x, trim = 0, na.rm = FALSE, ...) { if (!is.numeric(x) !is.complex(x) !is.logical(x)) { warning(argument is not numeric or

Re: [R] Average row and column

2012-03-15 Thread Petr PIKAL
Hi Hello I have this code for the count the occurrences between V_source and V_destine, its can possible make the same, but in local the total the occurrences to appear the mean or the minimum Your question is rather cryptic and I am rather confused what you really want. For row/column

Re: [R] 2 images on one plot

2012-03-13 Thread Petr PIKAL
Thanks Jim For the first glance it seems to do what I want. I must go through it more thoroughly. Petr On 03/13/2012 03:07 AM, Petr PIKAL wrote: Dear all with image I can plot only one set of values in one plot. Do somebody have any insight how to put those 2 matrices into one

Re: [R] Matrix Results

2012-03-13 Thread Petr PIKAL
Hi Hello I am developing a small program that to calculate the maximum, minimum and average. The data.frame v is POS DIF 4 - 4 56 4 - 3 61 3 - 3 300 3 - 327 3 - 3 33 3 - 3 87 3 - 4 49 4 - 4 71 4 - 3 121 3 -

[R] Odp: Finding the mean.

2012-03-12 Thread Petr PIKAL
Hi Using functions how would I go about do this question? (I already have a mean defined for a function of x.) Write a function called MyMean2. This function has two arguments, x and nonzero, where nonzero has the default value TRUE. This function should return the (Previous

[R] 2 images on one plot

2012-03-12 Thread Petr PIKAL
Dear all with image I can plot only one set of values in one plot. Do somebody have any insight how to put those 2 matrices into one picture so that in one cell in image picture are both values from mat[1,1] and mat2[1,1]. mat-matrix(1:4, 2,2) mat2-matrix(4:1,2,2) x -1:2 y -1:2 image(x, y,

Re: [R] Loop struggle

2012-03-09 Thread Petr PIKAL
Hi you are coming from different language paradigm? Although you did not provide your data I presume you have data frame called data with columns SP, A1-A5 Your construction data[1:n, A1]- data$A1 -1 seems to me rather strange and basically your cycle shall do

Re: [R] Loop struggle

2012-03-09 Thread Petr PIKAL
data[1:n, A4]- data$A4 -2 data[1:n, A5]- data$A5 -2} else if(data$SP==3){ data[1:n, A1]-data$A1 -3 data[1:n, A2]-data$A2 -3 data[1:n, A3]-data$A3 -3 data[1:n, A4]-data$A4 -3 data[1:n, A5]-data$A5 -3} } -Tiff 9. maaliskuuta 2012 10.43 Petr PIKAL petr.pi...@precheza.cz

Re: [R] Copy dataframe for another

2012-03-09 Thread Petr PIKAL
Hi Hello, the idea is to copy the d for df, with new results. x-data.frame(name=x1,pos=4,age=20) x-rbind(x,data.frame(name=x2,pos=5,age=20)) x-rbind(x,data.frame(name=x3,pos=6,age=21)) x-rbind(x,data.frame(name=x4,pos=7,age=24)) x-rbind(x,data.frame(name=x5,pos=8,age=27))

Re: [R] For loop and using its index

2012-03-09 Thread Petr PIKAL
Hi Dear All, I have a data set with variables x1, x2, x3, ..., x20 and I want to create z1, z2, z3, ..., z20 with the following formula: z1 = 200 - x1 z2 = 200 - x2 z3 = 200 - x3 . . . z20 = 200 - x20. I tried using a for loop and its index as: for (i in 1:20) { z(i) =

Re: [R] sort dates

2012-03-09 Thread Petr PIKAL
Hi Hello, How is it possible to sort dates in R? You mean sort? Or order? Something like: dd -sample(Sys.Date()-1:10) dd [1] 2012-03-04 2012-03-05 2012-02-29 2012-03-01 2012-03-02 [6] 2012-03-08 2012-03-03 2012-02-28 2012-03-06 2012-03-07 sort(dd) [1] 2012-02-28 2012-02-29 2012-03-01

Re: [R] Sampling problems

2012-03-08 Thread Petr PIKAL
Hi I have only faint idea what was you problem as there is no context in you message but maybe remainder-MeanA[-mysample, ] could work. Regards Petr Hi, thank you but it does work for vectors and matrix but not dataframes, it gives me this message error: MeanA -

Re: [R] Sampling problems

2012-03-08 Thread Petr PIKAL
Hi, thank you but it does work for vectors and matrix but not dataframes, it gives me this message error: MeanA - read.csv(MeanAmf.csv,header=T) mysample - MeanA[sample(1:nrow(MeanA), 20, replace=FALSE),] Well, maybe slight correction mysample - sample(1:nrow(MeanA), 20, replace=FALSE)

Re: [R] Problem with a Matrix

2012-03-08 Thread Petr PIKAL
Hi Dear All, I have a problem in making a matrix from a data. I did a summary data from a big data frame using (ddply), the resulting table is like that: Site.NoPlant.NameCover.Percentage 1XXX15 1YYY 20 2

[R] evaluation of categorical and opinion data

2012-03-08 Thread Petr PIKAL
Dear all. I have some data and I seek the way to start their evaluation. The values are from survey of different persons and their opinion about various methods (metoda) and instrument (uzel). I am not sure where to start. I would like to end with combination of method (metoda) and instrument

Re: [R] Re : Re : Adding mean line to a lattice density plot

2012-03-08 Thread Petr PIKAL
Hi You can use this function to add arbitrary line to already plotted lattice graph. addLine- function(a=NULL, b=NULL, v = NULL, h = NULL, ..., once=F) { tcL - trellis.currentLayout() k-0 for(i in 1:nrow(tcL)) for(j in 1:ncol(tcL)) if (tcL[i,j] 0) { k-k+1 trellis.focus(panel, j,

Re: [R] Re : Re : Adding mean line to a lattice density plot

2012-03-08 Thread Petr PIKAL
elements in a lattice/trellis plot. Kind regards, Kimmo 08.03.2012 16:53, Petr PIKAL wrote: Hi You can use this function to add arbitrary line to already plotted lattice graph. addLine- function(a=NULL, b=NULL, v = NULL, h = NULL, ..., once=F) { tcL- trellis.currentLayout() k-0

Re: [R] pulling out 1 country and 1 wave

2012-03-07 Thread Petr PIKAL
myself which is not I am not confused at all. At my side everything works as expected. Regards Petr typical of me. ~Nicole - Original Message - From: Petr PIKAL petr.pi...@precheza.cz To: Nicole Marie Ford nmf...@uwm.edu Cc: r-help r-help@r-project.org Sent: Wednesday, March

Re: [R] Subset problem

2012-03-07 Thread Petr PIKAL
Hi Good Morning I have a small question regarding the function subset. I am copying data from one table but I just want to collect data from a user. When do I take the view, presents the results I want. The problem arises when can I make the tab. for RES_ID, introduces me to zero

[R] Odp: Column with codes

2012-03-07 Thread Petr PIKAL
Hi Good Day, I have a small question, I think it is simple to solve, I have a column with the following records name saucer cup tea saucer saucer what is the quickest way to create a new column codes 1 1 3 1 1 Those numbers does not correspond to above mentioned

Re: [R] How to sort frequency distribution table?

2012-03-07 Thread Petr PIKAL
Hi Just order your table output. xx-sample(letters[1:5], 100, replace=T) yy-table(xx) barplot(yy[order(yy, decreasing=T)]) Regards Petr Hi, I am working on categorical data with column as disease name(categaory). My input data is [1] Acute lymphoblastic leukemia (childhood)

Re: [R] problem with data

2012-03-07 Thread Petr PIKAL
Good Afternoon, I have a small problem with the following code. # The x.sub$Time[[1]] 2006-10-31 19:03:01 EST # when put in variable star give-me star-x.sub$Time[[1]] print(star) print(x.sub$Time[[1]]) [1] 1 36 32 - do not understand why Why what? Without

Re: [R] pulling out 1 country and 1 wave

2012-03-06 Thread Petr PIKAL
Hi wvs.a[,362] Error: object 'wvs.a' not found table(wvs.a[,362]) Error in table(wvs.a[, 362]) : object 'wvs.a' not found norway - wvs.a[which(wvs.a[,362] == 2005), ] Error: object 'wvs.a' not found dim(norway) Error: object 'norway' not found I get errors with all your commands and have

Re: [R] pulling out 1 country and 1 wave

2012-03-06 Thread Petr PIKAL
'norway' which is in the dataset as variable 'v218'. - Original Message - From: Petr PIKAL petr.pi...@precheza.cz To: Nicole Marie Ford nmf...@uwm.edu Cc: r-help r-help@r-project.org Sent: Tuesday, March 6, 2012 11:49:39 PM Subject: Re: [R] pulling out 1 country and 1 wave

Re: [R] Vector errors and missing values

2012-03-05 Thread Petr PIKAL
Hi Here is my code: ##Centering predictors### verbal.ability_C - verbal.ability - mean(verbal.ability) children_C - children - mean(children) age_C - age - mean(age) education_C - education - mean(education) work.from.home.frequency_C - work.from.home.frequency -

Re: [R] the problem about sample size

2012-03-04 Thread Petr PIKAL
sizes differ? Many thanks for your help. Helena From: Petr PIKAL [petr.pi...@precheza.cz] Sent: Thursday, March 01, 2012 6:17 PM To: Helena Chui Cc: r-help@r-project.org; r-help-boun...@r-project.org Subject: Re: [R] the problem about sample size

Re: [R] If function error: missing value where TRUE/FALSE needed

2012-03-04 Thread Petr PIKAL
Hi It is strange. I get completely different error. dispersal[1] - if (any (relativenes[1] cost)) ((relativenes[1]- cost)/(relativenes[1]- cost*cost)) else 0 Error: object 'relativenes' not found for (i in 2: time){dispersal[i] - if (any (relativenes[i] cost)) ((relativenes[i]-

Re: [R] Can't find all levels of categorical predictors in output of zeroinfl()

2012-03-04 Thread Petr PIKAL
Hi Far from being an expert in this field I assume the answer is that it is included in intercept term. It has something to do with contrasts specification, but its usage is above my modelling knowledge. You could try to see what ?contrasts tells you. Regards Petr you can Hello, I’m

Re: [R] Delete rows from data.frame matching a certain criteria

2012-03-02 Thread Petr PIKAL
Hi my favourite would be test$v[which(test$pattern==1)]-NA Regards Petr Hi, On Mar 1, 2012, at 12:38 PM, Sarah Goslee wrote: Hi, On Thu, Mar 1, 2012 at 11:11 AM, mails mails00...@gmail.com wrote: Hello, consider the following data.frame: test - data.frame(n =

Re: [R] Vector errors and missing values

2012-03-02 Thread Petr PIKAL
Hi Hi, I am trying to run two Non-Gaussian regressions: logistic and probit. I am receiving two different errors when I try to run these regressions and I am not sure what they mean or how to fix my syntax. Here is the logistic regression error: Error in family$linkfun(mustart) :

Re: [R] Vector errors and missing values

2012-03-02 Thread Petr PIKAL
Hi Hi Petr! Thank you for responding to my post. I checked out all my variables in the way you suggested and they are all in integer form, but here are many missing values in some of my vectors, denoted with NA. So, they are in the correct form, I am just wondering if there is

Re: [R] Error message: object of type 'closure' is not subsettable

2012-03-01 Thread Petr PIKAL
[[2]] NULL [[3]] NULL [[4]] NULL [1] 3.897434 Any suggestions. Thanks for all the help. :) Regards Aparna On Tue, Feb 28, 2012 at 11:01 PM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi Difficult to without knowing what objects you are operating your functions

Re: [R] the problem about sample size

2012-02-29 Thread Petr PIKAL
Hi Hi, there, I run into the same sample size error in JM. Have you found the solution for the error? What error? Petr Many thanks, Helena -- View this message in context: http://r.789695.n4.nabble.com/the-problem- about-sample-size-tp1592855p4434009.html Sent from the R help

Re: [R] asking for a script

2012-02-28 Thread Petr PIKAL
Hi Dear who may concern, I am sending you this email to ask if I could have someone help me to write this script I am interested in. I am requesting the script for performing variance-stabilizing normalizations on the R language. Could you please help me on that? If I am asking a wrong

Re: [R] Error message: object of type 'closure' is not subsettable

2012-02-28 Thread Petr PIKAL
Hi Difficult to without knowing what objects you are operating your functions. I get test.functional.t(1:10,1:10,3,4) Error in res.em1$eta : $ operator is invalid for atomic vectors moderated.functional.t(1:10) Error in testStatistics[numerator, ] : incorrect number of dimensions And

Re: [R] indexing??

2012-02-28 Thread Petr PIKAL
Hi My algorithm as follows; y - c(1,1,1,0,0,1,0,1,0,0) x - c(1,0,0,1,1,0,0,1,1,0) n - length(x) t - matrix(cbind(y,x), ncol=2) Do not use t, it is a function for transposing matrix and after you redefine it you can get nasty surprise in future. tt - cbind(y,x) is enough z = x+y

Re: [R] macro function

2012-02-28 Thread Petr PIKAL
Hi Your mail is quite messy. what is ***? How your data are structured? str(your.data) Please submit part of your data by dput(your.data) and show what the output shall be. Regards Petr Actually, what I really want to do is that, annual productivity data(2011) firts date

Re: [R] loop for a large database

2012-02-27 Thread Petr PIKAL
Hi SORRY! The data in MyTable are tagsets of photos, like this: V1 V2 V3 V4 V5 V6V7 V8 230green nailpolish barrym 0 00 00 231 ny green brooklyn cleanup clean gowanus volunteer gcc 232

Re: [R] What is the fastest way to combine all columns of a matrix to one column?

2012-02-27 Thread Petr PIKAL
Hi Dear all, Newbie: What is the fastest way to combine all columns of a matrix to one column? If mm is your matrix use dim(mm) -NULL Regards Petr -- View this message in context: http://r.789695.n4.nabble.com/What-is-the-

Re: [R] What is the fastest way to combine all columns of a matrix to one column?

2012-02-27 Thread Petr PIKAL
you plain vector dim(mm) - c(rows, columns) gives you now matrix with specified number of rows and columns. You can put columns to 1 and in that case you will get one column matrix. Please provide some toy example what do you really want. Regards Petr thanks again On 2/27/12, Petr

Re: [R] (no subject)

2012-02-23 Thread Petr PIKAL
Hi Hi, The parentheses are in the wrong places in the two if() statements. Look here: (length(table(x)1)) ^^ (length(table(x)==1)) ^ ^ In both cases you're checking whether the length of the comparison (table(x) 1) or

Re: [R] why is generating the same graph???

2012-02-22 Thread Petr PIKAL
Hi Hi, why my script iss always generating the same graph?when I change the parameters and the name of text file? library(MASS) dados-read.table(inverno.txt,header=FALSE) vento50-fitdistr(dados[[1]],densfun=weibull) png(filename=invernoRG.png,width=800,height=600) hist(dados[[1]],

Re: [R] How do I save the current session?

2012-02-22 Thread Petr PIKAL
Hi [R] How do I save the current session? savehistory() gives me the option of saving the executable lines only. I'd like to save everything. Using save is not enough? Regards Petr [[alternative HTML version deleted]] __

Re: [R] Plot Many Data to same plot

2012-02-21 Thread Petr PIKAL
Hi If you want to have more than 6 line types you had either to use colours or to follow last part of lty advice from par and go to section Line types. In that case you can not simúply use lty 1,2,...,n but you have to prespecify line types in some character vector and choose from that

Re: [R] Confused: Inconsistent result?

2012-02-20 Thread Petr PIKAL
Hi This is copy paste from my session: xyz-as.vector(c(ls(),as.matrix(lapply(ls(),class dim(xyz)-c(length(xyz)/2,2) allobj-function(){ + xyz-as.vector(c(ls(),as.matrix(lapply(ls(),class; + dim(xyz)-c(length(xyz)/2,2); + return(xyz) + } xyz [,1] [,2]

Re: [R] (subscript) logical subscript too long in using apply

2012-02-17 Thread Petr PIKAL
Hi apply probably does not understand you function. I do not want to go too deeply into it but I noticed few issues in it. See inline Dear ALL I have this function in R: func_LN - function(data){ med_ge - matrix(c(rep(NA,nrow(data)*ncol(data))), nrow = nrow(data),

[R] Odp: Error while doing T-test

2012-02-15 Thread Petr PIKAL
Hi hi, i am using R for first time. i am trying to do T-test for a sample set with three variables. i attached my data set as CSV file. but when i do t.test(data$Day.1,data$Day.2,var.equal=T) i get this following error. Can anyone please help e identify the problem. Error in if

Re: [R] working on a vector with named elements - unname

2012-02-15 Thread Petr PIKAL
Hi Hi, I am working under R2.11.1 Windows. Rather old one, consider upgrading I work with a set of parameters which is save under a vector. I think it is easier to understand, which parameter is called in the vector by naming all vector elements. For example, we have a vector which the

Re: [R] factor level for non-existing value

2012-02-09 Thread Petr PIKAL
Hi Hello everybody! Let's assume I have the following factor with it's levels: a-factor(c(2,3,3,2,4,2,3,2,2,2,3,2,3)) mydata-data.frame(a) When I plot the vector a using barplot(table(mydata$a) unfortunately the value 1 does not show up, as it does not appear in my data. But

Re: [R] check for nearest value in a vector

2012-02-08 Thread Petr PIKAL
Hi Hi, Is there a way to check which value in a vector is nearest to a given value? so for example I have vector x: x - c(1, 6, 12, 28, 33) and I would like to get the position of the element of x that is nearest to 14 (in this case the third element). Easy. Smallest difference

Re: [R] Writing to a file

2012-02-07 Thread Petr PIKAL
Hi Thank you a lot for answering so fast! but..what do you mean by example? I 've mentioned above the loop I used and I also show how the file looks like I do not see any loop. I do not archive all posts from R help, only those with interesting answers :-) and if you do not keep the

Re: [R] Writing to a file

2012-02-07 Thread Petr PIKAL
Hi now you omitted data, but never mind :-) My loop is the following counter = 0 for (i in 1:nrow(y)) { for (j in 1:ncol(y)) { if (y[i,j]==Func_0005634) { counter = counter + 1 } if(y[i,j]==Func_0005737){ counter = counter + 1 } if(y[i,j]==Func_0005515){

Re: [R] creating more vectors out of one

2012-02-06 Thread Petr PIKAL
Hi Dear R-helpers, I have got a vector which looks like the following: apkz - c(1,2,3,4,5,6,1,1,2,1,2,3,4) now I am trying to find a way to automatically create several vectors, each starting with the number 1, namely: First vector 1 2 3 4 5 6 Second vector 1

Re: [R] I bet apply has a solution

2012-02-06 Thread Petr PIKAL
Hi as.logical(rowSums(apply(Data, 2, diff)0)) here is another option. Regards Petr Hi all For the data below, I would like to return a logical value indicating differences in the data. #Create data Data..-data.frame(a=rep(1,10),b=c(rep(1,9),2),c=c(rep(1,8),2,2)) a b c 1 1 1

Re: [R] Writing to a file

2012-02-06 Thread Petr PIKAL
Hi Honestly thank you for the prompt responding and you are right I will tellyou what I want to do and not the way ..since I dont know much from R I have a txt with Proteins Prot_10035 Func_0005874 Func_0016787 Func_0003774 Func_0006898 Func_0005856 Func_0005525

Re: [R] replace some values of a column with diffrent values

2012-02-05 Thread Petr PIKAL
Hi For such tasks I would use merge merge(u, v, by.x=name, by.y = enter, all.x=TRUE) If you do not want coe column anymore you can easily get rid of it. Regards Petr Hi Valerie One way would be to use the match function. # Your Data u =data.frame(coe=c(0,0,0,0,0,0,0,0),

Re: [R] i want to retrieve count for each freq of given summary from table()

2012-02-05 Thread Petr PIKAL
Hi Can you be more specific? What else do you want? x-table(sample(letters[1:5], 100, replace=TRUE)) x a b c d e 20 14 23 23 20 as.numeric(x) [1] 20 14 23 23 20 y-as.numeric(x) Regards Petr i want to retrieve count for each freq of given summary from table() e.g. A cout,B count

Re: [R] replicate rows

2012-02-03 Thread Petr PIKAL
Hi Hello, I have a matrix of 17 rows and 20 columns. I want to replicate this matrix 20 times, but I only want to replicate the rows. How do I do that? Replicate index. x-matrix(1:4, 2,2) x[rep(1:2, 20),] Regards Petr Kind regards / Met vriendelijke groet / Med venlig hilsen, Dr.

Re: [R] iterating through for loop

2012-02-03 Thread Petr PIKAL
Hi [R] iterating through for loop how to iterate two elements each through for loop? e.g. x-c(1,2,4,7,34,6) y-c(3,5,6,9,34,7) for(z in x){ print(paste(z,y)) } i want both element of vector iterate serially with same position Not sure what the result shall be. but paste(x,y) and

Re: [R] While loop working with TRUE/FALSE?

2012-02-02 Thread Petr PIKAL
Hi Thanks to Berend and the others, I've found a solution which works fine for my problem. I have not only 2 vectors, but also 4. Question is, if q1 and q2 is equal to w1 and w2. The computational time is very short, also for large data. q1 - c(9,5,1,5) q2 - c(9,2,1,5) w1 -

[R] Odp: Modifying whiskers in boxplots?

2012-01-30 Thread Petr PIKAL
Hi Hello, I know this has been covered on here before, but as a complete novice, I need a little more guidance. I would like to produce boxplots with the whiskers extending to the 10 and 90th percentiles. I found this code: myboxplot.stats - function (x, coef = NULL, do.conf = TRUE,

Re: [R] multiple column comparison

2012-01-30 Thread Petr PIKAL
Hi I did not see any response and actually I can not offer any ready made solution too. For such problems there could be various solutions from cycles to *apply, reshape or plyr options. However for anybody to start with it would be nice to get rather more clear description together with

Re: [R] warning massage longer object length is not a multiple of shorter object length

2012-01-24 Thread Petr PIKAL
Hi Dear All, I have data set which includes details of locations e.g latitude, longitude , time. I would like to compare two different data sets ( sampling in space and time). the e.g data sets are as follows t_lat [1] -90.00 -86.17 -82.34 -78.51 -74.68 -70.85 -67.02 -63.19

Re: [R] What package is used for the following graph?

2012-01-24 Thread Petr PIKAL
odstraněna uživatelem Petr PIKAL/CTCAP] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained

Re: [R] Error in data.frame(...., check.names = FALSE)

2012-01-23 Thread Petr PIKAL
Hi Error in data.frame(, check.names = FALSE) Hi Petr, I have added for loop for previous code. Some error is coming as “error in data.frame(, check.names = FALSE): arguments has different counts of rows: 0, 18” for the following code. Can you please help? Probably

Re: [R] conversion of string

2012-01-23 Thread Petr PIKAL
Hi I new in R programming language. I have some time data time [1] 2005-01-03 05:11:39 UTC 2005-01-03 06:36:02 UTC 2005-01-03 06:36:55 UTC [4] 2005-01-03 06:37:00 UTC 2005-01-03 06:38:04 UTC 2005-01-03 06:38:04 UTC [7] 2005-01-03 06:38:04 UTC 2005-01-03 06:38:04 UTC 2005-01-03

Re: [R] show plot

2012-01-20 Thread Petr PIKAL
Huh If you spend only 10 seconds inspecting one plot you will need about 150 hours for that task. I would recommend to reconsider this issue for your own sanity. Anyway you can save them either to separate files or in multi page PDF document although I do not know if there is some limit in

[R] Odp: Legend appearance

2012-01-20 Thread Petr PIKAL
Hi You shall at least read what others wrote you about your code. here is a quote from what I wrote you yesterday and what stays valid for today too. Also be aware that all levels of a factor are preserved in a subset unless you specifically strip the unused levels. Therefore there is a

Re: [R] show plot

2012-01-20 Thread Petr PIKAL
, and forced to true if file is a pipe. Regards Petr Best regards, Khodakarim On Fri, Jan 20, 2012 at 11:57 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Huh If you spend only 10 seconds inspecting one plot you will need about 150 hours for that task. I would recommend to reconsider this issue

Re: [R] test if text is part of vector

2012-01-20 Thread Petr PIKAL
Hi Hello, this is a very simple question: How can I find out if a word is part of a list of words like: a - word1 b - word4 vector - c(word1,word2,word3) I tried it with match(a,vector) but this gives the position of the word. Perhaps a %in% vector Regards Petr I am not

Re: [R] show plot

2012-01-20 Thread Petr PIKAL
on a single page. (Note that with 50k plots you'll want layout() and multiple pages.) Michael On Jan 20, 2012, at 6:46 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Thank you very much, but in *.pdf I can see 1 plot, may I‌ ask you another question? How can see more than one

Re: [R] Legend problem in line charts

2012-01-19 Thread Petr PIKAL
Hi Hi all, Small problem in generating the line charts. Question: Legend for the first graph is coming wrong., for second graph correctly. Please fix the legend postion at the down of graph. Plesae give me the solution. Thank you Devarayalu Orange1 - structure(list(REFID

Re: [R] formula in function as text?

2012-01-17 Thread Petr PIKAL
Hi Hello all, It might be a simple question, but I cannot find the solution, as I do not know which subjects I should search on. So, much thanks for he/she we can help me. I am creating a function and would like to place a formula in the function, without it being executed

Re: [R] question: how to select a column from a dataframe in a function

2012-01-17 Thread Petr PIKAL
Hi Hi, I am creating a function and ran into the problem of selecting a column from a dataset. It seems as though the $ function (as in data$columnname) does not apply in the function. In simplified version: This works: testf2-function(data,columnnumber){print(data[,columnnumber])}

[R] Odp: Separate ablines in lattice panels

2012-01-17 Thread Petr PIKAL
Hi addLine- function(a=NULL, b=NULL, v = NULL, h = NULL, ..., once=F) { tcL - trellis.currentLayout() k-0 for(i in 1:nrow(tcL)) for(j in 1:ncol(tcL)) if (tcL[i,j] 0) { k-k+1 trellis.focus(panel, j, i, highlight = FALSE) if (once) panel.abline(a=a[k], b=b[k], v=v[k], h=h[k], ...)

Re: [R] Extracting rows with latest date from a data frame

2012-01-17 Thread Petr PIKAL
Hi Hi, I have a list of unique patient IDs which I want to run against a dataframe of unique patient IDs with dates. There are multiple date instances against unique IDs. The end result I wish is that I have a list of IDs (which are unique) with the latest date. I have begun with using

Re: [R] loops over regression models

2012-01-13 Thread Petr PIKAL
Hi Dear R help listers, I am trying to replicate results in Gelman and Hill's book (Chapter 3 in regressions and multilevel models). Below I estimated two models (chp3.1 and chp3.3 in R codes) with the same data and dependent variable but different independent variables. I have been using

Re: [R] Help needed in interpreting linear models

2012-01-13 Thread Petr PIKAL
Hi It seems to me quite like a homework for which the policy of this list is not to respond. But far from being an expert in statistics I only express my opinion. It seems to me that your height variable behaves like a two level factor and the 190 value points to rather suspicious value in

[R] Odp: Remove space from string

2012-01-13 Thread Petr PIKAL
Hi Dear R users, I have some trivial query. I have a string, I want to remove space from the string. For eg. Input: a - Remove space Output required: Removespace It seems to be simple. Even myself with very poor knowledge of regexpr can suggest solution. gsub( , , a)

Re: [R] colored outliers

2012-01-13 Thread Petr PIKAL
Hi what do you want to achieve? Hi Justin, it still does not work. All points become red. I use this skript with your modifications: TOC_NI-read.csv2(C:/Users/hilliges/Desktop/Master/Daten/Statistik/TOC-NI.csv, sep=;, dec=,, encoding=UTF-8)

Re: [R] Help needed in interpreting linear models

2012-01-13 Thread Petr PIKAL
I forgot to post it to r help. Petr Hi Hi Petr, thanks for your answer. First of all it's not homework I am a student and need to analyse cancer data using linear models. I looked into that topic since a week now and still struggling in interpreting some of the R output that is why

[R] Odp: Generating unque patient IDs

2012-01-11 Thread Petr PIKAL
Hi Dear group, I am trying to prepare a NONMEM friendly dataset for population PK analysis. My patient IDs are 10 digit long and NONMEM is losing precison and rouding the last couple of digits. I need to generate unique Patient IDs fromt he current 10-digit IDs. Ihave total 250

Re: [R] as.numeric() generates NAs inside an apply call, but fine outside of it

2012-01-09 Thread Petr PIKAL
Hi Hello- I have rather a messy SPSS file which I have imported to R, I've dput'd some of the columns at the end of this message. I wish to get rid of all the labels and have numeric values using as.numeric. The funny thing is it works like this: as.numeric(mydata[,2]) # generates

[R] Odp: R not recognizing words

2012-01-06 Thread Petr PIKAL
Hi Hello all I'm new to R and am experiencing a problem with a categorical variable. All the data of this variable are Low, High, or NA. When I put summary(x$y), it gives me the number of High, Low, and NA entries. However, when I try to subset by writing x$y==Low or x$y==High, R

Re: [R] question about rev

2012-01-06 Thread Petr PIKAL
Hi [R] question about rev Hi,all: I have a vector,and wanna get the opposite value via rev function. a [1] FALSE FALSE TRUE TRUE TRUE rev(a) [1] TRUE TRUE TRUE FALSE FALSE I don't know why the 3rd TRUE has not been reversed,while all other values are reversed?

Re: [R] Adding a vertical line to plot with two overlapping density plots

2012-01-04 Thread Petr PIKAL
Hi Hi, A simple question I hope. I wish to add a single vertical line to a plot with several density plots. Here is a simplified example. thedata - data.frame(x1=rnorm(100,1,1),x2=rnorm(100,3,1)) #create data thedata.m-melt(thedata) densityplot(~value, thedata.m,

<    1   2   3   4   5   6   7   8   9   10   >