[R] Odp: transformation of data.frame

2010-07-08 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 08.07.2010 10:45:04: Hello all R users, I have a problems transforming (or maybe better regrouping) a data.frame. I have a big data.frame, which I would like to sum up according to a specific column. This is an example of my matrix: ID

Re: [R] Adding two files into one and vlookup

2010-07-08 Thread Petr PIKAL
Hi see ?merge Regards Petr r-help-boun...@r-project.org napsal dne 07.07.2010 17:07:34: Say I have two files file and file2: file1 contains the following: Date Price 02/07/2010 53.96597903 03/07/2010 56.92825807 04/07/2010 39.27408645 05/07/2010

Re: [R] mimic SPSS contingency table results

2010-07-08 Thread Petr PIKAL
(number of true positive,number positive Tests) This works for all other proportions as well, eg sensitivity=P(T+|D+) : p-15/24 #sensitivity p+qnorm(.975)*c(-1,1)*sqrt(p*(1-p)/24) binom.test(15,24) hth. Am 08.07.2010 10:59, schrieb Petr PIKAL: Dear all Seems that puzzles always come

Re: [R] transformation of data.frame

2010-07-08 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 08.07.2010 12:02:45: I don't understand it. When I'm doing this example it wirks fine, but when I'm adding the GO: to the beginning of the first column (as to see in my wanted result table: GO0042787 GO0016070 GO0016070 I'm getting a list of

[R] Odp: identifying odd or even number

2010-07-07 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 01.07.2010 17:40:22: Hi, I run into problem when writing a syntax, I don't know syntax that will return true or false if an integer is odd or even. fff - function(x) as.logical(x%%2) Regards Petr Thanks OYEYEMI, Gafar Matanmi Department

[R] relation in aggregated data

2010-07-07 Thread Petr PIKAL
Dear all My question is more on statistics than on R, however it can be demonstrated by R. It is about pros and cons trying to find a relationship by aggregated data. I can have two variables which can be related and I measure them regularly during some time (let say a year) but I can not

[R] Odp: Problem with aggregating data across time points

2010-07-02 Thread Petr PIKAL
Hi did you try aggregate? aggregate(data[, 5:8],list(data$Date), sum, na.rm=T) Group.1 verbal self.harm violence_objects violence 1 0 000 2 01/04/07 251539 3 02/04/07 24 68 13

Re: [R] fatal error: unable to restore saved data

2010-06-28 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 26.06.2010 00:11:33: Albert - The message refers to a file specifically called .RData. Files with subscripts of .rdata are not related. You can see your current working directory by typing getwd() at the R prompt. I'm not sure

[R] Odp: how to change the format of numeric variable

2010-06-24 Thread Petr PIKAL
Hi see ?options and scipen parameter e.g. options(scipen=9) Regards Petr r-help-boun...@r-project.org napsal dne 24.06.2010 08:39:29: Hi, The format problem is really annoying. How to get rid of it? x [1] 1e+06 And also when I do barplot, x=rnorm(100,mean=1000)

[R] Odp: Correctly plotting bar and scatter chart on 2-y axis plot with par(new=T)

2010-06-24 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 24.06.2010 09:44:49: Hello Nabble users, A question about having two y axes on a chart. I'm trying to show on the left (first) y axis a measure used in an experiment; the x axis shows the experiment number, that has been sorted in a specific

Re: [R] boxplot width

2010-06-24 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 24.06.2010 15:18:39: it works with the 'TRUE' as well but this only shows me the boxplots width; it doesn't show me the number of data points used though.. This is what I can't figure out Save your boxplot call to same object bbb -

[R] Odp: applying ifelse to dataframe

2010-06-22 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 22.06.2010 08:28:04: The following dataframe will illustrate the problem DF-data.frame(name=rep(1:5,each=2),x1=rep(A,10),x2=seq(10,19,by=1),x3=rep (NA,10),x4=seq(20,29,by=1)) DF$x3[5]-50 # we have a data frame. we are interested in the

Re: [R] applying ifelse to dataframe

