Re: [R] Question about sampling

2012-06-14 Thread Guido Leoni
Sorry I'm not sure that prob is suitable for my purposes(but i'm quite newbie with R). If I correctly understand prob allows to set a weight for each row in the original dataset in order to include the rows on the basis of their weights). ... I'm not sure to correctly understanding ;-) In my case

Re: [R] Question about sampling

2012-06-14 Thread R. Michael Weylandt
I think you're right -- prob probably isn't quite what you need (at least, directly): constrained sampling like this is a little trickier -- I'll leave this to someone who knows more than me. Michael On Thu, Jun 14, 2012 at 9:07 AM, Guido Leoni guido.le...@gmail.com wrote: Sorry I'm not sure

Re: [R] Question about sampling

2012-06-14 Thread Guido Leoni
Just for make the archives more complete and simplifing the life of the following readers. I think to have solved my problem using the caret packages. In this package there is a function named createData Partition that after defining a column of interest in a data.frame allows to split a dataset

Re: [R] question about creating data frame

2012-06-14 Thread Mark Sharp
Below are two equivalent solutions. study_df - data.frame(course = c(rep('Mathematics', 80 + 15), rep('Physics', 32 + 24), rep('Biology', 18 + 29)), A = c(rep(1, 80), rep(0, 15),

Re: [R] Question on meaning of '%+%', '%?%' (? = various single letter) in code

2012-06-01 Thread peter dalgaard
On Jun 1, 2012, at 00:30 , Mike Hilt wrote: Could someone help me out and let me know what ‘%?%’ (where ? = a single letter in a 3 character string with ‘%’ being the 1st and 3rd characters), and/or ‘%+%’ does in R code/function? They are just a vehicle for defining binary operators:

Re: [R] Question about random Forest function in R

2012-05-29 Thread Liaw, Andy
Hi Kelly, The function has a limitation that it cannot handle any column in your x that is a categorical variable with more than 32 categories. One possibility is to see if you can bin some of the categories into one to get below 32 categories. Andy -Original Message- From:

Re: [R] Question about random Forest function in R

2012-05-29 Thread Liu, Weifeng Aaron
This is a well-known limitation. You have to group categorical attributes together to work around. -- Weifeng (aaron) liu  |  retail systems pricing  |  sr research scientist -Original Message- From:

Re: [R] question how to add Standard Deviation as Whiskers in a simple plot

2012-05-28 Thread David Winsemius
On May 28, 2012, at 9:55 AM, gianni lavaredo wrote: Dear Researchers, sorry for this simple question. I have a point plot with mean values and i wish to plot line with Standard Deviation as Whiskers. I calculate the mean+sd and mean-sd, but i can not figure out the way to add the line.

Re: [R] question how to add Standard Deviation as Whiskers in a simple plot

2012-05-28 Thread gianni lavaredo
The function i am looking is a bars from the mean points of the plot in boxplot style. I tryed several forum but I have no clear the way to create these bars. Gianni On Mon, May 28, 2012 at 7:13 PM, David Winsemius dwinsem...@comcast.netwrote: On May 28, 2012, at 9:55 AM, gianni lavaredo

Re: [R] question how to add Standard Deviation as Whiskers in a simple plot

2012-05-28 Thread Walmes Zeviani
This post are useful. http://myowelt.blogspot.com.br/2008/03/beautiful-error-bars-in-r.html http://mapas.mma.gov.br/i3geo/pacotes/rlib/win/gplots/html/plotCI.html Walmes. == Walmes Marques Zeviani LEG (Laboratório de

Re: [R] question how to add Standard Deviation as Whiskers in a simple plot

2012-05-28 Thread Rui Barradas
Hello, The function 'arrows' with angle=90 can do the job. mydata - data.frame(mean=c(0.42,0.41,0.41,0.43,0.45,0.43,0.43,0.42,0.44,0.45,0.45,0.45,0.46,0.43,0.42,0.37,0.44,0.46,0.46,0.39,0.40),

Re: [R] Question about extracting certain rows from one column in a data.frame

2012-05-28 Thread R. Michael Weylandt
On Mon, May 28, 2012 at 3:16 PM, Kelly Cool kellycoo...@yahoo.com wrote: I was wondering if there was a quick way to extract out certain rows from a data set in R? I have a data.frame, LOG,  where in one column, sample_data_tx, there is a list of 62 different types of treatment. I've

Re: [R] Question about extracting certain rows from one column in a data.frame

2012-05-28 Thread Jorge I Velez
Hi Kelly, Check ?subset in the R console. Here is a piece of code (untested): subset(LOG, sample_data %in% c(Noy, PLO)) HTH, Jorge.- On Mon, May 28, 2012 at 3:16 PM, Kelly Cool wrote: I was wondering if there was a quick way to extract out certain rows from a data set in R? I have a

Re: [R] question about TryCatch and lapply

2012-05-25 Thread jim holtman
Please show us the 'lapply' statement you are using. Here is a simple case of catching an error in an lapply and continuing: lapply(c(1,2,-3, 4), function(x){ + a - try(stopifnot(x 0)) # force an error + if (inherits(a, 'try-error')) return(NULL) + x + }) Error : x 0 is not TRUE

Re: [R] question about TryCatch and lapply

2012-05-25 Thread John Kerpel
Jim: That's the ticket! I'm actually using parLapply with a long, ugly function - so I was loath to post that mess. Many thanks - you saved my weekend. On Fri, May 25, 2012 at 2:23 PM, jim holtman jholt...@gmail.com wrote: Please show us the 'lapply' statement you are using. Here is a

Re: [R] question about TryCatch and lapply

2012-05-25 Thread Martin Morgan
On 5/25/2012 12:48 PM, John Kerpel wrote: Jim: That's the ticket! I'm actually using parLapply with a long, ugly function - so I was loath to post that mess. Many thanks - you saved my weekend. In the context of tryCatch in your question lst - list(1, 2, -3, 4) sapply(lst, function(x)

Re: [R] Question on if i am allowed to do something

2012-05-24 Thread Duncan Murdoch
Subject: Re: [R] Question on if i am allowed to do something On May 23, 2012, at 6:51 PM, Duncan Murdoch wrote: On 12-05-23 1:31 PM, Giannis Mamalikidis wrote: Hello all. I would like to know: provided that I absolutely state that R is not mine and I also include the R’s License which will be shown

Re: [R] Question on if i am allowed to do something

2012-05-24 Thread Marc Schwartz
in Electrical and Mechanical Engineering --- -Original Message- From: Marc Schwartz Sent: Thursday, May 24, 2012 3:58 AM To: Duncan Murdoch Cc: Giannis Mamalikidis ; r-help@r-project.org Subject: Re: [R] Question

Re: [R] Question on if i am allowed to do something

2012-05-24 Thread Giannis Mamalikidis
--- -Original Message- From: Marc Schwartz Sent: Thursday, May 24, 2012 3:58 AM To: Duncan Murdoch Cc: Giannis Mamalikidis ; r-help@r-project.org Subject: Re: [R] Question on if i am allowed to do something On May 23, 2012, at 6:51 PM, Duncan Murdoch wrote: On 12-05-23 1:31 PM, Giannis

Re: [R] Question on if i am allowed to do something

2012-05-24 Thread Giannis Mamalikidis
I see. It is decided then. As it might be possible that the license might be violated, I certainly will not include R in my programme. Thank you all for your help, you've been very helpful. --- Giannis Mamalikidis

Re: [R] Question on if i am allowed to do something

2012-05-23 Thread Duncan Murdoch
On 12-05-23 1:31 PM, Giannis Mamalikidis wrote: Hello all. I would like to know: provided that I absolutely state that R is not mine and I also include the R’s License which will be shown so people know R and R’s license, (provided the above) am I allowed to include R’s folder (the folder that

Re: [R] Question on if i am allowed to do something

2012-05-23 Thread Marc Schwartz
On May 23, 2012, at 6:51 PM, Duncan Murdoch wrote: On 12-05-23 1:31 PM, Giannis Mamalikidis wrote: Hello all. I would like to know: provided that I absolutely state that R is not mine and I also include the R’s License which will be shown so people know R and R’s license, (provided the

Re: [R] question about sign test

2012-05-20 Thread Joshua Wiley
Hi, That seems a reasonable enough approach to me. (p - pnorm(0, mean = 1, sd = .5)) is the probability of a value being less than or up to 0 from the distribution you specified. Using that, lets repeat your little test 1000 times using your code, and then using ribnom() where the probability

Re: [R] question about creating data frame

2012-05-15 Thread jim holtman
try this: x - read.table(text = 'Not A A + Mathematics 80 15 + Physics 32 24 + Biology 18 29', skip = 1, as.is = TRUE) # create the result result - do.call(rbind, lapply(1:nrow(x), function(.row){ + data.frame(course = x$V1[.row] + , A = c(rep(1, x$V2[.row]), rep(0, x$V3[.row]))

Re: [R] question about transforming data into data frame object

2012-05-06 Thread Jeff Newmiller
Not sure what your question was. Perhaps you could look up the reshape2 package and ask a more specific question? --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.us

Re: [R] question about transforming data into data frame object

2012-05-06 Thread David Winsemius
On May 6, 2012, at 3:56 PM, E Atescelik wrote: Hi,I had a question about transforming data into data frame object with two columns. I have data genal2.txt (see attachment) My data frame called genal2frame has to be in the form: genal2frame[1:6,] y mut 1

Re: [R] Question about expand.grid function in R

2012-05-01 Thread R. Michael Weylandt
I don't think you can do it within expand.grid() but something like this might work: rownames(x) - apply(x, 1, paste, collapse = ) Michael On Tue, May 1, 2012 at 5:05 AM, Kelly Cool kellycoo...@yahoo.com wrote: Hi, I am extremely new to R, and was wondering if someone would be able to help

Re: [R] question on jitter in plot.Predict in rms

2012-05-01 Thread Frank Harrell
Mike, Try plot(pref, ..., scat1d.opts=list(frac=0.025, lwd=0.3, nhistSpike=i)) where i = 1 to always use spike histograms (default is to use them if n = 2000) or i=1e7 to never use them and to always jitter instead. There are many other scat1d options you can pass through scat1d.opts. Frank

Re: [R] Question about expand.grid function in R

2012-05-01 Thread peter dalgaard
On May 1, 2012, at 15:36 , R. Michael Weylandt wrote: I don't think you can do it within expand.grid() but something like this might work: rownames(x) - apply(x, 1, paste, collapse = ) Also rownames(x) - do.call(paste, c(x, sep=)) or, in recent versions, rownames(x) - do.call(paste0,

Re: [R] question about lists

2012-04-19 Thread Duncan Murdoch
On 12-04-19 3:11 PM, harry mamaysky wrote: I am new to R, and I have been running into the following situation when I mistype a variable name in some code: list1- list( a=1, b=2 ) list2- list( a=1 ) list2$b- list1$c list2 $a [1] 1 I would think at the point where I am trying to reference a

Re: [R] Question with R CMD SHLIB in 64 bit R

2012-04-16 Thread Uwe Ligges
You may want to send the files as well as what you exactly typed in the shell in a private message. Uwe Ligges On 15.04.2012 20:09, Katharine Miller wrote: Yes. I have version 2.15.0 of Rtools as well. I went ahead and re-installed both R and Rtools just to make sure everything was OK. But

Re: [R] Question with R CMD SHLIB in 64 bit R

2012-04-15 Thread Uwe Ligges
On 14.04.2012 21:53, Katharine Miller wrote: OK. So, I have 64 bit Windows 7 and I have installed R 2.15.0 Yes, and have you also installed version 2.15 of the Rtools? Uwe ligges Thanks 2012/4/14 Uwe Liggeslig...@statistik.tu-dortmund.de On 14.04.2012 19:01, Katharine Miller

Re: [R] Question with R CMD SHLIB in 64 bit R

2012-04-15 Thread Katharine Miller
Yes. I have version 2.15.0 of Rtools as well. I went ahead and re-installed both R and Rtools just to make sure everything was OK. But that did not fix the problem. - Katharine 2012/4/15 Uwe Ligges lig...@statistik.tu-dortmund.de On 14.04.2012 21:53, Katharine Miller wrote: OK. So, I

Re: [R] Question with R CMD SHLIB in 64 bit R

2012-04-14 Thread Uwe Ligges
On 14.04.2012 00:24, Katharine Miller wrote: Hi, I have some C++ code that I compiled into a dll for use in 32 bit R and would like to recompile for use in 64bit R. I thought it would be as easy as going to R-2.15.0\bib\x64 and running R CMD SHLIB mfregRF.c Is this Windows? 1. If so, is

Re: [R] Question with R CMD SHLIB in 64 bit R

2012-04-14 Thread Katharine Miller
Hi, Sorry - I should have said that I was using Windows 7 on a 64 bit computer in my earlier post. I used the installer to install R, I did not do a build from source. I have read the installation instructions. Both R and Rtools are first in my path, but by toolchain do you mean that I need to

Re: [R] Question with R CMD SHLIB in 64 bit R

2012-04-14 Thread Uwe Ligges
On 14.04.2012 19:01, Katharine Miller wrote: Hi, Sorry - I should have said that I was using Windows 7 on a 64 bit computer in my earlier post. Which Windows 7? 64-bit or 32-bit? I used the installer to install R, I did not do a build from source. I have read the installation

Re: [R] Question with R CMD SHLIB in 64 bit R

2012-04-14 Thread Katharine Miller
OK. So, I have 64 bit Windows 7 and I have installed R 2.15.0 Thanks 2012/4/14 Uwe Ligges lig...@statistik.tu-dortmund.de On 14.04.2012 19:01, Katharine Miller wrote: Hi, Sorry - I should have said that I was using Windows 7 on a 64 bit computer in my earlier post. Which Windows 7?

Re: [R] Question on Counting Factors

2012-04-11 Thread David Winsemius
On Apr 11, 2012, at 9:21 AM, Daniel Gabrieli wrote: Hi, I hope this is not too trivial, but I've had this recurring problem and I think there is super easy solution, just not sure what it is. Please see short example below. I would like to get the frequency (counts) of all the variables in a

Re: [R] Question on Counting Factors

2012-04-11 Thread David Barron
This would do it in your example: levels(animals$V1) - c(cat,tiger,dog,fish) table(animals) cattigerdog fish 2 200 HTH David cat tiger dog fish 2 2 0 0 On 11 April 2012 14:21, Daniel Gabrieli daniel.gabri...@gmail.com wrote:

Re: [R] Question on Counting Factors

2012-04-11 Thread S Ellison
I would like to get the frequency (counts) of all the variables in a single column (that is easy), but I would also like to return the value 0 for the absence of variables defined in another column. If you use factor() on your columns and include all the animals in the factor levels, you

Re: [R] Question on Counting Factors - PS

2012-04-11 Thread S Ellison
-Original Message- This would do it in your example: levels(animals$V1) - c(cat,tiger,dog,fish) table(animals) cattigerdog fish 2 200 But be very wary of levels(animals$V2)- c(cat,tiger,dog,fish) table(animals$V2) cat tiger dog

Re: [R] Question about randomForest

2012-04-04 Thread Liaw, Andy
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Saruman I dont see how this answered the original question of the poster. He was quite clear: the value of the predictions coming out of RF do not match what comes out of the predict function using

Re: [R] Question about randomForest

2012-04-03 Thread Saruman
I dont see how this answered the original question of the poster. He was quite clear: the value of the predictions coming out of RF do not match what comes out of the predict function using the same RF object and the same data. Therefore, what is predict() doing that is different from RF? Yes, RF

Re: [R] question

2012-03-22 Thread R. Michael Weylandt
By googling. On Thu, Mar 22, 2012 at 11:37 PM, Anjana Thampi thampi.anjana...@gmail.com wrote: How do you run a regression in R?        [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] question about user written function (newb question)

2012-02-26 Thread R. Michael Weylandt
Short answer to a very good question: one has to use function(x) tail(x, 1) syntax to avoid using the default tail(x, 6). There are some other ways to achieve the same thing, but I think this syntax is generally preferred for its clarity. Other question: yes I believe so. Michael On Sun, Feb

Re: [R] question about user written function (newb question)

2012-02-26 Thread Gabor Grothendieck
On Sun, Feb 26, 2012 at 9:06 AM, knavero knav...@gmail.com wrote: Quick newb question about R relating to the line of code below: rawCool = read.zoo(cooling.txt, FUN = as.chron, format = %m/%d/%Y %H:%M, sep = \t, aggregate = function(x) tail(x, 1)) I'm wondering what the specifics are for

Re: [R] question on axis labels

2012-02-20 Thread Sarah Goslee
This works for me: plot(0:6, runif(7), xaxt=n) axis(1, at=0:6, labels=c(08:00, 12:00, 16:00, 20:00, 24:00, 04:00, 08:00), cex=0.8) You need the xaxt=n in the plot statement, and the correct form is at=0:6 Sarah On Mon, Feb 20, 2012 at 6:39 PM, Gerard Smits g_sm...@verizon.net wrote: Hi

Re: [R] question on axis labels

2012-02-20 Thread Gerard Smits
Worked like a charm! Thanks for your help. Gerard On Feb 20, 2012, at 3:52 PM, Sarah Goslee wrote: This works for me: plot(0:6, runif(7), xaxt=n) axis(1, at=0:6, labels=c(08:00, 12:00, 16:00, 20:00, 24:00, 04:00, 08:00), cex=0.8) You need the xaxt=n in the plot statement, and the

Re: [R] question

2012-02-15 Thread R. Michael Weylandt
Sorry about that -- forgot the case where you might only have a certain entry once: try this, sapply(split(GS, rownames(GS)), function(x) colSums(as.matrix(x))) or sapply(split(GS, rownames(GS)), function(x) if(is.matrix(x)) colSums(x) else x) I'm not sure if there's a way to force split to

Re: [R] question

2012-02-15 Thread R. Michael Weylandt
Blah! Forget that first one -- the second one should be fine. (or at least, I don't see a problem with it immediately) sapply(split(GS, rownames(GS)), function(x) if(is.matrix(x)) colSums(x) else x) Michael On Wed, Feb 15, 2012 at 7:19 AM, R. Michael Weylandt michael.weyla...@gmail.com wrote:

Re: [R] question

2012-02-15 Thread R. Michael Weylandt
1) The DEA package appears to have been removed from CRAN in 2008, so it is not likely to be readily available. Old versions are available from the CRAN archives though but I don't imagine you'll get much support if you try to use them: ftp://cran.r-project.org/pub/R/src/contrib/Archive/DEA/ 2)

Re: [R] question

2012-02-15 Thread David Winsemius
On Feb 15, 2012, at 7:19 AM, R. Michael Weylandt wrote: Sorry about that -- forgot the case where you might only have a certain entry once: try this, sapply(split(GS, rownames(GS)), function(x) colSums(as.matrix(x))) or sapply(split(GS, rownames(GS)), function(x) if(is.matrix(x))

Re: [R] question

2012-02-15 Thread R. Michael Weylandt
But that's dropping unused factor levels, not the drop of `[` Michael On Wed, Feb 15, 2012 at 9:16 AM, David Winsemius dwinsem...@comcast.net wrote: On Feb 15, 2012, at 7:19 AM, R. Michael Weylandt wrote: Sorry about that -- forgot the case where you might only have a certain entry once:

Re: [R] question

2012-02-15 Thread peter dalgaard
On Feb 15, 2012, at 15:17 , R. Michael Weylandt wrote: But that's dropping unused factor levels, not the drop of `[` Is there a good reason that nobody has suggested looking at aggregate()? There would seem to be a little red tape to sort out, but, I mean, this is generally speaking what

Re: [R] Question scatterplot axis cut point

2012-02-14 Thread Jim Lemon
On 02/14/2012 06:19 AM, Michael Methlagl wrote: Hi everybody, i made a scatterplot using the command plot (datafile1, xlim=c(0,10), ylim=c(0.001, 1), log=y, xlab=x Achse, ylab=y Achse, frame.plot=FALSE, axes = TRUE). Now i have a problem. There is a gap between the x and the y axis. I want

Re: [R] question

2012-02-14 Thread R. Michael Weylandt
Perhaps something (untested) like sapply(split(x, rownames(x)), colSums) Next time it's suggested you use dput() to send your data. Michael On Tue, Feb 14, 2012 at 7:08 AM, Soheila Khodakarim lkhodaka...@gmail.com wrote: I have this matrix in R,   s1 s2 s3 s4 g1  1  0  0  0 g1  0  1  0  

Re: [R] question of merging two dataframes

2012-01-31 Thread Tal Galili
Hi there, The command for merging is: merge Can you please clarify by which variable you wish to merge by? Can you maybe use ?dput function in order to give a self contained R code example of your data - and the output you wish to get? Best, Tal Contact

Re: [R] question of merging two dataframes

2012-01-31 Thread Bert Gunter
On Tue, Jan 31, 2012 at 2:24 PM, Tal Galili tal.gal...@gmail.com wrote: Hi there, The command for merging is: merge A fortunes candidate? -- Bert Can you please clarify by which variable you wish to merge by? Can you maybe use ?dput function in order to give a self contained R code

Re: [R] question on simple graph

2012-01-31 Thread Christopher W. Ryan
Without knowing more about what you are trying to accomplish, and what you have tried so far (code) it's difficult to say. But I'll venture this: are you sure you need a graph? Seems like a table might suffice. BT - sample(1:5, 50, replace=TRUE) RA - sample(1:5, 50, replace=TRUE) table(BT)

Re: [R] question on simple graph

2012-01-31 Thread Jim Lemon
On 02/01/2012 08:13 AM, Rebecca Lisi wrote: I am having trouble generating a graph. I want to know the % of respondents who answered that they strongly agree or agree the America owes R's ethnic group a better chance (BTTRCHNC) and I want to organize it by racial group (RACESHRT). BTTRCHNC is

Re: [R] question on model.matrix

2012-01-30 Thread Paul Johnson
Greetings On Sat, Jan 28, 2012 at 2:43 PM, Daniel Negusse daniel.negu...@my.mcphs.edu wrote: while reading some tutorials, i came across this and i am stuck. i want to understand it and would appreciate if anyone can tell me. design - model.matrix(~ -1+factor(c(1,1,2,2,3,3))) can

Re: [R] question about ... questions/ code

2012-01-29 Thread R. Michael Weylandt
Perhaps I'm misunderstanding you, but it doesn't sound like this is much of an R question at all: what is the code book? If it's an actual (dead tree) book, I don't think there's much you can do in R to automate identifications; if it's an online API, you *might* be able to rig a matching

Re: [R] question about ... questions/ code

2012-01-29 Thread R. Michael Weylandt
- Original Message - From: R. Michael Weylandt michael.weyla...@gmail.com To: Nicole Marie Ford nmf...@uwm.edu Cc: r-help r-help@r-project.org Sent: Sunday, January 29, 2012 9:51:37 PM Subject: Re: [R] question about ... questions/ code Perhaps I'm misunderstanding you, but it doesn't

Re: [R] Question

2012-01-24 Thread Marc Schwartz
On Jan 24, 2012, at 11:17 AM, Taylor, Brian wrote: We were looking at conducting a pilot program with Dell to virtualize our lab environments. We are specifically looking at Dell/Citrix provisioning servers. The OS in this setup is streamed from the server on every boot. I was curious

Re: [R] question re. package playwith not able to run command getting error message that I'm attempting to use non function

2012-01-20 Thread R. Michael Weylandt
Hcan you give session info (after loading playwith)? I'm able to get that code to work...also -- can you get the basic RGtk functions (like gwindow() ) to work? Michael On Thu, Jan 19, 2012 at 5:28 PM, Farhat Maha mar...@gmail.com wrote: Hello, I managed to install playwith package and

Re: [R] question re. package playwith not able to run command getting error message that I'm attempting to use non function

2012-01-20 Thread Farhat Maha
Thanks for your reply Michael, gwindow() command does work. and here is my sessionInfo gwindow() guiWidget of type: gWindowRGtk for toolkit: guiWidgetsToolkitRGtk2 *(opens a window)* sessionInfo() R version 2.14.1 (2011-12-22) Platform: i486-pc-linux-gnu (32-bit) locale: [1]

Re: [R] question re. package playwith not able to run command getting error message that I'm attempting to use non function

2012-01-20 Thread R. Michael Weylandt
I can't replicate the problem on my system (OS X) and I don't know enough about the Gtk + tcltk frameworks to help diagnose it outside of R -- it might be worth working up a minimal (non-)working example along the lines of: michaelweylandt$ R --vanilla library(playwith) playwith(plot(1:10))

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])}

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

2012-01-13 Thread R. Michael Weylandt
Just put the columnname variable into the brackets as well: they accept strings. As a general rule, always use the brackets (single or double) when programming: `$` has some great features for interactive use but can bite if you're not careful. Michael On Fri, Jan 13, 2012 at 5:34 PM, Julia

Re: [R] question about R 2.15.0

2012-01-10 Thread Duncan Murdoch
On 10/01/2012 11:31 AM, Wang, Jing wrote: Dear Sir/Madam, I want to download R development version 2.15.0 source code. But I just found the version for windows and MacOS. So would you please give me some instruction about how can I download the R 2.15.0 source code? Thank you very much for

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] question about rev

2012-01-06 Thread 孟欣
Yes£¬I find out later. rev is only reverse the order. What I use is ! Thanks At 2012-01-06 16:07:11,Petr PIKAL petr.pi...@precheza.cz wrote: 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

Re: [R] question about rev

2012-01-06 Thread cvez
the function /rev / REVERSEs the order of the vector, as v= c(1,2,3) rev(v)= 3,2,1 if you want the opposite value , just add a exclamation in front of the vector: v=c(T,F,T,T); !v is F,T,F,F -- View this message in context: http://r.789695.n4.nabble.com/question-about-rev-tp4268518p4268716.html

Re: [R] Question about fitting seasonal ARIMA in R?

2011-12-11 Thread Michael
sorry for the re-post... On Sun, Dec 11, 2011 at 8:22 PM, Michael comtech@gmail.com wrote: Hi all, I just couldn't find a R function which can fit multiple seasonal patters... i.e. in the following code: *arima(x = data, order = c(p, d, q), seasonal = list(order = c(P, D, Q), period

Re: [R] question about spaces in r

2011-12-11 Thread Petr PIKAL
Hi First of all, it's R, not r, and on this mailing list people care about this kind of thing. Second, you will need to provide more information in order to get better help. Please read the posting guide. There are a number of introductory level documents available via CRAN, please

Re: [R] Question about comparison of nested models and F-statistics

2011-12-10 Thread Bert Gunter
This is not a statistical help list. Post to stats.stackexchange.com or a similar list to have someone tutor you in regression and explain why what you are doing is likely to produce utter nonsense. Or, better yet, get local statistical help in person. You also clearly need to do some reading on

Re: [R] question about spaces in r

2011-12-09 Thread MacQueen, Don
First of all, it's R, not r, and on this mailing list people care about this kind of thing. Second, you will need to provide more information in order to get better help. Please read the posting guide. There are a number of introductory level documents available via CRAN, please pick one and

Re: [R] question about plsr() results

2011-12-02 Thread Bjørn-Helge Mevik
Vytautas Rakeviius vytautas1...@yahoo.com writes: But still I have question about results interpretation. In the end I want to construct prediction function in form: Y=a1x1+a2x2 The predict() function does the prediction for you. If you want to construct the prediction _equation_, you can

Re: [R] Question about randomForest

2011-11-28 Thread Liaw, Andy
-project.org Subject: Re: [R] Question about randomForest Matthew, Your intepretation of calculating error rates based on the training data is incorrect. In Andy Liaw's help file err.rate-- (classification only) vector error rates of the prediction on the input data, the i-th element being

Re: [R] Question about randomForest

2011-11-27 Thread Matthew Francis
Thanks for the help. Let me explain in more detail how I think that randomForest works so that you (or others) can more easily see the error of my ways. The function first takes a random sample of the data, of the size specified by the sampsize argument. With this it fully grows a tree resulting

Re: [R] Question about randomForest

2011-11-27 Thread Ken
I am pretty sure that when each tree is fitted the error rate for tree 'i' is it's performance on the data which was not used to fit the ith tree (OOB). In this way cross validation is performed for each tree but I do not think that all trees fitted prior are involved in the computation of that

Re: [R] Question about randomForest

2011-11-27 Thread Weidong Gu
Matthew, Your intepretation of calculating error rates based on the training data is incorrect. In Andy Liaw's help file err.rate-- (classification only) vector error rates of the prediction on the input data, the i-th element being the (OOB) error rate for all trees up to the i-th. My

Re: [R] Question about randomForest

2011-11-26 Thread Weidong Gu
Hi Matthew, The error rate reported by randomForest is the prediction error based on out-of-bag OOB data. Therefore, it is different from prediction error on the original data since each tree was built using bootstrap samples (about 70% of the original data), and the error rate of OOB is likely

Re: [R] Question on density values obtained from kde2d() from package MASS

2011-11-24 Thread Prof Brian Ripley
On Thu, 24 Nov 2011, Andreas Klein wrote: Hello, I am a little bit confused regarding the density values obtained from the function kde2d() from the package MASS because the are not in the intervall [0,1] as I would expect them to be. Here is an Your expectation is wrong. example: x -

Re: [R] Question about package installation

2011-11-18 Thread R. Michael Weylandt michael.weyla...@gmail.com
I don't really know about the second half of your email, but are you sure you don't just need to reload the packages with the library() command rather than reinstalling them? It's also to set up autoload: google Rprofile for instructions. Michael On Nov 18, 2011, at 3:52 PM, Roger Coupal

Re: [R] Question about package installation

2011-11-18 Thread David Winsemius
On Nov 18, 2011, at 3:52 PM, Roger Coupal wrote: Hi, I am working with R on a Mac. I need to use a couple of packages that I found on the Web site. I install them using Packages and Data: Package Manager. I leave R and come back another time and the installed packages are not installed.

Re: [R] Question about linear regression in R

2011-11-15 Thread David Winsemius
On Nov 14, 2011, at 10:49 PM, Miles Yang wrote: Hi all, I wrote a r program as below: x - 1:10 y - c(3,3,3,3,3,3,3,3,3,3) fit - lm(log(y) ~ x) summary(fit) And I expect to get some error message from R, because y is constant. But, I got the message as below: You are asking R to tell

Re: [R] Question about linear regression in R

2011-11-15 Thread John Fox
Dear Miles, Within rounding error, you got the right intercept, log(3); slope, 0; residuals, all 0; residual standard error, 0; and standard errors of the intercept and slope, both 0. The R^2 should have been undefined (i.e., 0/0), but dividing one number that's 0 within rounding error by another

Re: [R] Question on exercise

2011-11-15 Thread Ben Bolker
Jan Kraner jan.kraner at gmx.ch writes: Dear Sir/Madam: Could you please help me with this exercise and how I could solve it in R?: Attachment (PastedGraphic-1.pdf): application/pdf, 84 KiB I especially have problems with the selection of the 40 datasets, once taken the 110 (because

Re: [R] Question on exercise

2011-11-15 Thread R. Michael Weylandt michael.weyla...@gmail.com
Copying David W from another thread: We don't do homework here. In fact, your instructor is probably watching. That said, try googling or, even better, using the rseek search. (Or even better-er RSiteSearch() in your terminal) Michael On Nov 15, 2011, at 4:16 PM, Jan Kraner jan.kra...@gmx.ch

Re: [R] Question about linear regression in R

2011-11-14 Thread R. Michael Weylandt
What exactly is it that's worrying you? It's a problematic regression for a few reasons, but ultimately it seems pretty ok, though I'd be ever so slightly worried about the R^2 value being misinterpreted. Michael On Mon, Nov 14, 2011 at 10:49 PM, Miles Yang miles2y...@gmail.com wrote: Hi all,

Re: [R] Question

2011-11-08 Thread David Winsemius
I suspect you are lost. This is almost certainly more appropriate on the BioConductor list. There are relatively few people on this list who will know what (un-named) packages you might be using. Read the Posting Guide, note the link to the Bioconductor mailing list page, configure your

Re: [R] Question about R mantissa and number of bits

2011-11-08 Thread Nordlund, Dan (DSHS/RDA)
I am not going through all of your code to understand what you are trying to demonstrate. R uses the IEEE Standard 754 for Floating Point Numbers. There is a sign bit, 11 bits for the exponent, and 52 bits for the mantissa. Because the standard normalizes the mantissa you get an extra bit of

Re: [R] Question about Calculation of Cross Product

2011-11-03 Thread R. Michael Weylandt
Try library(pracma) ? cross Michael Weylandt On Thu, Nov 3, 2011 at 1:17 AM, 阮铮 rz1...@foxmail.com wrote: The function of crossprod in R puzzled me. I would like to calculate the cross product of two vectors. According to my text book, it defines like this: a = (ax, ay, az) b = (bx, by,

Re: [R] Question about Calculation of Cross Product

2011-11-03 Thread Jeff Newmiller
The crossprod function in base R implements the MATRIX cross product, more familiarly known as matrix multiplication. --- Jeff Newmiller The . . Go Live... DCN:jdnew...@dcn.davis.ca.us Basics: ##.#. ##.#. Live Go...

Re: [R] Question about Calculation of Cross Product

2011-11-03 Thread Rolf Turner
On 04/11/11 11:30, Jeff Newmiller wrote: The crossprod function in base R implements the MATRIX cross product, more familiarly known as matrix multiplication. The term crossprod is thereby rather misleading, nicht wahr? Wouldn't it be *nice* to put into the help file a wee warning telling

Re: [R] Question on estimating standard errors with noisy signals using the quantreg package

2011-11-01 Thread Thorsten Vogel
21:24 An: Thorsten Vogel Cc: r-help@r-project.org help Betreff: Re: [R] Question on estimating standard errors with noisy signals using the quantreg package On Oct 31, 2011, at 7:30 AM, Thorsten Vogel wrote: Dear all, My question might be more of a statistics question than a question on R

Re: [R] Question on estimating standard errors with noisy signals using the quantreg package

2011-10-31 Thread Roger Koenker
On Oct 31, 2011, at 7:30 AM, Thorsten Vogel wrote: Dear all, My question might be more of a statistics question than a question on R, although it's on how to apply the 'quantreg' package. Please accept my apologies if you believe I am strongly misusing this list. To be very brief, the

Re: [R] question R regarding consecutive numbers

2011-10-28 Thread Samir Benzerfa
(1,3,4,9,1,9,1,5,4,5,2,1,1,1,6) Any ideas how to solve this problem? Cheers, S.B. -Ursprüngliche Nachricht- Von: David Winsemius [mailto:dwinsem...@comcast.net] Gesendet: Donnerstag, 27. Oktober 2011 16:44 An: Duncan Murdoch Cc: Samir Benzerfa; r-help@r-project.org Betreff: Re: [R] question R regarding

Re: [R] question R regarding consecutive numbers

2011-10-28 Thread William Dunlap
-project.org Subject: Re: [R] question R regarding consecutive numbers In the general case, there is still a gap in your solution sum( tbl[1, 2:ncol(tbl)] ). This solution refers to a specific column number (here: column number 2) and not to the actual length of the run, doesn't

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