Re: [R] OUTPUT the row

2010-03-20 Thread GlenB
a-read.table(stdin(),header=TRUE) 0: id kAgeHeight 1: 23 2 23 60 2: 12 3 28 58 3: 19 4 18 55 4: 37 5 22 54 5: with(a,k[Age==min(Age)]) [1] 4 -- View this message in context:

[R] Help with predict and confidence intervals

2010-03-20 Thread Hector Guilarte
Hi everyone, I'm trying to make a prediction on the following model for the values V1 = 18, V4 = 35, V6 = 7. modelo4 = lm(Y ~ V1 + V4 + V6, data = datos) and I want to plot the confidence bands for that prediction, I've found many examples for simple regression, but I haven't been able to find

[R] R code for normal mixture EM algorithm

2010-03-20 Thread tj
Please help me in writing the R code for this problem. I've been solving this for 4 days. It was hard for me to solve it. It's a simulation problem in R. The problem is My true model is a normal mixture which is given as 0.5 N(-0.8,1) + 0.5 N(0.8,1). This model has two components. I will

Re: [R] Merging Matrices

2010-03-20 Thread duncandonutz
To clarify, the two matrices might look like this: A B C D E F A 1 2 3 4 5 6 B 2 4 6 8 10 12 C 0 0 0 0 0 0 D 0 1 0 1 0 1 E 3 6 9 11 13 15 F 2 2 2 2 2 2 B D E B 4 9 13 D 9 8 7 E 1 0 1 I would like this: A B C D

[R] OUTPUT the row

2010-03-20 Thread tj
Hi... Please help me with this. In R, if I have this dataframe: id kAgeHeight 23 2 23 60 12 3 28 58 19 4 18 55 37 5 22 54 My question is, I want to get the value of k that has the minimum age. So in this dataframe, the

Re: [R] OUTPUT the row

2010-03-20 Thread tj
Thank you very much for the big help! From: GlenB [via R] ml-node+1655832-860423762-194...@n4.nabble.com Sent: Sat, March 20, 2010 1:23:50 AM Subject: Re: OUTPUT the row a-read.table(stdin(),header=TRUE) 0: id kAgeHeight 1: 23 2

Re: [R] Factor variables with GAM models

2010-03-20 Thread Corrado
You can some time manually substitute a categorical variable with a set of continuous variables. For example, you have the variables like landcover.class with 3 values class A, class B, class C. You cna transform it into 3 continuous variables landcover.class.A, landcover.class.B,

[R] grid lines aligned on each ticks with a log scale

2010-03-20 Thread Benoit Boulinguiez
Hi all, for publication purpose I must provide a graph with grid lines aligned with each tick mark. Thing is that the graph has a log scale on the x-axis. I looked at the grid() and par() documentation but still don't figure out how to get it done. simple example plot(seq(1,9), log=x,

Re: [R] grid lines aligned on each ticks with a log scale

2010-03-20 Thread Duncan Murdoch
On 20/03/2010 6:38 AM, Benoit Boulinguiez wrote: Hi all, for publication purpose I must provide a graph with grid lines aligned with each tick mark. Thing is that the graph has a log scale on the x-axis. I looked at the grid() and par() documentation but still don't figure out how to get it

[R] error in map library

2010-03-20 Thread Nilza BARROS
Dear Ruser, I am trying to use the map library. But unfortunately I am facing the warning message above: Warning message: *In readGDAL(destfile, silent = TRUE) : GeoTransform values not available * I want to use that library because I intend to plot some station in a Brazilian map.

Re: [R] Merging Matrices

2010-03-20 Thread Gabor Grothendieck
The original post said the matrices are symmetric but it seems from the examples that they are not symmetric but do each have the same row and column names so we have assumed only this latter condition instead. If your matrices are called big and small then: ix - rownames(big) %in%

Re: [R] Merging Matrices

2010-03-20 Thread Gabor Grothendieck
Actually both the solutions I listed assume that every row in small is in big. Although that was the case in the example you displayed, If that is not the case in general then use intersect: ix - intersect(rownames(big), rownames(small)) result - big result[ix, ix] - big[ix, ix] + small[ix, ix]

Re: [R] Do colClasses in readHTMLTable (XML Package) work?