2010-06-22 Thread Petr PIKAL
on a data frame with all numeric variables On Tue, Jun 22, 2010 at 12:23 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi r-help-boun...@r-project.org napsal dne 22.06.2010 08:28:04: The following dataframe will illustrate the problem DF-data.frame(name=rep(1:5,each=2),x1=rep(A,10),x2

Re: [R] How to add a new plot in the same graph using add=T at the command plot?

2010-06-21 Thread Petr PIKAL
this [obrázek odebrán] 2010/6/9 Petr PIKAL petr.pi...@precheza.cz Hi where did you find parameter add=T. You can use par(new=T) before using new plot command or use points, lines Regards Petr r-help-boun...@r-project.org napsal dne 09.06.2010 16:42:25: I forgot to show my

Re: [R] Reading data from xls..........please help

2010-06-18 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 16.06.2010 22:14:33: Thanks for your reply. Possibly I donot have perl. I am not sure although. How I can find whether I have it? If I dont have it then where can I download it from? Do you have Excel? If yes you can Open Excel Select data you

Re: [R] Reading data from xls..........please help

2010-06-18 Thread Petr PIKAL
character and you need to do some fiddling to turn it back to numerics. Regards Petr Petr PIKAL petr.pi...@precheza.cz 2010/06/18 01:42 PM Hi r-help-boun...@r-project.org napsal dne 16.06.2010 22:14:33: Thanks for your reply. Possibly I donot have perl. I am not sure although

[R] Odp: Matrix to Vector

2010-06-16 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 15.06.2010 19:51:39: Hi All, I am trying to turn a Matrix into a vector for analysis purposes. I need to select only certain columns from the entire matrix for the vector (intraday time intervals). Also I need to transpose the Matrix (so times

Re: [R] multiple plots without for loops

2010-06-16 Thread Petr PIKAL
Hi I use an option with PDF, which can have multi page output. You can pdf(some_graphs.pdf) # do all your plotting let say in cycle something like for( i in 1:n) plot(something[,1], something[,i+1], ...) dev.off() You will get one multipage pdf document in working directory which you can

[R] Odp: random colour

2010-06-14 Thread Petr PIKAL
Hi Would you like to know which colour is for which curve? If yes use parameter col=1:5 in your plotting call. If not you can try col = sample(colours(), 5) instead Regards Petr r-help-boun...@r-project.org napsal dne 14.06.2010 07:05:43: Sir, I want to plot 5 curve on a single graph. I

[R] Odp: How to convert data frame row to vector?

2010-06-14 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 14.06.2010 11:05:39: Hi, I have a data frame that looks like this: ID Var Var2 Var3 xxx 100 909 920 yyy 110 720 710 zzz 140 680 690 I can load the file and produce a plot

Re: [R] points marking

2010-06-11 Thread Petr PIKAL
Hi I am not sure if you can do what you want. Segments are not points so your pch option is (I believe) ignored. You could play with lmitre and lend parameters, but it probably would not help much. You cold try to look at ?symbols but you probably need to change source code to suit your

[R] Odp: r code to broaden the boarder of the bars of a histogram

2010-06-11 Thread Petr PIKAL
Hi Look at the source code. graphics:::plot.histogram You can find that boxes are actually drawn by rect So if you want to use standard graphics, you probably need to modify source code and set up your version of plot.histogram. Maybe with ggplot2 package you can find some way how to do what

Re: [R] How to add a new plot in the same graph using add=T at the command plot?

2010-06-10 Thread Petr PIKAL
Hi Peter Ehlers ehl...@ucalgary.ca napsal dne 09.06.2010 19:05:24: Soapbox: Well, if you're just starting out with R it would be a VERY good idea to learn right away that T is not TRUE and F is not FALSE, at least not always. Sooner or later you WILL have problems. So do yourself a favour

[R] Odp: question about mean

2010-06-10 Thread Petr PIKAL
Hi split/sapply can be used besides other options sapply(split(iris[,1:4], iris$Species), mean) Regards Petr r-help-boun...@r-project.org napsal dne 10.06.2010 00:43:29: Hi there: I have a question about generating mean value of a data.frame. Take iris data for example, if I have a

[R] Odp: cbind with vectors of different lengths?

2010-06-10 Thread Petr PIKAL
Hi you shall use na.action = na.exclude option in your lm call? Regards Petr r-help-boun...@r-project.org napsal dne 10.06.2010 01:12:55: Hello R help I have a dataframe, with 71 samples (rows) and 30 variables. I got linear models for some of the variables, and I want to join fitted

Re: [R] How to add a new plot in the same graph using add=T at the command plot?

2010-06-10 Thread Petr PIKAL
Hi Uwe Ligges lig...@statistik.tu-dortmund.de napsal dne 10.06.2010 10:37:05: On 10.06.2010 10:19, Petr PIKAL wrote: Hi Peter Ehlersehl...@ucalgary.ca napsal dne 09.06.2010 19:05:24: Soapbox: Well, if you're just starting out with R it would be a VERY good idea to learn

[R] Odp: adding column of ordered numbers to matrix

2010-06-10 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 10.06.2010 15:56:06: Hello everyone, I have a matrix of over 4 line and about 30 columns. Matrix or data.frame? For my analysis I would like to add another column with ascending numbers (column header should be order, and than 1,2,3,4

[R] Odp: Extracting Elements By Date

2010-06-09 Thread Petr PIKAL
Hi You have got several suggestions. When I try your code I get only errors, not list or any other objects. x-unique(Returns.names$date_) Error in unique(Returns.names$date_) : object 'Returns.names' not found n-1 while(n=19) { + Returns.period-lapply(((n-1)*125+1):((n+1)*125), function

Re: [R] Read in dataset without saving it

2010-06-09 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 09.06.2010 12:44:33: See ?textConnection, eg test -1 2.5 3.4 1 2.3 3.1 1 2.6 3.9 2 2.9 2.8 2 2.6 2.9 2 2.7 2.9 3 2.3 3.3 3 2.4 3.0 3 2.7 3.2 x - textConnection(test) read.table(x) close(x) On Wed, Jun 9, 2010 at 10:38 AM, Paul Chatfield

[R] Odp: strange issue with which on seq

2010-06-09 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 09.06.2010 13:16:40: Dear R community, I am puzzled by the following lines: v - seq(-0.5,0.5,by=0.1) v [1] -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5 which(v == -0.4) [1] 2 which(v == 0) [1] 6 which(v == 0.1)

[R] Odp: Help needed on switch function

2010-06-09 Thread Petr PIKAL
Hi if you do not insist on switch you can use factor to get desired result set.seed(666) x-sample(1:5,20, replace=T) x [1] 4 1 5 2 2 4 5 3 1 2 4 1 1 1 2 5 1 5 3 3 factor(x, labels=letters[1:5]) [1] d a e b b d e c a b d a a a b e a e c c Levels: a b c d e r-help-boun...@r-project.org napsal

Re: [R] Odp: strange issue with which on seq

2010-06-09 Thread Petr PIKAL
$double.eps) seems to me too cumbersome to write. Any other easier way? all.equal does not quite work Nikhil On Jun 9, 2010, at 7:54 AM, Petr PIKAL wrote: Hi r-help-boun...@r-project.org napsal dne 09.06.2010 13:16:40: Dear R community, I am puzzled by the following lines

[R] Odp: changing the number of elements in a list

2010-06-09 Thread Petr PIKAL
Hi one option is to create an empty list with my.list - vector(list, n) where n is number of elements in list. Then you can populate each element by my.list[[x]] - something where x can be number or my.list[x] -something where x is numeric vector Regards Petr

Re: [R] How to add a new plot in the same graph using add=T at the command plot?

2010-06-09 Thread Petr PIKAL
Hi where did you find parameter add=T. You can use par(new=T) before using new plot command or use points, lines Regards Petr r-help-boun...@r-project.org napsal dne 09.06.2010 16:42:25: I forgot to show my code... it is like this jpeg() plot(x,y,main=str, xlab=str,ylab=str,

[R] Odp: duplicated() and unique() problems

2010-06-08 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 08.06.2010 08:44:39: Hi everybody I have found something (for me at least) strange with duplicated(). I will first provide a replicable example of a certain kind of behaviour that I find odd and then give a sample of unexpected results from my

Re: [R] problem with if else statement

2010-06-08 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 08.06.2010 11:46:17: Hi, You are using if/then/else which is a logical control statement and so doesn't return a value, see ?if for details. You are probably looking for the ifelse function. Or use possibility of easy conversion logical

Re: [R] Adding in Missing Data

2010-06-08 Thread Petr PIKAL
Hi Hm, maybe you can first make a sequence of all required dates and ids, construct empty data frame with all possible dates, merge your existing data frame with empty one just to fill in all dates, get rid of duplicated dates and ids if necessary and finally use na.locf from zoo library to

[R] Odp: partial solutions to: if else statement problem

2010-06-08 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 08.06.2010 14:21:10: Thank you to all for your help! I received two equal alternative solutions that bypassed elegantly the problem from peter.l.e.koni...@gmail.com and rafael.bj...@gmail.com rr.dia2.corr - rr.dia.2m

[R] Odp: Subsetting subsets of data.frames

2010-06-07 Thread Petr PIKAL
Hi some example would be helpful. r-help-boun...@r-project.org napsal dne 07.06.2010 09:01:27: Hey Everyone, I have been stumped by this all day. Basically, I have a data.frame of multiple columns. Of concern are id date For some reason, oftentimes there are duplicates of data

[R] Odp: fit data with y = x^-1

2010-06-07 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 07.06.2010 14:28:58: Dear list, I am getting weired with fitting data with a 1/x-polynomial. Suggest I have the following data: x - c(1,2,3,4,5,6,7) y - c(100,20,4,2,1,.3,.1) I may fit this with a linear model fit1 = lm(y ~ I(x)) fit1 =

Re: [R] For Loop help needed

2010-06-04 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 03.06.2010 18:18:33: One option: t - data.frame(x1=c(1,1,0,0,0,1), x2=c(0,0,0,1,0,1), Count=c(523,23,2,45,3,433)) t.sum - function(df, x1, x2) sum(df[df$x1==x1 df$x2==x2,]$Count) t.sum(t, 1, 0) # [1] 546 t.sum(t, 0, 0) # [1] 5 If this is

[R] regexpr mystery can not remove trailing spaces

2010-06-02 Thread Petr PIKAL
Dear all I encountered strange problem with regexpr replacement I made this character object str - 02.06.10 12:40 str(str) chr 02.06.10 12:40 I read in an object which seems to be quite similar str(as.character(becva$V1)[1]) chr 02.06.10 12:40 However I can not remove

Re: [R] regexpr mystery can not remove trailing spaces

2010-06-02 Thread Petr PIKAL
Meys jorism...@gmail.com napsal dne 02.06.2010 14:35:19: Could you provide us with dput(becva$V1[1])? Cheers Joris On Wed, Jun 2, 2010 at 2:07 PM, Petr PIKAL petr.pi...@precheza.cz wrote: Dear all I encountered strange problem with regexpr replacement I made this character object str

[R] Odp: charactor matrix convert to numeric matrix

2010-06-02 Thread Petr PIKAL
Hi you have several options apply(a, 2, as.numeric) matrix(as.numeric(a),3,2) b-as.numeric(a) dim(b)-c(3,2) Regards Petr r-help-boun...@r-project.org napsal dne 02.06.2010 14:15:25: Hello R experts, can you tell me a simple way to convert a charactor matrix to numeric matrix? if I use

Re: [R] regexpr mystery can not remove trailing spaces

2010-06-02 Thread Petr PIKAL
at 9:22 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi dput(bbb) c(02.06.10 12:40 , 02.06.10 12:00 , 02.06.10 11:00 , 02.06.10 10:00 , 02.06.10 09:00 , 02.06.10 08:00 , 02.06.10 07:00 , 02.06.10 06:00 , 02.06.10 05:00 , 02.06.10 04:00 , 02.06.10 03:00 , 02.06.10 02

Re: [R] regexpr mystery can not remove trailing spaces

2010-06-02 Thread Petr PIKAL
or even newline characters. You can check that easily with grep(\t, as.character(becva$V1[1])) grep(\n, as.character(becva$V1[1])) Cheers Joris On Wed, Jun 2, 2010 at 3:54 PM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi thanks. I am puzzled what was wrong. Now even sub

Re: [R] accessing a data frame with row names

2010-06-01 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 01.06.2010 10:20:35: On 31/05/2010, Gabor Grothendieck ggrothendi...@gmail.com wrote: Use read.csv or read.table(..., sep = ,). Also note that if you delete the first comma of the header (as in the second example below) you won't have to specify

[R] Odp: Help barplots

2010-06-01 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 01.06.2010 13:01:38: Dear All, I am newbie to R, and I wanted to plot a barplots with R and in such a way that It will also show me position which I can plot on the bar line. Here is my code that I am using to plot, chromosome - c(40.2,

[R] Odp: splitting character strings and converting to numeric vectors

2010-05-06 Thread Petr PIKAL
Hi Probably not the best way read.table(clipboard, header=T) head.as.character.XY.. 1 -448623_854854 2 -448563_854850 3 -448442_854842 4 -448301_854833 5 -448060_854818 6 -446828_854736 test=read.table(clipboard, header=T) now do the split

[R] Odp: better way to trick data frame structure?

2010-05-05 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 05.05.2010 07:49:25: Hi, I have a data frame where 1 variable is a factor with only 1 level. I need the data frame structure to reflect that there are 2 levels for this factor, even though this is not the case. I am currently adding extra

[R] Odp: concatenate values of two columns

2010-05-05 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 05.05.2010 11:46:33: Dear list, I'm trying to concatenate the values of two columns but im not able to do it: i have a dataframe with the following two columns: X VAR1 VAR2 1 2 2

[R] Odp: strange error msg from lapply and lm()

2010-05-04 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 03.05.2010 16:24:11: I am conducting a very simple t test for two genes using lapply (i try to avoid loop since i will have thousands of genes later on). however, I got strange error msg like the followings. It looks that R is complaining my

Re: [R] / Operator not meaningful for factors

2010-05-04 Thread Petr PIKAL
) x.f [1] -1.15502538070463 -0.457842907389024 -0.608900689299125 -1.73785992416606 [5] 0.129785271221269 5 Levels: -1.73785992416606 -1.15502538070463 ... 0.129785271221269 as.numeric(x.f) [1] 2 4 3 1 5 Regards Petr Petr PIKAL petr.pi...@precheza.cz 2010/05/04 09:38 AM Hi r-help

Re: [R] / Operator not meaningful for factors

2010-05-04 Thread Petr PIKAL
-1.2319878 -1.8689400 -1.2931785 Petr PIKAL petr.pi...@precheza.cz 2010/05/04 10:12 AM x-rnorm(5) x [1] -1.1550254 -0.4578429 -0.6089007 -1.7378599 0.1297853 x.f-factor(x) x.f [1] -1.15502538070463 -0.457842907389024 -0.608900689299125 -1.73785992416606 [5

[R] Odp: Extract rows with non-zero elements

2010-05-04 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 04.05.2010 09:50:28: Dear all, In my dataset I have 12 columns and 5824 rows. The second column contains information about the height of a claim: it might be zero or positive. I would like to do an analysis on the positive part of this matrix,

[R] Odp: How to replace all NA values in a data.frame with another ( not 0) value

2010-05-04 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 04.05.2010 14:54:14: I need to replace NA occurrences in multiple columns in a data.frame with 000/000 Be careful if you replace NA in numeric columns. str(test) 'data.frame': 10 obs. of 3 variables: $ mp: num 20.9 19.9 20.1 20.2 18.9 ...

[R] Odp: What is the best way to have R output tables in an MS Word format?

2010-05-03 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 01.05.2010 00:13:06: Dear R list, Our statisticians usually give us results back in a PDF format. I would like to be able to copy and past tables from R output directly into a Microsoft Word table since this will save us tons of time, be more

Re: [R] apply question

2010-05-03 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 30.04.2010 23:11:54: Hello David, On Apr 30, 2010, at 11:00 PM, David Winsemius wrote: Note: Loops may be just as fast or faster than apply calls. How come!? is this true also for other similar functions: lapply, tapply and sapply? Then

[R] Odp: by funtion

2010-04-29 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 29.04.2010 05:56:23: Hello, I have a data.frame: namecol1col2col3col4 AA23540.9990.78 BB123510.99 AA203980.790.99 I want to get mean value data.frame in terms of name: name

Re: [R] non linear estimation

2010-04-29 Thread Petr PIKAL
Hi I put a search question about nonlinear programming in R site search and got many answers maybe you could find something which suits your needs. Maybe you could also look at CRAN task view - Optimisation and Mathematical programming Regards Petr r-help-boun...@r-project.org napsal dne

Re: [R] by funtion

2010-04-29 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 29.04.2010 08:11:41: Hi you could try do.call('rbind',aa) No, No, No. rbind and cbind binds vectors as rows or columns of ***matrix***, result is not a data frame do.call(rbind,aa) X069rutil X102anatas 105 26.97.9 200

Re: [R] by funtion

2010-04-29 Thread Petr PIKAL
',aa) df=data.frame(dd) df c1 c2 c3c4 AA 113 76 0.8945 0.885 BB 123 5 1. 0.990 Regards Tengfei On Thu, Apr 29, 2010 at 1:30 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi r-help-boun...@r-project.org napsal dne 29.04.2010 08:11:41: Hi you could try

Re: [R] by funtion

2010-04-29 Thread Petr PIKAL
. this is name c1 c2 c3c4 c5 c6 AA 23 54 0.999 0.78 87 6 BB123 5 1.000 0.99 98 7 could give advice? --- On Thu, 29/4/10, Tengfei Yin yinteng...@gmail.com wrote: From: Tengfei Yin yinteng...@gmail.com Subject: Re: [R] by funtion To: Petr PIKAL

[R] Odp: convert Factor as numeric

2010-04-29 Thread Petr PIKAL
Hi You have to get rid of thousands separator firsr as.numeric(gsub(,, , S)) Regards Petr r-help-boun...@r-project.org napsal dne 29.04.2010 13:12:44: Dear group, I know this issue has been already covered, and before you reply I must say I have read the R-FAQ and search the mailing

Re: [R] Tapply.

2010-04-28 Thread Petr PIKAL
, Apr 27, 2010 at 2:40 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi r-help-boun...@r-project.org napsal dne 26.04.2010 17:05:54: I guess my problem was seeing a bunch of examples where they pulled a variable from a dataframe.. tapply(df$data, index=list(.. df$data results in vector

[R] Odp: plot with personalized axes

2010-04-28 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 28.04.2010 12:06:04: Hello all, I want to plot some probability points (in scale 0-1), but the large majority have extremely low probabilities. Imagine I have the following vector a-c(0.0001,0.004,0.01,0.4) plot(a) When you plot it,

Re: [R] Tapply.

2010-04-27 Thread Petr PIKAL
problematic. see str(df$data) str(df[, 1]) str(df[,1, drop=FALSE]) str(df[,1:15]) Regards Petr Thanks. On Mon, Apr 26, 2010 at 2:43 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi steven mosher mosherste...@gmail.com napsal dne 26.04.2010 10:21:37: That fails: The manual

[R] Odp: Problem calculating multiple regressions on a data frame.

2010-04-27 Thread Petr PIKAL
Hi what about fit - lm(value~seqMonth+ids+varable, data=theTestLineal) or similar approach using ?lme See also ?interaction Regards Petr r-help-boun...@r-project.org napsal dne 27.04.2010 13:48:32: Hi there, I am stuck trying to solve what should be a fairly easy problem. I have a data

Re: [R] Tapply.

2010-04-27 Thread Petr PIKAL
of which were mentioned earlier by Petr Pikal. HTH, Dennis On Mon, Apr 26, 2010 at 8:01 AM, steven mosher mosherste...@gmail.comwrote: Thanks, I was trying to stick with the base package and figure out how the base routines worked. I looked at plyer and it was very appealing

[R] Odp: Tapply.

2010-04-26 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 26.04.2010 06:52:55: Having some difficulties with understanding how tapply works and getting return values I expect Data: dataframe. DF DF$Id $D $Year... Id D Year Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov

Re: [R] Tapply.

2010-04-26 Thread Petr PIKAL
for aggregate is quite similar to tapply, only first argument can be data frame. Regards Petr The length of DF is 2. Does that mean the list of factors, each of same length as X. would have to be 2? that doesnt seem to make sense. On Mon, Apr 26, 2010 at 12:26 AM, Petr PIKAL petr.pi

[R] Odp: Remove duplicated rows

2010-04-23 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 23.04.2010 04:05:00: Hi all, I have a dataset similar to the following Name Date Value A 1/01/2000 4 A 2/01/2000 4 A 3/01/2000 5 A 4/01/2000 4 A 5/01/2000 1 B 6/01/2000 2 B 7/01/2000 1 B 8/01/2000 1

[R] Odp: Basic doubt on ylim

2010-04-21 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 20.04.2010 21:21:26: Hi all, I'm a newbie with R and with a very basic question. Can I define the minor unit for ylim? For example, I have a y scale ranging from 1 to 14, jumping automatically every 2 units, but I want it to jump 1 unit at a

Re: [R] how to draw multiple vertical bands

2010-04-20 Thread Petr PIKAL
Hi you can also use abline function x-rnorm(10) plot(1:10, x) abline(v=seq(2,10,2), lwd=50, col=lightblue) lines(1:10, x, type=b) Regards Petr r-help-boun...@r-project.org napsal dne 19.04.2010 20:59:15: On 04/15/2010 12:36 AM, senne wrote: hi R gurus I saw some graphs with

[R] Odp: multiple variables pointing to single dataframe?

2010-04-19 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 16.04.2010 16:15:40: Hi, I have a need to have 2 variables point to the same dataframe (d1), I What does it mean to point to data frame? Seems to me that it is something from C+. You can reference data frame by $ or by square brackets with as

[R] Odp: dataframe

2010-04-19 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 19.04.2010 10:12:59: Hi all, I'm trying to load a csv file in which all the variables must be of type number.The object is a dataframe.When i load the file what i get is a dataframe You probably have non numeric data in your original CSV.

Re: [R] merge

2010-04-19 Thread Petr PIKAL
Hi If the columns has the same name but different values in them then you shall either decide which one to keep yourself or you shall keep both. If they have same name and same values you could select only those which names do not match. names(data1) %in% names(data2) can select which names

[R] Odp: merge

2010-04-16 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 16.04.2010 14:00:09: I have a problem with the merge command. I have to merge two dataframe that looks like the following example: CODPROD N1 N3 N4 23 3 55 4 24

Re: [R] Odp: fitting a quadratic function - poly?

2010-04-15 Thread Petr PIKAL
Hi Bert Gunter gunter.ber...@gene.com napsal dne 14.04.2010 18:54:37: Petr Pikal wrote: ... I mean that you can use fit- lm(y~x+I(x^2)) coef(fit)[1] + coef(fit)[2]*x + coef(fit)[3]*x^2 but you can not use fit- lm(y~poly(x,2)) coef(fit)[1] + coef(fit)[2]*x + coef(fit)[3]*x^2

Re: [R] Consistent behaviour of for-loop

2010-04-15 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 15.04.2010 13:00:57: Peter Ehlers wrote: You are mixing 'traditional' graphics (par(...)) and 'lattice' graphics. That won't work. In lattice, you use the 'layout' argument to select the number of columns/rows. This is easiest if you set up a

[R] Odp: fitting a quadratic function - poly?

2010-04-14 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 14.04.2010 17:12:51: Hi List, I can not get my head around the following problem. I want to fit a quadratic function to some data and stumbled across poly(). What exactly does it, i.e. why are there different results for fit1 and fit2? x =

Re: [R] Odp: fitting a quadratic function - poly?

2010-04-14 Thread Petr PIKAL
Hi Bert Gunter gunter.ber...@gene.com napsal dne 14.04.2010 18:01:52: Below. -- Bert Bert Gunter Genentech Nonclinical Statistics Coefficients are different as you fit different values. See ?poly poly(-10:10,2) I believe that others give you better explanation. So you

Re: [R] using double loops and saving the data

2010-04-12 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 12.04.2010 07:14:14: David Winsemius wrote: I am guessing that the first time through when i= 5200 that i+1 is indexing an entry that does not exist. What does str( Price[[1]] [5200+1] ) return? What about str(Ca)? So what is

Re: [R] using double loops and saving the data

2010-04-12 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 12.04.2010 12:51:24: Petr Pikal wrote: snip Nobody except you has your data available, so without providing more clues you can not expect mor relevant answers. Try str(your.objects) and maybe you could use debug to see how

[R] Odp: use read.table for a partial reading

2010-04-08 Thread Petr PIKAL
Hi what about some.data - read.table()[ ,1:2] Regards Petr r-help-boun...@r-project.org napsal dne 08.04.2010 16:05:39: Hi everyone, I've got a matrix data with 20 variables (V1, V2, V3, ...) and 215 rows (observations). I'm interested to read only the first and second variables

[R] Odp: Question on using elements of a vector

2010-04-08 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 08.04.2010 16:23:53: Hi So my particular problem is this: I have a row vector of length 5200 elements - specifically created by x-rbinom(5200,1,0.5) y-matrix(x,nrow=1,ncol=5200) y now, each element is either a 0 or a 1 - e.g. it

[R] Odp: Summing a series made up of part of a vector

2010-04-07 Thread Petr PIKAL
Hi ?cumsum Petr r-help-boun...@r-project.org napsal dne 07.04.2010 14:26:12: Dear colleagues, I have a data frame that looks so: *x1 x4 1 4.2 2 3.6 3 2.7 . . 308 n.a. x4 is a vector of percentages, sorted in descending value. I would like to create a new variable that

[R] Odp: Using a string as a variable name - revisited

2010-04-02 Thread Petr PIKAL
Hi Without some insight about foo, list or counts it is impossible to say what is wrong. mat-matrix(1:12, 3,4) colnames(mat)-letters[1:4] DF-as.data.frame(mat) fac-factor(names(DF)) fac [1] a b c d Levels: a b c d ff-fac[3] ff [1] c Levels: a b c d DF[[ff]] [1] 7 8 9 ff-fac[1] DF[[ff]]

[R] Odp: plot area: secondary y-axis does not display well

2010-04-02 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 02.04.2010 12:12:02: Dear useRs, I'm having a slight problem with plotting on 2 axes. While the following code works alright on screen, the saved output does not turn out as desired i.e. the secondary y-axis does not display fully. Just run

Re: [R] Create a new variable

2010-03-31 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 30.03.2010 18:46:35: Hello, Thomas Jensen wrote: Dear R-list, Sorry for spamming the list lately, I am just learning the more advanced aspects of R! I have some data that looks like this: Out Country1 Country 2 Country 3 ...

[R] Odp: (no subject)

2010-03-31 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 31.03.2010 06:15:38: Hi r-users, I would like to display my legend with fill box and line symbol. The first color will be in the box and the second colour will just be a line. legend(topright, c(observed,gamma sum fit), col= c

Re: [R] a vectorized solution to some simple dataframe math?

2010-03-29 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 27.03.2010 11:53:30: Hi: Does this do what you want? # Create some fake data... df - data.frame(id = factor(rep(c('cell1', 'cell2'), each = 10)), cond = factor(rep(rep(c('A', 'B'), each = 5), 2)), time =

Re: [R] create space for a matrix

2010-03-29 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 29.03.2010 08:41:15: Hi Leo, see the matrix function e.g. m - matrix(0, nrow=1, ncol=3) then you can use functions like rbind or cbind to create bigger ones. I am a newbie so double check everything :) HTH, Best regards, Giovanni

[R] Odp: Need help on matrix manipulation

2010-03-29 Thread Petr PIKAL
Hi One option (probably not the best one) is index an aggregate matrix mat - rbind(mat1, mat2, mat3) idx - seq(1,12, 4)+rep(0:3, each=3) mat - mat[idx, ] Regards Petr r-help-boun...@r-project.org napsal dne 29.03.2010 09:44:12: Dear all, Ket say I have 3 matrices : mat1 -

[R] Odp: naming consecutive objects

2010-03-29 Thread Petr PIKAL
Hi It is really a nice example. You managed to break probably all rules specified in posting guide No reproducible example No structure of data No explain what you really want No effort on your side even to look to docs. You maybe want some object of type list. obj - vector(98, mode=list you

Re: [R] Legends for line and point data

2010-03-29 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 29.03.2010 16:13:31: Hi, Your question is really vague. What about legend(lty=, pch=)? Well, it is probably not mentioned explicitly in ?legend but he is probably seeking legend(..., lty=c(1,NA, 2,3), pch=c(NA, 16, NA,NA)) Regards Petr Ivan

Re: [R] Help with assigning a value based on existing numbers

2010-03-28 Thread Petr PIKAL
Message- From: Petr PIKAL [mailto:petr.pi...@precheza.cz] Sent: 26 March 2010 14:00 To: Jessica Cathro Cc: r-help@r-project.org Subject: Odp: [R] Help with assigning a value based on existing numbers Hi again a work for cut. See ?cut and notice a labels option. Regards Petr

[R] Odp: Creating a vector of categories

2010-03-26 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 26.03.2010 10:41:29: Hi, I have a column in a data frame looking something like: $sex $language $count male english 0 male english 0 female english 32 male spanish 154 female english 11 female norweigan 7 and so on. What I

[R] Odp: Help with assigning a value based on existing numbers

2010-03-26 Thread Petr PIKAL
Hi again a work for cut. See ?cut and notice a labels option. Regards Petr r-help-boun...@r-project.org napsal dne 26.03.2010 11:37:20: Hi All I have a column/variable called time difference. It has a whole list of numbers from 0 through to the hundreds eg 236. I want to assign a

Re: [R] Mosaic Plots

2010-03-25 Thread Petr PIKAL
Hi There is also mosaicplot in base graphics ?mosaicplot Petr r-help-boun...@r-project.org napsal dne 22.03.2010 14:16:58: Hi, maybe vcd package is what you are looking for. Example from vcd library library(vcd) ?mosaic data(Titanic) mosaic(Titanic) ## Formula interface for

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