Re: [R] Running R with browser without installing anything

2011-10-22 Thread Jörg Reuter
Thank for this hint. I installed RStudio and it in the night and test it few hour. It is a great tool. Jörg Am 20.10.2011 22:43 schrieb Liviu Andronic landronim...@gmail.com: On Thu, Oct 20, 2011 at 7:29 PM, Bogaso Christofer bogaso.christo...@gmail.com wrote: Dear all, the company I work

[R] How to it a loess curve and obtain the equation in R?

2011-10-22 Thread ali_protocol
Hi! How can I fit a loess curve to an array (384 x 2). How can I obtain the equation for thi fi? Thanks in advance. -- View this message in context: http://r.789695.n4.nabble.com/How-to-it-a-loess-curve-and-obtain-the-equation-in-R-tp3927622p3927622.html Sent from the R help mailing list

Re: [R] How to it a loess curve and obtain the equation in R?

2011-10-22 Thread Bert Gunter
On Fri, Oct 21, 2011 at 11:33 PM, ali_protocol mohammadianalimohammad...@gmail.com wrote: Hi! How can I fit a loess curve to an array (384 x 2). Read and follow the instructions in ?loess. How can I obtain the equation for thi fi? You can't. There is none. Google on loess for details.

Re: [R] Calculating differences

2011-10-22 Thread Jeffrey Joh
Great! Thank you! With the data, I would like to make a scatter plot with speed on the x-axis and C differences on the y-axis, with a different color to represent different dates. There are over 50 different dates, so I want 50 different colors on a single plot. How can I make this

[R] Does R has a similar way as DATA in SPSS?

2011-10-22 Thread Jinsong Zhao
Hi there, In SPSS, small piece of data can be input as following: DATA LIST LIST /x1 x2 x3 x4 x5 . BEGIN DATA 5700 12.8 2500 270 25000 1000 10.9 600 10 1 3400 8.8 1000 10 9000 3800 13.6 1700 140 25000 4000 12.8 1600 140 25000 8200 8.3 2600 60 12000 1200 11.4 400

[R] lapply to return vector

2011-10-22 Thread Alaios
Dear all I have wrote the following line return(as.vector(lapply(as.data.frame(data),min,simplify=TRUE))); I want the lapply to return a vector as it returns a list with elements as shown below List of 30001 $ V1: num -131 $ V2: num -131 $ V3: num -137 $ V4: num -129 $ V5

Re: [R] Does R has a similar way as DATA in SPSS?

