[R] Built-in Code behind SVM

2009-04-10 Thread Shubha Vishwanath Karanth
Hi R, I need to see the inner code behind the function svm in the package e1071. I enter svm in the console and get the below output. svm function (x, ...) UseMethod(svm) environment: namespace:e1071 Is there any way I can look into the code of what svm (support vector machine) is

[R] Odp: how to automatically select certain columns using for loop in dataframe

2009-04-10 Thread Petr PIKAL
Hi I do not like complicated paste cycles too much so I would prefer for (i in 1:4) print(na.omit(all.data[ ,last.char(names(all.data)) %in% col_names[i] ])) with last.char function like this last.char-function(x) substring(x, first=nchar(x), last=nchar(x)) Regards Petr

Re: [R] Multiple Hexbinplots in 2 columns with a Single Categorical Variable

2009-04-10 Thread Paul Murrell
Hi Does this do it ... ? useOuterStrips(hexbinplot(Transferin ~ Age | factor(Race) + factor(Sex), data=NHANES, type=r, aspect=1, scales= list(x=list(relation=free, rot=0,

[R] Discriminant Analysis Ellipse

2009-04-10 Thread MarcioRibeiro
Hi listers, I am working on a program in order to create an ellipse as a limit of my observations there are well classified. I have two independent variables for an quadratic discriminant function between 2 groups where my mean is zero and my covariance matrix is proportional. Q=y'Ay+c My program

[R] pdftex treats R pdf figures incorrectly

2009-04-10 Thread Андрей Парамонов
Hello! I use R 2.8.1 under Debian GNU/Linux. I've run into a problem including R pdf figures into LaTeX document. To reproduce: 1) Execute the following minimal R script: pdf('fig.pdf', family = 'URWTimes', width = 5, height = 5) plot(rnorm(10), main = 'Тест', xlab = 'Абсцисса', ylab =

[R] timeDate and timeSeries function in R

2009-04-10 Thread asarkar
Hi I am using the following data set: cond |ex |symbol |corr |g127 |price |siz |tdate |tseq |ttim | T |T |MSFT |0 |0 |121.125 |1500 |01MAY1997 |0 |28862 | T |T |MSFT |0 |0 |121.5625 |500 |01MAY1997 |0 |28944 | The following R code is attached. When I am executing the

Re: [R] Cross-platforms solution to export R graphs

2009-04-10 Thread Philippe Grosjean
Emmanuel Charpentier wrote: Le jeudi 09 avril 2009 à 15:04 +0200, Philippe Grosjean a écrit : Hello Rusers, I have worked on a R Wiki page for solutions in exporting R graphs, especially, the often-asked questions: - How can I export R graphs in vectorized format (EMF) for inclusion in MS

[R] How to create matrix for if-else application with i?

2009-04-10 Thread herbert8686
Dear R-friends, Could you please help me with a problem? I have a table with 4 columns: P,Z,S,T. Sometimes z is smaller than s, sometimes z is greater than t. For these smaller/greater z-values, I do need the associated p-value (see example below). I need the whole range of a and b, but I

[R] How to create matrix for if-else application with i?

2009-04-10 Thread herbert8686
Dear R-friends, Could you please help me with a problem? I have a table with 4 columns: P,Z,S,T. Sometimes z is smaller than s, sometimes z is greater than t. For these smaller/greater z-values, I do need the associated p-value (see example below). I need the whole range of a and b, but I

Re: [R] xmlEventParse returning trimmed content?

2009-04-10 Thread Johannes Graumann
Hi Duncan, Thanks for your thoughts. trim=FALSE does not fix my issues, so I attach pared down versions of my script and data file. Thanks for any further hint. Joh Duncan Temple Lang wrote: Hi Johannes I would guess that the trimming of the text occurs because you do not specify trim

[R] turning list into vector/dataframe

2009-04-10 Thread Melissa2k9
Hi, I have used this command : resamples-lapply(1:1000,function(i) sample(lambs,replace=F)) resamples2-lapply(resamples,Cusum) to get a list of 1000 samples of my data. The function Cumsum is defined as follows: Cusum-function(x){ SUM-cumsum(x)-(1:length(x))*mean(x)

Re: [R] How to create matrix for if-else application with i?

2009-04-10 Thread Jim Lemon
herbert8...@gmx.de wrote: Dear R-friends, Could you please help me with a problem? I have a table with 4 columns: P,Z,S,T. Sometimes z is smaller than s, sometimes z is greater than t. For these smaller/greater z-values, I do need the associated p-value (see example below). I need the whole

Re: [R] turning list into vector/dataframe

2009-04-10 Thread Alain Guillet
Hi Melissa, L - list(min=rnorm(5),mean=rnorm(5),max=rnorm(5)) matrix(unlist(L),ncol=3) gives what you want Alain Melissa2k9 wrote: Hi, I have used this command : resamples-lapply(1:1000,function(i) sample(lambs,replace=F)) resamples2-lapply(resamples,Cusum) to get a list of 1000

Re: [R] Built-in Code behind SVM

2009-04-10 Thread David Winsemius
Pages 43-45 of this Rnews are an article by Uwe Ligges that should answer all of your questions: http://cran.r-project.org/doc/Rnews/Rnews_2006-4.pdf -- David Winsemius On Apr 10, 2009, at 2:40 AM, Shubha Vishwanath Karanth wrote: I need to see the inner code behind the function svm in the

Re: [R] turning list into vector/dataframe

2009-04-10 Thread ONKELINX, Thierry
Dear Melissa, Use sapply instead of lapply and name the output vector of your Cusum function. Note that I have simplified that function. Cusum - function(x){ SUM - cumsum(x) - seq_along(x) * mean(x) c(Min = min(SUM), Max = max(SUM), Diff = diff(range(SUM))) } lambs - rnorm(10)

[R] FFT function

2009-04-10 Thread Achilleas Achilleos
Hi, A very simple question. I know that the Fourier transform of a Laplace distribution, with zero mean and variance 2b^2, is equal to 1/(1+(tb)^2). Therefore, the Fourier transform is a positive function (actually is always between 0 and 1). BUT, if I use the fft(alpha) function of R, where

Re: [R] How to create matrix for if-else application with i?

2009-04-10 Thread David Winsemius
Is it really a table? (That is a specific class of object in R.) You seem to be accessing it as a data.frame. Perhaps something along the lines of (untested): subset(fig8, (Z S | Z T) )$P -- David Winsemius On Apr 10, 2009, at 5:54 AM, herbert8...@gmx.de wrote: Dear R-friends, Could

Re: [R] pdftex treats R pdf figures incorrectly

2009-04-10 Thread Ben Bolker
Андрей Парамонов cmr.pent at gmail.com writes: Hello! I use R 2.8.1 under Debian GNU/Linux. I've run into a problem including R pdf figures into LaTeX document. To reproduce: [snip snip snip] I would suggest forwarding this request to the r-devel mailing list ...

[R] dependent competing risks

2009-04-10 Thread Sidibe Modibo
Hi, I read your message on a forum, about your wish to estimate Han Hausman model on R. Did you find a solution? Best, __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] Cross-platforms solution to export R graphs

2009-04-10 Thread Philippe Grosjean
To further add to this discussion. I would like to propose **cross-platform** solutions, emphasizing that the proposed solutions should work on Windows, Mac OS X and Ubuntu, at least. First of all, inclusion of a simple EPS graphs produced by R 2.9.0 with: setEPS(); postscript(TestGraph.eps,

[R] Sweave, how to save plots with a defined size and how to include several pdf pages on the same line

2009-04-10 Thread Lore M
Hi there, I'm trying to realise a repport with R and Latex (TeXnicCenter and Miktex for Windows) using Sweave(). I'd like to save my plots with a given size. How can I do that ? The issue is that I have several plots created (but it's not always the same numbers of plots, in depends on the

Re: [R] Reshape - strange outputs

2009-04-10 Thread Steve Murray
Genius! Thanks very much Hadley - that was surprisingly easier to solve than I was anticipating! As a way of offering something back in return, I don't know if you plan to release a new version of the reshape package, but here's a suggestion to consider, just in case you do. On the basis of

[R] Didactic example and doubt: how to compare two regression line slopes

2009-04-10 Thread Jose Claudio Faria
Hi, I read almost all I found in prior R-Help list about How to compare two regression line slopes. So, I made a didactic example to illustrate a solution cited by Ben Bolker: === Subject:Re: [R] How to compare two regression line slopes From:

Re: [R] split a character variable into several character variable by a character

2009-04-10 Thread Adrian Dusa
Dear Mao Jianfeng, r-help-owner is not the place for help, but: r-help@r-project.org (CC-ed here) In any case, strsplit() does the job, i.e.: unlist(strsplit(BCPy01-01, -)) [1] BCPy01 01 You can work with the whole variable, like: splitpop - strsplit(df1$popcode, -) then access the first part

[R] png with ggplot on windows xp

2009-04-10 Thread Juliet Hannah
Hi Group, I posted this question on the ggplot list and was advised to try here also. The code below produces a plot as a png and pdf. The pdf looks great, and I cannot make the png look this way. I've tried various combinations of height, width, and dpi, but it has not worked out so far. Any

Re: [R] turning list into vector/dataframe

2009-04-10 Thread baptiste auguie
try this, do.call(rbind, resample2) #or simply, replicate(1000, Cusum(sample(lambs,replace=F))) you could also look at the plyr package. Hope this helps, baptiste On 10 Apr 2009, at 09:03, Melissa2k9 wrote: Hi, I have used this command : resamples-lapply(1:1000,function(i)

Re: [R] help with random forest package

2009-04-10 Thread Chrysanthi A.
Hi, To be honest, I cannot really understand what is the meaning of the votes.. For example having five samples and two classes what the numbers below means? healthy unhealthy 1 0.85714286 0.14285714 2 0.92857143 0.07142857 3 0.9000 0.1000 4 0.92857143 0.07142857 5 0.84615385

[R] split a character variable into several character variable by a character

2009-04-10 Thread Mao Jianfeng
Dear, R-lister, I have a dataframe like the followed. And, I want to split a character variable (popcode, or codetot) into several new variables. For example, split BCPy01-01 (in popcode) into BCPy01 and 01. I need to know how to do that. I have tried strsplit() and substring() functions. But, I

Re: [R] split a character variable into several character variable by a character

2009-04-10 Thread William Dunlap
strsplit() is the way to do it, but if your putative character strings come from a data.frame you need to make sure they are really character strings and not factors (at least in R 2.8.1). d-data.frame(name=c(Bill Dunlap, First Last), num=1:2) d name num 1 Bill Dunlap 1

Re: [R] split a character variable into several charac ter variable by a character

2009-04-10 Thread Adrian Dusa
Good observation, Bill! Adrian On Friday 10 April 2009, William Dunlap wrote: strsplit() is the way to do it, but if your putative character strings come from a data.frame you need to make sure they are really character strings and not factors (at least in R 2.8.1).

[R] Coloring X and Y axis

2009-04-10 Thread Gundala Viswanath
Dear all, Is there a way to do it? The following code: pdf(test.pdf) plot(1,1,col=red) dev.off() Only colors the plot into red, but not x and y axis (inclusive the tick marks). - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org

[R] Random Forests: Question about R^2

2009-04-10 Thread Dimitri Liakhovitski
Dear Random Forests gurus, I have a question about R^2 provided by randomForest (for regression). I don't succeed in finding this information. In the help file for randomForest under Value it says: rsq: (regression only) - pseudo R-squared'': 1 - mse / Var(y). Could someone please explain in

Re: [R] Coloring X and Y axis

2009-04-10 Thread Bert Gunter
plot(..., axes=FALSE) axis(...) ?plot; ?axis Bert Gunter Genentech Nonclinical Biostatistics 650-467-7374 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Gundala Viswanath Sent: Friday, April 10, 2009 8:26 AM To:

Re: [R] Coloring X and Y axis

2009-04-10 Thread Uwe Ligges
Gundala Viswanath wrote: Dear all, Is there a way to do it? The following code: pdf(test.pdf) plot(1,1,col=red) dev.off() Only colors the plot into red, but not x and y axis (inclusive the tick marks). See ?par and arguments such as fg, col.axis, col.lab ... Uwe Ligges - Gundala

Re: [R] MLE for bimodal distribution

2009-04-10 Thread Ted Harding
On 08-Apr-09 23:39:36, Ted Harding wrote: On 08-Apr-09 22:10:26, Ravi Varadhan wrote: EM algorithm is a better approach for maximum likelihood estimation of finite-mixture models than direct maximization of the mixture log-likelihood. Due to its ascent properties, it is guaranteed to

Re: [R] problems with integrate ... arguments

2009-04-10 Thread Duncan Murdoch
On 09/04/2009 8:07 AM, Richard Morey wrote: Hi everyone, I saw this problem dealt with here: http://markmail.org/search/list:r-project?q=integrate#query:list%3Ar-project%20integrate+page:1+mid:qczmyzr676pgmaaw+state:results but no one answered that request that I can tell. I'm having the same

Re: [R] Cross-platforms solution to export R graphs

2009-04-10 Thread Liviu Andronic
Hello, On Thu, Apr 9, 2009 at 3:04 PM, Philippe Grosjean phgrosj...@sciviews.org wrote: Cross-platforms solution to export R graphs There is playwith, and latticist, which seem cross-platform (binaries available for both MacWin). rattle uses latticist. Rcmdr can be used for saving graphs.

Re: [R] Cross-platforms solution to export R graphs

2009-04-10 Thread Liviu Andronic
On Thu, Apr 9, 2009 at 3:04 PM, Philippe Grosjean phgrosj...@sciviews.org wrote: The page is at: http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:export. The article suggests to use Inksacpe for PDF - SVG conversion. I've recently experimented this, but it seems that the graph

Re: [R] xmlEventParse returning trimmed content?

2009-04-10 Thread Duncan Temple Lang
Just to hopefully complete this for the record. Johannes attachment didn't make it to the list, but in an off-list conversation, I believe the problem is not trimming of text (i.e. removing leading and trailing whitespace) but apparent truncation of text in an XML node. The xmlEventParse()

[R] Two different scales for the same axis in the same plot.

2009-04-10 Thread George Chen
Hello, Could anyone tell me how to plot data on two different scales in the same axis in the same plot? Here is my quandary: The range of my X axis runs from 0 to 10, but the majority of my meaningful data lies between 7 and 10. The data from 0 to 7 is essentially noise. Is there a way for me

Re: [R] Two different scales for the same axis in the same plot.

2009-04-10 Thread Greg Snow
Look at the gap.plot function in the plotrix package. It may work for you, or if not, looking at the code may give you some ideas of how to make a similar plot with the different scales that you want. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare

Re: [R] Two different scales for the same axis in the same plot.

2009-04-10 Thread Jorge Ivan Velez
Dear George, Take a look at the twoord.plot function in the plotrix package. HTH, Jorge On Fri, Apr 10, 2009 at 1:37 PM, George Chen glc...@stanford.edu wrote: Hello, Could anyone tell me how to plot data on two different scales in the same axis in the same plot? Here is my quandary:

[R] using more plotting area for a lattice plot

2009-04-10 Thread Juliet Hannah
Hi Group, For the plot below, are there other ways I can use more of the plotting space. I've tweaked the parameters I know of. I could also put the plot titles inside the plot if there is a way to do that. Thanks for your input. Regards, Juliet p1 - runif(1000) # sample data qp1 - qqmath(~

[R] Frequency Counts per Time Period

2009-04-10 Thread jason
Hello all, I would like to count the number of events that occur per minute for some measurements I have taken. I would eventually like to look at the sums of some of the measurements for the grouped events. I think I am not understanding how to use the returned value from the trunc function

Re: [R] Frequency Counts per Time Period

2009-04-10 Thread William Dunlap
I think the problem is that (a) trunc(POSIXct.object) returns a POSIXlt object instead of a POSIXct object. (b) length(POSIXlt.object) always returns 9 (the number of components in the object, not the number of time entries) while length(POSIXct.object) returns the

Re: [R] split a character variable into several character variable by a character

2009-04-10 Thread Francisco J. Zagmutt
Hello Mao, If the popcode variable has a fixed number of characters (i.e each entry has 9 characters), you can use a simple call to substr: dat-read.table(clipboard, header=T)#Read from your email varleft-substr(dat$popcode,0,6) varright-substr(dat$popcode,8,9)

[R] recursive function, how to avoid list structure in return value

2009-04-10 Thread Jenny Bryan
I've written a recursive function to extract the members of an individual cluster within a hierarchical clustering. I have something that works, but the return value has a list structure I don't like. I know how to work around with 'unlist()' but I suspect the function could be fixed.

[R] Stacked density plots

2009-04-10 Thread Judith Flores
Hello R-community, I want to generate stacked density plots in lattice. My data consist of a numeric variable ('pid') that is measured in different individuals ('id'), which can be divided in two types ('type') and the measurements were repeated a different time points ('day'). I read in

[R] Determine the Length of the Longest Word in a String

2009-04-10 Thread Shadley Thomas
Hi Everyone, I'm new to programming R and have accomplished my goal, but feel that there is probably a more efficient way of coding this. I'd appreciate any guidance that a more advanced programmer can provide. My goal -- I would like to find the length of the longest word in a string

[R] How to handle tabular form data in lmer without expanding the data into binary outcome form?

2009-04-10 Thread Sean Zhang
Dear R-gurus: I have a question about lmer. Basically, I have a dataset, in which each observation records number of trials (N) and number of events (Y) given a covariate combination(X) and group id (grp_id). So, my dataset is in tabular form. (in case my explanation of tabular form is unclear,

Re: [R] Determine the Length of the Longest Word in a String

2009-04-10 Thread Kingsford Jones
On Fri, Apr 10, 2009 at 2:40 PM, Shadley Thomas shadley.tho...@gmail.com wrote: [snip] My question -- It seems inefficient to determine which element is the longest and then calculate the length of that longest element.  I was hoping to find a way to simply return the length of the longest

Re: [R] Determine the Length of the Longest Word in a String

2009-04-10 Thread Marc Schwartz
On Apr 10, 2009, at 3:40 PM, Shadley Thomas wrote: Hi Everyone, I'm new to programming R and have accomplished my goal, but feel that there is probably a more efficient way of coding this. I'd appreciate any guidance that a more advanced programmer can provide. My goal -- I would like to

Re: [R] How to handle tabular form data in lmer without expanding the data into binary outcome form?

2009-04-10 Thread Kingsford Jones
See ?lmer and notice model gm1 in the examples. As with glm, a binomial lmer model can have the response specified as a two-column matrix with the columns giving the numbers of successes and failures. hth, Kingsford Jones On Fri, Apr 10, 2009 at 2:48 PM, Sean Zhang seane...@gmail.com wrote:

[R] Problem with bargraph.CI in Sciplot package

2009-04-10 Thread Metconnection
Hi there, I wonder if anyone can help me. I'm trying to use bargraph.CI in the Sciplot package when there is a missing combination of the factor levels. Unfortunately the standard errors on the plot do not appear to be correct. Consider an analysis consisting of two factors A and B. When all

Re: [R] FFT function

2009-04-10 Thread Rolf Turner
On 10/04/2009, at 11:44 PM, Achilleas Achilleos wrote: Hi, A very simple question. I know that the Fourier transform of a Laplace distribution, with zero mean and variance 2b^2, is equal to 1/(1+(tb)^2). Therefore, the Fourier transform is a positive function (actually is always between 0

Re: [R] Stacked density plots

2009-04-10 Thread David Winsemius
On Apr 10, 2009, at 4:53 PM, Judith Flores wrote: Hello R-community, I want to generate stacked density plots in lattice. My data consist of a numeric variable ('pid') that is measured in different individuals ('id'), which can be divided in two types ('type') and the measurements

[R] Plot legend

2009-04-10 Thread Sherri Heck
Dear All- I am trying to create a legend where the first 9 terms are represented as pch=16 in one column (which I am able to do); but, I would like the last two terms in that column to be 'lines (which are black and red - just as it looks like in the plot). I have read through many help pages

Re: [R] Stacked density plots

2009-04-10 Thread Deepayan Sarkar
On Fri, Apr 10, 2009 at 1:53 PM, Judith Flores jur...@yahoo.com wrote: Hello R-community,    I want to generate stacked density plots in lattice. My data consist of a numeric variable ('pid') that is measured in different individuals ('id'), which can be divided in two types ('type') and

Re: [R] using more plotting area for a lattice plot

2009-04-10 Thread Deepayan Sarkar
On Fri, Apr 10, 2009 at 11:23 AM, Juliet Hannah juliet.han...@gmail.com wrote: Hi Group, For the plot below, are there other ways I can use more of the plotting space. I've tweaked the parameters I know of. I could also put the plot titles inside the plot if there is a way to do that.  

Re: [R] Determine the Length of the Longest Word in a String

2009-04-10 Thread Gabor Grothendieck
Using strapply, we extract all strings of word characters and apply nchar to each simplifying by taking the max. library(gsubfn) strapply(shadstr, \\w+, nchar, simplify = max) See the info on the gsubfn home page: http://gsubfn.googlecode.com as well as the vignette, help file and demos. On

[R] Re MLE Issues

2009-04-10 Thread From Watchman
Hi I have been having issue with a ML estimator for Jump diffusion process but know I am get little error I didn't notice before like I am try to create a vector #GBMPJ MLE Combined Ph 1 LR # n-length(combinedlrph1) j-c(1,2,3,4,5,6,7,8,9,10) Error in c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) :

Re: [R] Re MLE Issues

2009-04-10 Thread Thomas Lumley
On Fri, 10 Apr 2009, From Watchman wrote: Hi I have been having issue with a ML estimator for Jump diffusion process but know I am get little error I didn't notice before like I am try to create a vector #GBMPJ MLE Combined Ph 1 LR # n-length(combinedlrph1) j-c(1,2,3,4,5,6,7,8,9,10) Error in

Re: [R] Frequency Counts per Time Period

2009-04-10 Thread William Doane
So, to complete Bill Dunlap's thought and combine it with your desired goal, I believe this gets you what you wanted... start.time - as.POSIXct(2009-04-10 12:00:00) event.times - start.time + c(1,2,3,61,62,122,135,200) event.values - rnorm(length(event.times)) et -

[R] who happenly read these two paper Mohsen Pourahmadi (biometrika1999, 2000)

2009-04-10 Thread Manli Yan
http://biomet.oxfordjournals.org/cgi/reprint/86/3/677 biometrika1999 http://biomet.oxfordjournals.org/cgi/reprint/94/4/1006 biometrika2000 Hi All: I just want to try some luck. I am currenly working on my project,one part of my project is to reanalysis the kenward cattle data by using the