2010-03-20 Thread Duncan Temple Lang
On 3/17/10 6:52 PM, Marshall Feldman wrote: Hi, I can't get the colClasses option to work in the readHTMLTable function of the XML package. Here's a code fragment: require(XML) doc - http://www.nber.org/cycles/cyclesmain.html; table - getNodeSet(htmlParse(doc),//table)

Re: [R] grid lines aligned on each ticks with a log scale

2010-03-20 Thread Duncan Murdoch
On 20/03/2010 7:35 AM, Duncan Murdoch wrote: On 20/03/2010 6:38 AM, Benoit Boulinguiez wrote: Hi all, for publication purpose I must provide a graph with grid lines aligned with each tick mark. Thing is that the graph has a log scale on the x-axis. I looked at the grid() and par()

[R] How to select a row from one dataframe that is close to a row in another dataframe

2010-03-20 Thread James Rome
I have two data frames of flight data, but they have very different numbers of rows. They come from different sources, so the data are not identical. names(oooi) [1] FltOrigDt MkdCrrCd [3] MkdFltNbr DprtTrpnStnCd [5] ArrTrpnStnCd

[R] How to count the number of occurence?

2010-03-20 Thread tj
Hi, may I ask for your help... What is the R code if I want to count the number of times that 2 appeared in the following R output k [1] 1 1 1 1 1 1 3 1 2 1 1 1 1 1 1 1 1 3 2 1 1 4 1 1 1 1 1 5 1 1 Thank you for your help. :-) -- View this message in context:

[R] EM algorithm in R

2010-03-20 Thread tj
Please help me in writing the R code for this problem. I've been solving this for 4 days. It was hard for me to solve it. It's a simulation problem in R. The problem is My true model is a normal mixture which is given as 0.5 N(-0.8,1) + 0.5 N(0.8,1). This model has two components. I will get

Re: [R] grid lines aligned on each ticks with a log scale

2010-03-20 Thread Benoit Boulinguiez
Terrific! How could I've missed that. Well, I know, I didn't get it from the documentation... Thanks Regards/Cordialement Benoit Boulinguiez -Message d'origine- De : Duncan Murdoch [mailto:murd...@stats.uwo.ca] Envoyé : samedi 20 mars 2010 14:54 À : Benoit Boulinguiez Cc :

[R] About new CRAN mirror site application

2010-03-20 Thread Steve Chen
Hi all, I couldn't find other appropriate place to ask this question, so I am posting the message to R-help mailling list. Our department had set up a new CRAN mirror site and is working fine so far. According CRAN mirror Howto, I sent an email to c...@r-project.org about 5 days ago to sumit our

Re: [R] How to count the number of occurence?

2010-03-20 Thread David Winsemius
On Mar 20, 2010, at 3:43 AM, tj wrote: Hi, may I ask for your help... What is the R code if I want to count the number of times that 2 appeared in the following R output k [1] 1 1 1 1 1 1 3 1 2 1 1 1 1 1 1 1 1 3 2 1 1 4 1 1 1 1 1 5 1 1 sum(k==2) David Winsemius, MD West

Re: [R] EM algorithm in R

2010-03-20 Thread David Winsemius
On Mar 20, 2010, at 3:53 AM, tj wrote: Please help me in writing the R code for this problem. I've been solving this for 4 days. It was hard for me to solve it. It's a simulation problem in R. The problem is My true model is a normal mixture which is given as 0.5 N(-0.8,1) + 0.5

Re: [R] How to select a row from one dataframe that is close to a row in another dataframe

2010-03-20 Thread Daniel Malter
If the flight identifiers runway$Flight and oooi$Flight are unique (i.e. only one observation has the same identifier in each dataset), you could use merge() to bind together the dataset based on matching the two. See, ?merge Also, I see an OnDate variable in both dataset. So if Flight does not

[R] Delete all object except some particular ones

2010-03-20 Thread bogaso.christofer
Dear all, in my working project, I have created huge number of different kind of objects including AA and BB. Now I want to delete all objects except that AA and BB. Is there any procedure in R to do that ? Thanks, [[alternative HTML version deleted]]

Re: [R] Delete all object except some particular ones