2011-10-22 Thread Jorge I Velez
Hi Jinsong, You can try d - read.table(textConnection(5700 12.8 2500 270 25000 + 1000 10.9 600 10 1 + 3400 8.8 1000 10 9000 + 3800 13.6 1700 140 25000 + 4000 12.8 1600 140 25000 + 8200 8.3 2600 60 12000 + 1200 11.4 400 10 16000 + 9100 11.5 3300 60 14000 + 9900 12.5 3400

[R] setMethod [ - extract by names within Slot

2011-10-22 Thread Omphalodes Verna
Hi R-helper! I have problem with setMethods for [. Here is example : setClass(myClass, representation(ID.r = numeric, ID.c = character, DAT = matrix)) to.myClass - function(ID.r, ID.c, DAT) {     out - new(myClass, ID.r = ID.r, ID.c = ID.c, DAT = DAT)     return(out)   }  

Re: [R] lapply to return vector

2011-10-22 Thread Dennis Murphy
do.call(rbind, lapply(...)) HTH, D. On Sat, Oct 22, 2011 at 1:44 AM, Alaios ala...@yahoo.com wrote: Dear all I have wrote the following line return(as.vector(lapply(as.data.frame(data),min,simplify=TRUE))); I want the lapply to return a vector as it returns a list with elements as shown

Re: [R] question about aggregate

2011-10-22 Thread Adel ESSAFI
Hello, is there any help please. Regards 2011/10/21 Adel ESSAFI adeless...@gmail.com Hello I am discovering R and I find it is really very powerful. However, I find some newbie difficulties. Here, I have a data frame with manu values that I want to calculate the frequency (the nomber of

[R] FW: Survival analysis

2011-10-22 Thread Cem Girit
Hello Sarah and David, Thank you for your help. I followed your advice and suggestions. But I still have problems with the R-results: 1) Mean Survival Time and the Error of the Mean: The mean survival time calculation is not just taking the average of the survival

[R] Data frame manipulation by eliminating rows containing extreme values

2011-10-22 Thread aajit75
Dear All, I have got the limits for removing extreme values for each variables using following function . f=function(x){quantile(x, c(0.25, 0.75),na.rm = TRUE) - matrix(IQR(x,na.rm = TRUE) * c(1.5), nrow = 1) %*% c(-1, 1)} #Example: n - 100 x1 - runif(n) x2 - runif(n) x3 - x1 + x2 +

[R] Fwd: question about aggregate

2011-10-22 Thread Adel ESSAFI
Hello, is there any help please. Regards 2011/10/21 Adel ESSAFI adeless...@gmail.com Hello I am discovering R and I find it is really very powerful. However, I find some newbie difficulties. Here, I have a data frame with manu values that I want to calculate the frequency (the nomber of

Re: [R] R v2.13.2 - Cannot find Rcmd on path?

2011-10-22 Thread Duncan Murdoch
On 11-10-21 8:40 PM, Joshua Wiley wrote: Hi Hardy, I would double check the PATH variable in Windows. You can check it through the control panel, command prompt, or PowerShell. If the correct path to R is not included, you will need to edit it (the PATH environment variable). I do not know

Re: [R] Plotting text?

2011-10-22 Thread Eik Vettorazzi
Hi Kevin, have a look at ?textplot from the gplots-package. cheers Am 22.10.2011 02:26, schrieb rkevinbur...@charter.net: I noticed that the text() command adds text to a plot. Is there a way to either make the plot blank or add text to a blank sheet. I would like to plot a page that

Re: [R] question about aggregate

2011-10-22 Thread Weidong Gu
try this table(sci[,2]=0,sci[,1]=L) Weidong Gu On Sat, Oct 22, 2011 at 7:51 AM, Adel ESSAFI adel.s...@imag.fr wrote: Hello, is there any help please. Regards 2011/10/21 Adel ESSAFI adeless...@gmail.com Hello I am discovering R and I find it is really very powerful. However, I find

Re: [R] question about aggregate

2011-10-22 Thread Adel ESSAFI
Hi, It is not what I want, but, thx anyway. Regards 2011/10/22 Weidong Gu anopheles...@gmail.com try this table(sci[,2]=0,sci[,1]=L) Weidong Gu On Sat, Oct 22, 2011 at 7:51 AM, Adel ESSAFI adel.s...@imag.fr wrote: Hello, is there any help please. Regards 2011/10/21 Adel

Re: [R] Segfault and bad output with fOptions::rnorm.sobol

2011-10-22 Thread Robert McDonald
On Sat, Oct 22, 2011 at 2:45 AM, Patrick Burns pbu...@pburns.seanet.comwrote: This should really go to Rmetrics since it is a bug in their code. You could find out more specifically where the problem is by running it under valgrind. First you have to have valgrind, then start R with it:

Re: [R] Segfault and bad output with fOptions::rnorm.sobol

2011-10-22 Thread Ben Bolker
Robert McDonald rmcd1024 at gmail.com writes: I have had the following problem with R 2.10, 2.13.1, and 2.13.2, running on Ubuntu linux 10.04, xubuntu 11.10, and a version of Redhat (I think 5). rnorm.sobol is producing impossible random values, and occasionally the routine crashes. Here are

Re: [R] question about aggregate

2011-10-22 Thread R. Michael Weylandt
Perhaps I misunderstand your request, but isn't this just: sum( (sci[,,2]==0L) (sci[,1] ==L)) with the usual floating point caveats. Michael On Sat, Oct 22, 2011 at 8:19 AM, Adel ESSAFI adeless...@gmail.com wrote: Hi, It is not what I want, but, thx anyway. Regards 2011/10/22 Weidong Gu

Re: [R] question about aggregate

2011-10-22 Thread Weidong Gu
Is this waht you want? sci[,5][sci[,2]==0 sci[,1]==L] Weidong On Sat, Oct 22, 2011 at 8:19 AM, Adel ESSAFI adeless...@gmail.com wrote: Hi, It is not what I want, but, thx anyway. Regards 2011/10/22 Weidong Gu anopheles...@gmail.com try this table(sci[,2]=0,sci[,1]=L) Weidong Gu

Re: [R] question about aggregate

2011-10-22 Thread Adel ESSAFI
NO aggregate(si[,7],list(si[,2],si[,1]),mean) Group.1 Group.2 x 1 0.0 D 212.5015448 2 0.2 D 200.5271137 3 0.4 D 191.5387529 4 0.6 D 131.5856218 5 0.8 D 16.4515798 6 1.0 D 0.9698699 7 0.0 F 211.6176036 8

Re: [R] question about aggregate

2011-10-22 Thread Adel ESSAFI
2011/10/22 Adel ESSAFI adel.s...@imag.fr NO aggregate(si[,7],list(si[,2],si[,1]),mean) Group.1 Group.2 x 1 0.0 D 212.5015448 2 0.2 D 200.5271137 3 0.4 D 191.5387529 4 0.6 D 131.5856218 5 0.8 D 16.4515798 6 1.0

Re: [R] question about aggregate

2011-10-22 Thread Weidong Gu
Thanks for providing the example data, try this aggregate(si[,7],list(si[,2],si[,1]),function(x) sum(table(x))) Weidong On Sat, Oct 22, 2011 at 9:28 AM, Adel ESSAFI adel.s...@imag.fr wrote: NO aggregate(si[,7],list(si[,2],si[,1]),mean)    Group.1 Group.2   x 1  0.0   D

Re: [R] setMethod [ - extract by names within Slot

2011-10-22 Thread Martin Morgan
On 10/22/2011 02:11 AM, Omphalodes Verna wrote: Hi R-helper! I have problem with setMethods for [. Here is example : setClass(myClass, representation(ID.r = numeric, ID.c = character, DAT = matrix)) to.myClass- function(ID.r, ID.c, DAT) { out- new(myClass, ID.r = ID.r, ID.c = ID.c, DAT

Re: [R] Data frame manipulation by eliminating rows containing extreme values

2011-10-22 Thread David Winsemius
On Oct 22, 2011, at 6:57 AM, aajit75 wrote: Dear All, I have got the limits for removing extreme values for each variables using following function . f=function(x){quantile(x, c(0.25, 0.75),na.rm = TRUE) - matrix(IQR(x,na.rm = TRUE) * c(1.5), nrow = 1) %*% c(-1, 1)} I think you need

Re: [R] spi in SPEI package

2011-10-22 Thread Peter Maclean
I am using the package SPEI to estimate SPI (using spi function) for different locations. My data have many zeroes for the months of May, June and July. How does spi function handle the zeroes especially for the gamma distributio?   The reason I am asking I am getting the follwing error.   Error

Re: [R] Arima Models - Error and jump error

2011-10-22 Thread John C Nash
The error is what it says: Your program has asked for an approximation to a derivative (you, or whoever wrote the package you are using, didn't provide an analytic gradient, so it's using an approximation), and the result was returned Inf. This is VERY common -- the BFGS option of optim() is a

[R] interpreting bootstrap corrected slope [rms package]

2011-10-22 Thread Adam
Dear List: Below is the validation output of a fitted ordinal logistic model using the bootstrap in the rms package. My interpretation is that most of the corrected indices indicate little overfitting, however the slope seems to indicate that the model is too optimistic. Given that most of the

Re: [R] setMethod [ - extract by names within Slot

2011-10-22 Thread Omphalodes Verna
Thanks Martin. Here is my ''updated'' code. setClass(myClass, representation(ID.r = numeric, ID.c = character, DAT = matrix)) to.myClass - function(ID.r, ID.c, DAT) {     out - new(myClass, ID.r = ID.r, ID.c = ID.c, DAT = DAT)     return(out)       }       setMethod([, myClass,

Re: [R] How to use gev.fit (package ismev) under box constraints?

2011-10-22 Thread John C Nash
You've identified a problem with the ismev package and it really is the package maintainers who are in the best position to fix it. As noted, box constraints (lower and upper) go OUTSIDE the control=list(). (Only L-BFGS-B has bounds in optim().) This is also the case for many routines called by

[R] OFFTOPIC: Outliers?!

2011-10-22 Thread Bert Gunter
Folks: To those of you who use and, worse yet, believe in the scientific validity of outliers, I commend to you the following: http://www.sciencenews.org/view/feature/id/335383/title/Beware_the_Long_Tail If you wish to condemn or argue with me about this, PLEASE REPLY PRIVATELY, as this is

Re: [R] question about aggregate

2011-10-22 Thread Adel ESSAFI
Thank you I works as I need. aggregate(tmp[,5],list(tmp[,2],tmp[,1]),function(x) sum(table(x))) Group.1 Group.2 x 1 0.0 D 100 2 0.2 D 100 3 0.4 D 100 4 0.6 D 72 5 0.8 D 9 2011/10/22 Weidong Gu anopheles...@gmail.com Thanks for

[R] error on Fast bilinear interpolator from a grid

2011-10-22 Thread Parichat Wetchayont
Dear all, I'm new user of R package. I'm trying to interpolate climate variables from ERA data. Original data contains 6 column with 29,040 lines, and x, y dimension are 240x121. I would like to get new data from column name: lon, lat and temp by x, y dimension are 3,586x1,800 So I used the

Re: [R] interpreting bootstrap corrected slope [rms package]

2011-10-22 Thread Frank Harrell
Adam - the very low amount of optimism suggests that you have a large sample size and that your model was completely pre-specified. If you did any feature/variable selection or made any model changes in a way that was not blinded to Y then you are not using the software correctly. But you are

Re: [R] glm-poisson fitting 400.000 records

2011-10-22 Thread Uwe Ligges
On 21.10.2011 23:14, Ken wrote: Your memory shouldn't be capped there, Where? You cannot know from the output below. try ?memory.size and ?memory.limit. Background less things. Good luck, Ken Hutchison On Oct 21, 2554 BE, at 11:57 AM, D_Tomastomasm...@hotmail.com wrote: My

[R] covariance matrix of model parameters

2011-10-22 Thread rahul.chhabra
I am applying a hidden markov model on joint multivariate gaussian distribution for 2 vectors. I am using the depmixS4 package in R. Specifically, I am using the following code: mod-depmix(list(response = mom ~ mkt + p0 + p1, mkt~1), data = regvar, nstates = 2, family = list(gaussian(),

Re: [R] Reading in and modifying multiple datasets in a loop

2011-10-22 Thread Uwe Ligges
On 21.10.2011 23:32, Debs Majumdar wrote: Hi, I have been given a set of around 300 files where there are 5 files corresponding to each chunk. E.g. Chunk 1 for chr1 contains these 5 files: chr1.one.phased.impute2.chunk1 chr1.one.phased.impute2.chunk1_info

[R] LK - Need help about a double looping for a data.frame

2011-10-22 Thread KOITA Lassana DGAC/STAC
__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

[R] linking options -lblas

2011-10-22 Thread jgarcia
Hi all, I want to install some packages in R in a computer where I haven't root privilegues, and R is already installed. The system manager is extremely busy and at the moment I'm afraid that I have to manage my own installations. So, I am trying to install 'quadprog' and I'm getting the message:

[R] cycling through a long list of files and names

2011-10-22 Thread Wet Bell Diver
R2.13.2, W7x64 Dear list, Excuse my ignorance, but I have gone through the R help (?parse, ?eval, etc.) and still really don't know how to do the following. I have the general following structure that I would like to automate [edited to make it shorter]: city1997 -

[R] Help w/an old R program I've rediscovered and want to make work

2011-10-22 Thread pce369
I found an old R program I wrote som eyears back and I'd like to make work in 2.11.1 (or a more recent version), but am having two problems: 1. I can't seem to access the datafile it requires. I'm not sure where the default place that R looks to for files references within it is, or what exactly

Re: [R] estimation of ode from data

2011-10-22 Thread Ben Bolker
Vassily Shvets shv736 at yahoo.com writes: I'm used to working with R in estimation of distributions and statistical models. I'd like to estimate a simple model of an output y(t) based on a concentration as independent variable, using a timed series of experimental data; I've seen this I

[R] problem with as.Date

2011-10-22 Thread Martin Spindler
Dear all, I would like to convert the first column of a dataframe to a date (original format: year (4 digits) and month (last 2 digits)) str(dat_FF) 'data.frame': 1022 obs. of 4 variables: $ date : int 192607 192608 192609 192610 192611 192612 192701 192702 192703 192704 ... $ Rm.Rf: num

Re: [R] Help w/an old R program I've rediscovered and want to make work

2011-10-22 Thread Barry Rowlingson
On Sat, Oct 22, 2011 at 8:41 PM, pce369 pce...@hotmail.com wrote: I found an old R program I wrote som eyears back and I'd like to make work in 2.11.1 (or a more recent version), but am having two problems: 1. I can't seem to access the datafile it requires. I'm not sure where the default

Re: [R] cycling through a long list of files and names

2011-10-22 Thread R. Michael Weylandt michael.weyla...@gmail.com
The more R way to do something like this is to put all your dataframes into a list and then run lappy(cityList, dataCleaning) # for example To get them into a list in the first place try this n = 1997:2011 cityList - vector(length(n), 'list') for (i in n){ cityList[[i]] - get(paste(city,

Re: [R] problem with as.Date

2011-10-22 Thread R. Michael Weylandt michael.weyla...@gmail.com
Untested, try this: as.Date(as.character(dat_FF$date), format = %Y%m) If that doesn't work, let me know. Michael On Oct 22, 2011, at 4:26 PM, Martin Spindler martin.spind...@gmx.de wrote: Dear all, I would like to convert the first column of a dataframe to a date (original format: year

Re: [R] problem with as.Date

2011-10-22 Thread Duncan Murdoch
On 11-10-22 4:26 PM, Martin Spindler wrote: Dear all, I would like to convert the first column of a dataframe to a date (original format: year (4 digits) and month (last 2 digits)) str(dat_FF) 'data.frame': 1022 obs. of 4 variables: $ date : int 192607 192608 192609 192610 192611

[R] simplified multicore by() function

2011-10-22 Thread ivo welch
dear R readers---I thought I would post the following snippet of R code that makes by() like operations easier and faster on multicore machines for R novices and amateurs. I hope it helps some. YMMV. feel free to ignore. PS: I wish R had a POD-like documentation system for end users that are

Re: [R] Help w/an old R program I've rediscovered and want to make work

2011-10-22 Thread pce369
Hi Barry, and thanks very, very much for your comments. OK, I think I've resolved the issue of where the file is, as the program runs...and then dies. The error message I am getting now is: Error in tapply(MCP, MCPsplitlist, MCPfunction) : arguments must have same length No idea what this

Re: [R] problem with as.Date

2011-10-22 Thread Gabor Grothendieck
On Sat, Oct 22, 2011 at 4:26 PM, Martin Spindler martin.spind...@gmx.de wrote: Dear all, I would like to convert the first column of a dataframe to a date (original format: year (4 digits) and month (last 2 digits)) str(dat_FF) 'data.frame':   1022 obs. of  4 variables:  $ date : int  

[R] Using optim with parameters that are factors (instead of continuous parameters)

2011-10-22 Thread Lucas Merrill Brown
I've been programming maximum likelihood estimation models using the function optim. My current research requires modeling a particular parameter as a categorical variable (what R calls a factor), not as a continuous parameter. (The research question is, at what level of X does a subject in our

[R] Expanding rows of a data frame into multiple rows

2011-10-22 Thread Peter Meilstrup
The setup: I have a data frame where one column is in list mode, and each entry contains a vector of varying length. I want to expand this into a data frame with one row for each member of the list-mode column (the other values being replicated) For example, an example input and the desired

[R] issue loading doBy library

2011-10-22 Thread Giovanni Azua
Hello, How can I fix this? I have the latest version of R 2.13.2 and I use Mac OS X 10.7.2 library(doBy) Loading required package: lme4 Error in dyn.load(file, DLLpath = DLLpath, ...) : function 'cholmod_l_start' not provided by package 'Matrix' Error: package 'lme4' could not be loaded

[R] R for loop stops after 4 iterations

2011-10-22 Thread Philip Robinson
I have a data frame called e, dim is 27,3, the first 5 lines look like this: V1 V2 V3V4 1 1673 0.36 0.08 Smith 2 167 0.36 0.08 Allen 399 0.37 0.06 Allen 4 116 0.38 0.07 Allen 595 0.41 0.08 Allen I am trying to calculate the

Re: [R] Using optim with parameters that are factors (instead of continuous parameters)

2011-10-22 Thread Ben Bolker
Lucas Merrill Brown lucas.merrill.brown at gmail.com writes: I've been programming maximum likelihood estimation models using the function optim. My current research requires modeling a particular parameter as a categorical variable (what R calls a factor), not as a continuous parameter.

Re: [R] Help w/an old R program I've rediscovered and want to make work

2011-10-22 Thread Rolf Turner
On 23/10/11 09:56, pce369 wrote: Hi Barry, and thanks very, very much for your comments. OK, I think I've resolved the issue of where the file is, as the program runs...and then dies. The error message I am getting now is: Error in tapply(MCP, MCPsplitlist, MCPfunction) : arguments must have

Re: [R] R for loop stops after 4 iterations

2011-10-22 Thread R. Michael Weylandt
There's a seeming inconsistency in this question -- namely, you provide an example of a data frame with 4 columns but say it is 27x3 -- but I think your question comes from a misunderstanding of what length(e) calculates. For a data frame it gives the number of columns back. Hence if you have a

Re: [R] R for loop stops after 4 iterations

2011-10-22 Thread R. Michael Weylandt
Oops!! Meant pnorm(, lower.tail = FALSE) -- don't do qnorm or bad things will happen. Sorry, Michael On Sat, Oct 22, 2011 at 8:28 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: There's a seeming inconsistency in this question -- namely,  you provide an example of a data frame with

Re: [R] R for loop stops after 4 iterations

2011-10-22 Thread Duncan Murdoch
On 11-10-22 7:33 PM, Philip Robinson wrote: I have a data frame called e, dim is 27,3, the first 5 lines look like this: V1 V2 V3V4 1 1673 0.36 0.08 Smith 2 167 0.36 0.08 Allen 399 0.37 0.06 Allen 4 116 0.38 0.07 Allen 595 0.41 0.08 Allen

Re: [R] Expanding rows of a data frame into multiple rows

2011-10-22 Thread Weidong Gu
This may work obs.l-sapply(input$observations,length) desire.output-data.frame(site=rep(1:6,obs.l),obs=unlist(input$observations)) Weidong Gu On Sat, Oct 22, 2011 at 7:51 PM, Peter Meilstrup peter.meilst...@gmail.com wrote: The setup: I have a data frame where one column is in list mode, and

Re: [R] issue loading doBy library

2011-10-22 Thread Jeff Newmiller
I'll hazard a guess that perhaps you should update your installed packages. However, you ought to read the posting guide and provide the suggested information if you want better answers. --- Jeff Newmiller The . . Go

Re: [R] issue loading doBy library

2011-10-22 Thread Joshua Wiley
Hi Giovanni, This is a dependency issue between lme4 and Matrix. There is substantial discussion of this on the R sig mixed models list. A simple update may fix the problem, or you may need to be a little bit more precise about getting version of Matrix and lme4 that work with each other. HTH,

Re: [R] cycling through a long list of files and names

2011-10-22 Thread R. Michael Weylandt
A small clarification: the correct syntax would have been vector(list, length(n)) Michael On Sat, Oct 22, 2011 at 4:29 PM, R. Michael Weylandt michael.weyla...@gmail.com michael.weyla...@gmail.com wrote: The more R way to do something like this is to put all your dataframes into a list and

Re: [R] cycling through a long list of files and names

2011-10-22 Thread Joshua Wiley
Or simplify things down: cityList - mget(paste(city, 1997:2011, sep = ''), envir = .GlobalEnv) mget returns a list, all in one step. Cheers, Josh On Sat, Oct 22, 2011 at 6:19 PM, R. Michael Weylandt michael.weyla...@gmail.com wrote: A small clarification: the correct syntax would have been

Re: [R] cycling through a long list of files and names

2011-10-22 Thread R. Michael Weylandt
I had no idea mget() existed. How helpful! Thanks, MW On Sat, Oct 22, 2011 at 9:27 PM, Joshua Wiley jwiley.ps...@gmail.com wrote: Or simplify things down: cityList - mget(paste(city, 1997:2011, sep = ''), envir = .GlobalEnv) mget returns a list, all in one step. Cheers, Josh On Sat,

[R] R Data Frame to C# DataGridView - R.NET

2011-10-22 Thread swonder03
This is more of a C# question, but it has to do with the conversion of a data frame using R.NET into an appropriate format to display on a C# DataGridView. My code is as follows (focusing on the button_Click) /private void button_displayDF_Click(object sender, EventArgs e) {

Re: [R] Expanding rows of a data frame into multiple rows

2011-10-22 Thread Tyler Rinker
To further Weidong Gu's suggestion merge would give you what you want but not the numeric column corresponding to the sector. Adding that would be easy enough via transform if you really desired it. Tyler obs.l-sapply(input$observations,length)

Re: [R] R Data Frame to C# DataGridView - R.NET

2011-10-22 Thread swonder03
I should note that the form is compiling in C# but upon clicking the button nothing happens to the dataGridView. -- View this message in context: http://r.789695.n4.nabble.com/R-Data-Frame-to-C-DataGridView-R-NET-tp3929413p3929415.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] R for loop stops after 4 iterations

2011-10-22 Thread Dennis Murphy
Hi: Here are a couple of ways, using the data snippet you provided as the input data frame e. Start by defining the function, which outputs a percentage: f - function(n, mean, sd) { s - rnorm(n, mean = mean, s = sd) round(100 * sum(s 0.42)/length(s), 4) } (1) Use the plyr package

Re: [R] Expanding rows of a data frame into multiple rows

2011-10-22 Thread Dennis Murphy
Here's another approach using the plyr package: # Function to process each row of input: g - function(d) { y - unlist(d$observations) if(length(y) 0) data.frame(site = d$site, sector = d$sector, y = y) else NULL } library('plyr') ddply(input, .(site), g) site sector y 1