2010-03-20 Thread Nikhil Kaza
rm(setdiff(ls(), c(AA, BB)) should work. On Mar 20, 2010, at 12:27 PM, bogaso.christofer wrote: Dear all, in my working project, I have created huge number of different kind of objects including AA and BB. Now I want to delete all objects except that AA and BB. Is there any procedure in R

Re: [R] How to select a row from one dataframe that is close to a row in another dataframe

2010-03-20 Thread jim holtman
sqldf package: n - 200 x - data.frame(id=sample(1:10,n, TRUE), timex=runif(n)) y - data.frame(id=sample(1:15, n, TRUE), timey=runif(n), runway=seq(n)) require(sqldf) sqldf(select x.id, timex, y.id, timey, y.runway from x join y + where x.id = y.id and abs(timex - timey) 0.005) id

Re: [R] How to select a row from one dataframe that is close to a row in another dataframe

2010-03-20 Thread Gabor Grothendieck
Using the sqldf package you could do an SQL join with the indicated condition in your where clause. See the examples section of this page: http://sqldf.googlecode.com On Sat, Mar 20, 2010 at 10:20 AM, James Rome jamesr...@gmail.com wrote: I have two data frames of flight data,  but they have

Re: [R] How to count the number of occurence?

2010-03-20 Thread jim holtman
use table and count all occurances at one time X [1] 1 1 1 1 1 1 3 1 2 1 1 1 1 1 1 1 1 3 2 1 1 4 1 1 1 1 1 5 1 1 table(X) X 1 2 3 4 5 24 2 2 1 1 On Sat, Mar 20, 2010 at 3:43 AM, tj girlm...@yahoo.com wrote: Hi, may I ask for your help... What is the R code if I want to count

Re: [R] About new CRAN mirror site application

2010-03-20 Thread Uwe Ligges
Dear Steve Chen, you have sent it to the correct address, but the CRAN maintainer who is in duty for the mirrors may not have had the time to look at it yet. Please wait for another few days and you will certainly get a response hear. Thanks in advance for providing space and bandwidth for

Re: [R] How to count the number of occurence?

2010-03-20 Thread tj
Thanks everyone for your help! All your suggestions work. I appreciate it. Have a great day! -- View this message in context: http://n4.nabble.com/How-to-count-the-number-of-occurence-tp1661733p1675997.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] EM algorithm in R

2010-03-20 Thread tj
Thanks David. I already tried two different programs for this. The first one has errors. I'm working right now on my alternative program ( i hope it will work), BUT I still prefer to use the first program I made because it is more detailed. So, I'm trying how to correct the errors in the first R

Re: [R] EM algorithm in R

2010-03-20 Thread Sharpie
tj wrote: Thanks David. I already tried two different programs for this. The first one has errors. I'm working right now on my alternative program ( i hope it will work), BUT I still prefer to use the first program I made because it is more detailed. So, I'm trying how to correct the

Re: [R] How to select a row from one dataframe that is close to a row in another dataframe

2010-03-20 Thread James Rome
On 3/20/2010 11:52 AM, Daniel Malter wrote: If the flight identifiers runway$Flight and oooi$Flight are unique (i.e. only one observation has the same identifier in each dataset), you could use merge() to bind together the dataset based on matching the two. See, ?merge Also, I see an OnDate

Re: [R] sapply, lattice functions

2010-03-20 Thread Dieter Menne
Sundar Dorai-Raj-2 wrote: Or perhaps more clearly, histogram(~a1 + b1 + c1, data = aa, outer = TRUE) Why outer=TRUE? Looks same for me without: Dieter library(lattice) aa - data.frame(a1=rnorm(20),b1=rnorm(20,0.8),c1=rnorm(20,0.5)) histogram(~a1 + b1 + c1, data = aa) -- View this

Re: [R] How to select a row from one dataframe that is close to a row in another dataframe

2010-03-20 Thread Gabor Grothendieck
On Sat, Mar 20, 2010 at 1:39 PM, James Rome jamesr...@gmail.com wrote: And to use sqldf, it looks as if I have to read the source data files directly into sqldf to use it. No. The whole idea of sqldf is that it operates directly on data frames. __

Re: [R] sapply, lattice functions

2010-03-20 Thread Sundar Dorai-Raj
You're right. It's necessary for xyplot though to prevent grouping. On Mar 20, 2010 10:43 AM, Dieter Menne dieter.me...@menne-biomed.de wrote: Sundar Dorai-Raj-2 wrote: Or perhaps more clearly, histogram(~a1 + b1 + c1, data = aa, o... Why outer=TRUE? Looks same for me without: Dieter

[R] Printing Unicode characters in a PDF document

2010-03-20 Thread Dennis Fisher
Colleagues, OS: OS X R: 2.10.1 I want a mu (µ) to appear in text that is created using a PDF device. However, the µ does not appear as intended; instead, it is replaced by two dots. A minimal example is: pdf(mu.pdf) plot(1,1, type=n) text(1,1, \u3BC) dev.off() The text command

Re: [R] Printing Unicode characters in a PDF document

2010-03-20 Thread David Winsemius
?plotmath Try instead: pdf(mu.pdf) plot(1,1, type=n) text(1,1, \u3BC) dev.off() On Mar 20, 2010, at 2:16 PM, Dennis Fisher wrote: pdf(mu.pdf) plot(1,1, type=n) text(1,1, \u3BC) dev.off() David Winsemius, MD West Hartford, CT __

Re: [R] Printing Unicode characters in a PDF document

2010-03-20 Thread David Winsemius
Sorry for the noise. I did not read to the end and then pasted the wrong code in as well. I intended to post a suggestion to use: text(1,1, expression(mu)) I'm guessing it is happening because different fonts or families are being used for quartz and pdf devices. But I am not skilled at

[R] Subscription

2010-03-20 Thread Gaathier Mahed
Dear Sir/madam I would like to subscribe to the mailing list for the R software Regards __ 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

[R] Time series data

2010-03-20 Thread Gaathier Mahed
Dear Sir/madam I am a new user to R. I have no background in coding or even scripting. It seems as if R would be the best tool in order to analyse large sets of data. I need to sum hourly readings for the day and then sum daily into monthly readings. i also need to do the same for another set of

Re: [R] EM algorithm in R

2010-03-20 Thread tj
here is my program... Im trying to fit 1 component to 6 components in each of the 300 generated samples. Each sample has size=200. For each of the 300 generated samples and for each modeled component (v=1,2,3,4,5,6), I will get estimates of the parameters that will maximize the likelihood, AND

Re: [R] Printing Unicode characters in a PDF document

2010-03-20 Thread David Winsemius
On Mar 20, 2010, at 2:53 PM, David Winsemius wrote: Sorry for the noise. I did not read to the end and then pasted the wrong code in as well. I intended to post a suggestion to use: text(1,1, expression(mu)) I'm guessing it is happening because different fonts or families are being used

Re: [R] Time series data

2010-03-20 Thread David Winsemius
On Mar 20, 2010, at 1:17 PM, Gaathier Mahed wrote: Dear Sir/madam I am a new user to R. I have no background in coding or even scripting. It seems as if R would be the best tool in order to analyse large sets of data. I need to sum hourly readings for the day and then sum daily into monthly

[R] R function to delete a csv file from disk

2010-03-20 Thread Megh
Is there any R function to delete a CSV file saved in disk? For example here I have created following R function : asd - function(a = 5) { dat - read.delim(file=F:/Test.csv, header=T, sep=,) res - dat[1,1]*a # Here I want to delete Test.csv return(res) } Here I am looking

Re: [R] R function to delete a csv file from disk

2010-03-20 Thread Jan Schwanbeck
I guess, you are looking for: ?file.remove Am 20.03.2010 20:36, schrieb Megh: Is there any R function to delete a CSV file saved in disk? For example here I have created following R function : asd- function(a = 5) { dat- read.delim(file=F:/Test.csv, header=T, sep=,) res- dat[1,1]*a

[R] summated scale

2010-03-20 Thread Anthony Lopez
hello, I am new to R (convert from Stata) and I am wondering if there is an R command/function for generating a summated scale from, for example, four separate variables in a data set. In other words, I want to transform the variables x1, x2, x3, and x4 (which have high inter-item reliability)

[R] abline on heatmap

2010-03-20 Thread Tim Smith
Hi, Is there a way I can draw an abline on a heatmap? I try the abline function, but don't get the line. My sample code is: mat - matrix(sample(1:100,40),nrow=5) heatmap(mat,col=greenred(75),trace=none, dendrogram = column,labCol = NULL) abline(h=5,v=4) thanks! [[alternative

Re: [R] summated scale

2010-03-20 Thread Jorge Ivan Velez
Hi Anthony, Perhaps ?rowSums ?apply ?aggregate ?ave Here is an example: set.seed(123) X - matrix(rnorm(40), ncol = 4) colnames(X) - c('x1','x2','x3','x4') X x - rowSums(X) x cbind(X, x) HTH, Jorge On Sat, Mar 20, 2010 at 4:02 PM, Anthony Lopez wrote: hello, I am new to R (convert

Re: [R] summated scale

2010-03-20 Thread Ista Zahn
Hi Anthony, Have a look at ?rowSums (if you just want to calculate the score) or ?score.items in the psych package (if you want to calculate alpha's, item-by-scale correlations etc.). -Ista On Sat, Mar 20, 2010 at 4:02 PM, Anthony Lopez skytrek...@gmail.com wrote: hello, I am new to R

Re: [R] abline on heatmap

2010-03-20 Thread Sarah Goslee
You can use abline, but heatmap rescales the x and y coordinates to min of 0, max of 1. You can use the max x and y values to find the desired location for the line. Sarah On Sat, Mar 20, 2010 at 4:02 PM, Tim Smith tim_smith_...@yahoo.com wrote: Hi, Is there a way I can draw an abline on a

[R] Converting a character string into a data frame name and performing assignments to that data frame

2010-03-20 Thread Kavitha Venkatesan
Hi, I would like to do the following operations: variable.df is a character string that contains the name of the data frame that I want to do the following operations on: variable.df - data.frame(); # I can do the above command using assign( variable.df, data.frame() ) How can I perform the

[R] POSIXct conversion stops part way through a df column

2010-03-20 Thread James Rome
I have a date/time imported from Excel in my dataframe oooi (with several hundred thousand rows), for example the input data near row 3100 is ActualOnLocal 11/12/2008 21:35 11/12/2008 22:03 11/12/2008 22:12 11/12/2008 22:38 11/12/2008 23:16 11/12/2008 23:23 11/13/2008 7:00 11/13/2008 7:03

Re: [R] POSIXct conversion stops part way through a df column

2010-03-20 Thread David Winsemius
On Mar 20, 2010, at 5:08 PM, James Rome wrote: I have a date/time imported from Excel in my dataframe oooi (with several hundred thousand rows), for example the input data near row 3100 is ActualOnLocal 11/12/2008 21:35 11/12/2008 22:03 11/12/2008 22:12 11/12/2008 22:38 11/12/2008 23:16

Re: [R] multiple print commands in win.metafile()

2010-03-20 Thread Greg Snow
You may want to check out the odfWeave package for another way to produce multiple plots in a format that can be easily saved as a word doc. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From:

[R] different forms of nls recommendations

2010-03-20 Thread emorway
Hello, Using this data: http://n4.nabble.com/file/n1676330/US_Final_Values.txt US_Final_Values.txt and the following code i got the image at the end of this message: US.final.values-read.table(c:/tmp/US_Final_Values.txt,header=T,sep= )

[R] Problem specifying Gamma distribution in lme4/glmer

2010-03-20 Thread Matthew Giovanni
Dear R and lme4 users- I am trying to fit a mixed-effects model, with the glmer function in lme4, to right-skewed, zero-inflated, non-normal data representing understory grass and forb biomass (continuous) as a function of tree density (indicated by leaf-area). Thus, I have tried to specify a

Re: [R] Encrypt/decrypt in R

2010-03-20 Thread Carl Witthoft
Hi all, Does any one know of any encryption/decryption algorithms in R? I'm not looking for anything robust - I want some way of printing output to the screen that the user can't read immediately, but can decrypt a little later. The main thing I don't want to the user to see is a number,

[R] using a condition given as string in subset function - how?

2010-03-20 Thread Mark Heckmann
df - data.frame(A=c(1,2), B=c(1,1)) I have a string containing a condition for a subset function, like: conditionAsString - paste(names(df), df[1,], sep===, collapse= ) conditionAsString A==1 B==1 Now I want to use this string in the subset call, like subset(df, conditionAsString) I do

[R] Survival

2010-03-20 Thread Ashta
Hi All, I was trying to find a function that handles Partially Linear Single-Index model in survival analysis, but was not lucky. Is thee a function in R for this type of analysis? Thanks A __ R-help@r-project.org mailing list

Re: [R] using a condition given as string in subset function - how?

2010-03-20 Thread jim holtman
I know that if you have to resort to 'parse(text=...)', you should look for another way (it is a 'fortune'), but it is getting late, and at least it works: eval(parse(text=subset(df, A==1 B==1))) A B 1 1 1 On Sat, Mar 20, 2010 at 9:09 PM, Mark Heckmann mark.heckm...@gmx.de wrote: df -