Re: [R] y needing more than 2 functions

2012-03-26 Thread Rolf Turner
Another approach: foo <- function(t){ bm <- ceiling(t/15) s <- cut(t,breaks=15*(0:bm),labels=1:bm) s <- as.numeric(levels(s)[s]) t^(s+1) } This idea can be generalised . cheers, Rolf Turner On 27/03/12 15:31, R. Michael Weylandt wrot

[R] Plot of function seems to cut off near edge of domain

2012-03-26 Thread chad.mills
Hello helpful R folks, I am simply trying to graph a quarter circle centered at the origin in the first quadrant. When I set the xlim of the plot to the radius of the circle, the plot appears correct. However, I'd like to see a slight extension of the axes beyond the domain of the function itself

[R] help in replacing for llop

2012-03-26 Thread arunkumar1111
Hi I have records like like this X1 X2 State 34 72 state1 9 63 state1 49 31 state1 60 34 state1 80 73 state1 60 20 state2 59 87 state2 88 20 state2 71 66 state2 65 56 state2 59 16

Re: [R] (no subject)

2012-03-26 Thread James Muller
AJ: This is something to learn a lesson from. A question, starved of preparation, can't help anybody to help you. James On Mar 25, 2012 9:00 PM, "Rolf Turner" wrote: > On 26/03/12 00:18, Anjana Thampi wrote: > >> How do you decompose inequality in R, say by gender? >> >> > This has to be one of

Re: [R] circles()

2012-03-26 Thread Peter Ehlers
On 2012-03-26 05:09, John D. Muccigrosso wrote: I cannot for the life of me figure this out: What's the parameter to fill in with color circles made with circles()? col changes the line color, but all I see in the help is a reference to "additional graphic parameters", and no examples via goog

Re: [R] Convex optimization in R ?

2012-03-26 Thread Steve Lianoglou
Hi, On Mon, Mar 26, 2012 at 6:46 PM, nserdar wrote: > Hi > > I should stochastic receding control process for portfolio > > optimization, so that I need a convex optimisation package > > in R . > > Please let me know if  any package is available for convex optimisation > packages. This is probab

Re: [R] y needing more than 2 functions

2012-03-26 Thread R. Michael Weylandt
One way is to simply nest your ifelse()s: y <- ifelse(t < 15, t^2, ifelse(t < 30, t^3, t^4)) Michael On Mon, Mar 26, 2012 at 7:48 PM, Aimee Jones wrote: > Dear all, > > I'm aware if y has two separate functions (depending on the conditions > of x) you can use the ifelse function to separate y i

Re: [R] re-arranging rows in data frame

2012-03-26 Thread R. Michael Weylandt
library(reshape2) x <- structure(list(ExpName = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L), .Label = c("MM1-x1", "MM1-X2", "MMX-X3"), class = "factor"), Identifier = structure(c(1L, 2L, 3L, 4L, 1L, 2L, 4L, 1L, 2L), .Label = c("GSK", "GSK2", "GSK3", "GSK4"), class = "factor"), valu

[R] sampling matrix 1 conditional on values in matrix 2

2012-03-26 Thread John.Morrongiello
Hi I am trying to estimate bottom temperatures over a particular depth range, based on one dataset containing synthetic temperature profiles (for set depths) and another that contains information on bathymetry. I need to do this for multiple regions and thus would ideally like an automated solut

[R] Convex optimization in R ?

2012-03-26 Thread nserdar
Hi I should stochastic receding control process for portfolio optimization, so that I need a convex optimisation package in R . Please let me know if any package is available for convex optimisation packages. Regards, Serdar -- View this message in context: http://r.789695.n4.nabble.c

[R] y needing more than 2 functions

2012-03-26 Thread Aimee Jones
Dear all, I'm aware if y has two separate functions (depending on the conditions of x) you can use the ifelse function to separate y into two separate functions depending on input. How do you do this if there a multiple different conditions for x? for example, y fits the following between t>0 &

Re: [R] Updating a Markov Chain

2012-03-26 Thread stivi
Thank you for your insights, to give a little more background on what i am looking for: -I am trying to handle large sets of data (between 20 000 to 50 000) entries, but the number of distinct values is very low (maybe 20 - 30, 50 in extreme cases). Hence handling of data should be as automated a

[R] re-arranging rows in data frame

2012-03-26 Thread Srinivas Iyyer
Hi: sorry for asking simple question (not simple for me though). I have a data frame something like this: ExpName Identifier value MM1-x1 GSK 0.02 MM1-x1 GSK2 0.001 MM1-x1 GSK3 0.04 MM1-x1 GSK4 0.1 MM1-X2 GSK 0.4 MM1-X2 GSK2 0.1 MM1-X2 GSK4 0.002 MMX-X3 GSK 0.4 MMX-X3 GSK2 0.23 I am

Re: [R] read.csv and field containing single quotes

2012-03-26 Thread Henrique Dallazuanna
Benilton, Try this: read.table(textConnection(gsub('","', "','", gsub('^\"|\"$', "'", readLines('../teste.csv', sep = ',', quote = "'", header = TRUE) On Mon, Mar 26, 2012 at 8:09 PM, Benilton Carvalho wrote: > I need to read in csv files, created by 3rd party, with fields > containing sing

Re: [R] Seeming failure of options(width=60) -- summary

2012-03-26 Thread John C Nash
While not having a perfect solution, I have made enough progress to be able to declare "good enough", thanks in particular to Duncan Murdoch and Yihui Xie. First, the font can be made smaller so output fits on a line and does not overflow the margins. This is accomplished by putting the command

[R] read.csv and field containing single quotes

2012-03-26 Thread Benilton Carvalho
I need to read in csv files, created by 3rd party, with fields containing single quotes (as shown below). "header1","header2","header3","header4" "field1r1","field2r1","field3r1","field4r1" "field1r2","field2r2","field3r2PartA), field3r2PartB Very" Long","field4r2" "field1r3","field2r3","field3r3"

[R] assigning vector or matrix sparsely (for use with mclapply)

2012-03-26 Thread ivo welch
Dear R wizards--- I have a wrapper on mclapply() that makes it a little easier for me to do multiprocessing. (Posting this may make life easier for other googlers.) I pass a data frame, a vector that tells me what rows should be recomputed, and the function; and I get back a vector or matrix of

Re: [R] Export Created Variables to SPSS/.csv

2012-03-26 Thread David Winsemius
On Mar 26, 2012, at 1:59 PM, Strassburger, Daniel wrote: I haven't been successful in converting my colleagues to the world of R yet they wish to share collected data so that they may analyze it in SPSS. I know how to write to an SPSS file and it opens fine, but my problem is that it onl

Re: [R] How to find best parameter values using deSolve n optim() ?

2012-03-26 Thread Thomas Petzoldt
Hi Himanshu, the use of optim is described on its help page. In addition to this package FME provides additional functionality for fitting ODE models. See FME help files, package vignettes and the example below for details. Hope it helps Thomas Petzoldt

Re: [R] Seeming failure of options(width=60)

2012-03-26 Thread Yihui Xie
knitr gives you full power to do whatever you want with the output, so you can use all sorts of LaTeX environments or packages to customize your output. For example, in this case, I think listings may be helpful; it has an option breaklines=true which allows you to break lines. Here is a minimal e

Re: [R] Completely Off Topic:Link to IOM report on use of "-omics" tests in clinical trials

2012-03-26 Thread Iain Gallagher
I followed this case while it was ongoing. It was a very interesting example of basic mistakes but also (for me) of journal politicking. Keith Baggerly and Kevin Coombes wrote a great paper - "DERIVING CHEMOSENSITIVITY FROM CELL LINES: FORENSIC BIOINFORMATICS AND REPRODUCIBLE RESEARCH IN H

Re: [R] writing output directly to file; sink?

2012-03-26 Thread Diann Prosser
Sorry- I was so excited it was working that I didn't see your reply: "What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it." Answer is that I was trying to figure out the most efficient way (mainly in time moreso than physical space) to save my o

Re: [R] writing output directly to file; sink?

2012-03-26 Thread Diann Prosser
Testing it on the full 1000 simulations: -used 54GB RAM. -after saving then removing - using rm() - the memory usage did decrease significantly. -I guess my test run was too small to show a noticeable difference. -thanks again. -- View this message in context: http://r.789695.n4.nabble.com/writi

Re: [R] writing output directly to file; sink?

2012-03-26 Thread jim holtman
'sink' would probably not help since it is just capturing output to the console and you are still doing the binary to character conversion. 'save' helps to avoid that. You might want to see if there is any difference with using compression (which I think is the default for 'save') as opposed to w

Re: [R] writing output directly to file; sink?

2012-03-26 Thread Diann Prosser
And to answer your question, Jim, " Are you just going to read it back into R for processing? if so 'save' will probably be faster." Yes, that is my intent. This is a great solution - infinitely better than the writing I was trying to do. -- View this message in context: http://r.789695.n4.nab

Re: [R] Error during wrapup: incorrect number of dimensions

2012-03-26 Thread Peter Ehlers
On 2012-03-26 12:57, Sam Steingold wrote: when subsetting a matrix results in a single row, it is converted to a vector, not a matrix. how do I avoid this? Check ?"[" and note the 'drop=' argument. Peter Ehlers 1. __GOOD__ edges<- get.edges(g,E(g)) edges [,1] [,2] [1,]02

Re: [R] Error during wrapup: incorrect number of dimensions

2012-03-26 Thread Berend Hasselman
On 26-03-2012, at 21:57, Sam Steingold wrote: > when subsetting a matrix results in a single row, it is converted to a > vector, not a matrix. > how do I avoid this? > > 1. __GOOD__ > >> edges <- get.edges(g,E(g)) >> edges > [,1] [,2] > [1,]02 > [2,]03 > [3,]04 > [4

Re: [R] trellis plot

2012-03-26 Thread Peter Ehlers
On 2012-03-26 09:09, Sebastián Daza wrote: Thank you Peter. The problem with you solution is that it doesn't represent the actual values of disruption. Look this example: person<- rep(1:2, each=4) income<- c(100, 120, 150, 200, 90, 100,120, 150) disruption<- c(0,0,0,1,0,1,1,0) time<- rep(c(1:4),

Re: [R] writing output directly to file; sink?

2012-03-26 Thread Diann Prosser
Thank you, Jim! I was just trying this as you wrote. Testing it on a small sample - it seems to work! I am curious - I removed the data that was stored in memory (using rm()), and checked to see that it was gone using ls() - and it was; but I didn't see a concurrent reduction in the Memory Usage o

[R] Error during wrapup: incorrect number of dimensions

2012-03-26 Thread Sam Steingold
when subsetting a matrix results in a single row, it is converted to a vector, not a matrix. how do I avoid this? 1. __GOOD__ > edges <- get.edges(g,E(g)) > edges [,1] [,2] [1,]02 [2,]03 [3,]04 [4,]05 [5,]11 [6,]04 [7,]06 [8,]

Re: [R] writing output directly to file; sink?

2012-03-26 Thread jim holtman
Have you tried 'save' to save the output. 'write' is probably spending a lot of time converting to character. Are you just going to read it back into R for processing; if so 'save' will probably be faster. On Mon, Mar 26, 2012 at 12:53 PM, Diann Prosser wrote: > Dear all, > I am working with la

Re: [R] Work -Shift Scheduling - Constraint Linear Programming

2012-03-26 Thread Greg Snow
Running findFn('linear programming') from the sos package brings up several possibilities that look promising. On Sun, Mar 25, 2012 at 5:48 AM, agent dunham wrote: > Dear Community, > > I've a Work -Shift Scheduling Problem I'd like to solve via constraint > linear programming. > > Maybe somethin

[R] Export Created Variables to SPSS/.csv

2012-03-26 Thread Strassburger, Daniel
I haven't been successful in converting my colleagues to the world of R yet they wish to share collected data so that they may analyze it in SPSS. I know how to write to an SPSS file and it opens fine, but my problem is that it only includes the existing data - none of the variables I created wi

[R] Different result with "kruskal.test" and post-hoc analysis with Nemenyi-Damico-Wolfe-Dunn test implemented in the help page for oneway_test in the coin package that uses multcomp

2012-03-26 Thread gianni lavaredo
Dear Researchers, Sorry for this email but I am not a statistician, and for this I have this problem to understand. Thanks in Advance for help and suggestions. Gianni I have 21 classes (00, 01, 02, 04, ,020) with different length. I did a kruskal wall test in R with the following code krusk

Re: [R] Predefined set of gray scale colors

2012-03-26 Thread Alaios
Great :) From: Sarah Goslee Cc: R help Sent: Monday, March 26, 2012 6:51 PM Subject: Re: [R] Predefined set of gray scale colors You might start with ?gray Sarah > Dear all, > I am printing  7 different data sets to the same plots, if I use some colors

Re: [R] Drape 3D scatterplot

2012-03-26 Thread Duncan Murdoch
On 26/03/2012 1:34 PM, John Benning wrote: Hi, *Warning: R newb here. * I've got a 3D scatterplot ( http://www.fleetwoodswoodworks.com/scatterPlot.jpg) which I want to drape in color, with the draped plane corresponding to the mean z values on the plot (similar to: http://www.fleetwoodswoodwork

[R] Completely Off Topic:Link to IOM report on use of "-omics" tests in clinical trials

2012-03-26 Thread Bert Gunter
Warning: This has little directly to do with R, although R and related tools (e.g. sweave and other reproducible research tools) have a natural role to play. The IOM report: http://www.iom.edu/Reports/2012/Evolution-of-Translational-Omics.aspx that arose out of the Duke Univ. genomics testing sc

Re: [R] copy the columns based on the code

2012-03-26 Thread Sarah Goslee
Then there's something missing in what you tell us. # this is an awkward and inefficient way of constructing a data frame city<-data.frame(city="Barcelona",cod=1) city<-rbind(city,data.frame(city="Madrid",cod=2)) city<-rbind(city,data.frame(city="Lisbon",cod=3)) city<-rbind(city,data.frame(city="

Re: [R] copy the columns based on the code

2012-03-26 Thread Bert Gunter
Fortunes candidate?! -- Bert On Mon, Mar 26, 2012 at 10:24 AM, Sarah Goslee wrote: < The OP wrote> "The problem is that it gives the result that I want." : That's a new sort of problem. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: ht

Re: [R] Updating a Markov Chain

2012-03-26 Thread ilai
On Sun, Mar 25, 2012 at 3:50 PM, stivi wrote: > Hello, > > my question is if anyone has any good ideas how to create a Markov Chain > from ordered data. So, I have some sort of time series, and if value1 > happens as time1 and value2 happens at time2 I record this as an update to > the probability

Re: [R] string substitution for argument in function

2012-03-26 Thread R. Michael Weylandt
'elem' is an attribute (the name) of the 'data' variable (bad name for a variable), not something that is independently accessible. By very (exceptionally!) loose analogy, think of it as being something like a field/property of an object -- you can't get to it directly (and that's a good thing) but

Re: [R] create waveform sawtooth

2012-03-26 Thread R. Michael Weylandt
Perhaps something like this, x <- seq(0, 10, length = 1000) y <- x %%1 Michael On Mon, Mar 26, 2012 at 10:18 AM, mail me wrote: > Hi: > > I am trying to create a sawtooth waveform. I used the following > > x <- runif(500, min = -2, max = 2) > y <- (1 -abs(x3))* ((x3) <= 1) > combined <- data.fr

Re: [R] copy the columns based on the code

2012-03-26 Thread Sarah Goslee
"The problem is that it gives the result that I want." That's a new sort of problem. You show two different merge() commands. What do you expect to happen, vs what does happen? Sarah On Mon, Mar 26, 2012 at 10:12 AM, MSousa wrote: > Thanks for the reply. > >    I am using the function you gave

[R] Year of data collection for 'diamonds' dataset in ggplot2

2012-03-26 Thread Marina Doucerain
Hello, I'm wondering what was the year (or year range) of collection for the data included in the 'diamonds' dataset in ggplot2. This information would be very helpful in interpreting the 'price' variable. Thank you! Marina Doucerain __ R-help@r-pr

[R] Drape 3D scatterplot

2012-03-26 Thread John Benning
Hi, *Warning: R newb here. * I've got a 3D scatterplot ( http://www.fleetwoodswoodworks.com/scatterPlot.jpg) which I want to drape in color, with the draped plane corresponding to the mean z values on the plot (similar to: http://www.fleetwoodswoodworks.com/draped3Dscatterplot.jpg). Does anyone k

Re: [R] Simple question regarding domain restrictions/piecewise functions in R

2012-03-26 Thread chad.mills
Yes! Thanks. It was just the "NA" value instead of the "as.null" that does the trick. Correct code for the original piecewise I stated (for those who might be looking later) is: f <- function(x){ ifelse((-1 < x & x < 1),x^2,ifelse((2http://r.789695.n4.nabble.com/Simple-questio

Re: [R] string substitution for argument in function

2012-03-26 Thread Prof. Dr. Pedro Martinez Arbizu
HI, thanks Weidong, Henrique, this works for the example (may be a bad example, but it should be as simple as possible), This is however only a workaround to name the columns of a dataframe, but is not addressing the problem itself, that is, how can I substitute a string (used as argument in

Re: [R] copy the columns based on the code

2012-03-26 Thread MSousa
thanks for the reply, But does not the results I need. What is confusing is that when making the first merge it gives only two cities when it should take three travel<-data.frame(pos=1,Source=1,Destine=2) travel<-rbind(travel,data.frame(pos=1,*Source=1*,Destine=3)) travel<-rbind(travel,data.f

[R] confidence intervals for non-linear models

2012-03-26 Thread katem
Hi, Does anyone have any suggestions for plotting confidence intervals onto fitted non-linear models? Thank you for your help! Kate -- View this message in context: http://r.789695.n4.nabble.com/confidence-intervals-for-non-linear-models-tp4506095p4506095.html Sent from the R help mailing list

[R] How to find best parameter values using deSolve n optim() ?

2012-03-26 Thread mhimanshu
Hello, Can someone please help me out with the optim() function. # parameters pars<- c(a1= 0.9, a2= 0.7, a3= 0.06, a4=0.02) y<- c(Y=0.2, Z=0.1) Ymax<- c(0.8) fucntion deriv derivs <- function(time, y, pars) { with (as.list(c(y, pars)), { dy = a1*Y*(1-Y/Ymax) - a2*(Y+0.001) dz = a3*Y- a4*

Re: [R] copy the columns based on the code

2012-03-26 Thread R. Michael Weylandt
"The problem is that it gives the result that I want" I'm not sure that's what one would usually identify as a problemcan you say a little more specifically what you are looking to do? Michael On Mon, Mar 26, 2012 at 10:12 AM, MSousa wrote: > Thanks for the reply. > >    I am using the func

[R] Building GLM Model with dependent variable as a proportion for 4 categories

2012-03-26 Thread prachi mehta
Hi All, I am trying to develop a GLM model in which the dependent data is a proportion data with 4 categories. I want to develop this model as an alternative method to Multinomial Logit Model for comparison of results. Here is the sample data: CategorySharesY x1 x2 1 0.79705215

Re: [R] copy the columns based on the code

2012-03-26 Thread Rui Barradas
Hello, > > The problem is that it gives the result that I want > Oh dear, it shouldn't? > > The idea is based on the column of source and intended Identify the > cities and put a new data structure > > The idea is something like this. > pos Source city Destine city_destine > 1

Re: [R] string substitution for argument in function

2012-03-26 Thread Prof. Dr. Pedro Martinez Arbizu
Me again, what I really dont understand is the behaivour of R here. notice, elem is not written in "brackets", why it is interpreted as string and not as a variable? I would expect an error "elem not found" because it is not defined as variable, but in contrary it is accepted as column name, see

[R] create waveform sawtooth

2012-03-26 Thread mail me
Hi: I am trying to create a sawtooth waveform. I used the following x <- runif(500, min = -2, max = 2) y <- (1 -abs(x3))* ((x3) <= 1) combined <- data.frame(x = x3, y = y3) plot(combined) and I get a triangular waveform, not sawtooth. Can someone give a solution to create a sawtooth waveform? T

Re: [R] copy the columns based on the code

2012-03-26 Thread MSousa
thanks, is working -- View this message in context: http://r.789695.n4.nabble.com/copy-the-columns-based-on-the-code-tp4505253p4506128.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.eth

Re: [R] Extracting numbers from a character variable of different types

2012-03-26 Thread irene
It worked perfectly! Thank you -- View this message in context: http://r.789695.n4.nabble.com/Extracting-numbers-from-a-character-variable-of-different-types-tp4482248p4505914.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-p

Re: [R] reading header in txt file and making histogram

2012-03-26 Thread chuck.01
You really need to read one of many beginners guides to R; but I will say this much: YOUR_DATA <- read.table("nigeria slr misc/Nigeria India /DBHHISTOGRAM.txt", header=TRUE) then you should be able to plot it like I said previously. If that still doesn't work, you need to read the posting guide

Re: [R] reading header in txt file and making histogram

2012-03-26 Thread jaclea
If there is a header in your .txt-file you should have header=TRUE, if there is no header you should have header=FALSE. You have to save your dataset in a variable, for example: myData<-read.table("data.txt",header=TRUE) Then you can make a histogram by: hist(myData) -- View this message in co

Re: [R] reading header in txt file and making histogram

2012-03-26 Thread bamboohydraulics
this is what I do, IT READS THE TABLE, But then I am stuck, I removed the header read.table("nigeria slr misc/Nigeria India /DBHHISTOGRAM.txt", header=FALSE) hist("nigeria slr misc/Nigeria India /DBHHISTOGRAM.txt"$V1) Error in "nigeria slr misc/Nigeria India /DBHHISTOGRAM.txt"$V1 : $ operator i

Re: [R] copy the columns based on the code

2012-03-26 Thread MSousa
Thanks for the reply. I am using the function you gave me. complete.travel<-merge(travel, city, by.x = "Source", by.y = "cod", all = TRUE) complete.travel<-merge(travel, city, by.x = "Destine", by.y = "cod", all = TRUE The problem is that it gives the result that I wa

[R] writing output directly to file; sink?

2012-03-26 Thread Diann Prosser
Dear all, I am working with large matrices (19.6 million elements * 1000 simulations) and am trying to get around memory problems and vector length issues. I’ve split the inputs so that the output vector length will not exceed 2^31. Working on a 64bit machine with 80GB RAM, I still get close to th

Re: [R] Predefined set of gray scale colors

2012-03-26 Thread Sarah Goslee
You might start with ?gray Sarah On Mon, Mar 26, 2012 at 12:49 PM, Alaios wrote: > Dear all, > I am printing  7 different data sets to the same plots, if I use some colors > like (red,blue,yelow...) the different datasets are easily recognized. I > would like to use some gray scale colors for

[R] normalization of multi-value string variable

2012-03-26 Thread Alekseiy Beloshitskiy
Hi All, I need to normalize/scale string variable which represents interests of customers (e.g., 'cycling, rollerblading, swimming' etc). Does anybody know how to do this, I want then use it along with other numeric variables for SVM classification. Appreciate for any advice. -Alex [

[R] Predefined set of gray scale colors

2012-03-26 Thread Alaios
Dear all, I am printing  7 different data sets to the same plots, if I use some colors like (red,blue,yelow...) the different datasets are easily recognized. I would like to use some gray scale colors for distinguising the datasets. Is there any ready set with grayscale colors (usually the prede

Re: [R] many curves to the same plot

2012-03-26 Thread Alaios
Thanks a lot :) That helped ! Alex From: R. Michael Weylandt Cc: R help Sent: Monday, March 26, 2012 4:48 PM Subject: Re: [R] many curves to the same plot You can use lines() with ecdf objects or use the not-at-all-surprisingly-named add = TRUE parameter of

Re: [R] 'names' attribute must be the same length as the vector

2012-03-26 Thread Uwe Ligges
On 25.03.2012 22:10, jiefan wrote: I have met into this problem when I tried to run panel regression by plm. My code: library(plm) indus<- read.csv(file="full.csv",header=TRUE) industry<-as.data.frame(indus) reg<-lm(LnTSO2 ~ LnPGDP + LnPGDP2 + LnSOES + LnCOES + LnLIMD + LnSHOLD + LnPRIV +

Re: [R] trellis plot

2012-03-26 Thread Sebastián Daza
Thank you Peter. The problem with you solution is that it doesn't represent the actual values of disruption. Look this example: person  <- rep(1:2, each=4) income  <- c(100, 120, 150, 200, 90, 100,120, 150) disruption  <- c(0,0,0,1,0,1,1,0) time  <- rep(c(1:4),2) dat  <- as.data.frame(cbind(person

[R] Pareto frontier plots in three dimensions

2012-03-26 Thread Robbie Morrison
Hello all This is my first posting for some years. I am back using R again and must say I do like the language (regarding scripting, I also use matlab, perl, and bash). My question involves plotting a Pareto frontier in three dimensions. This is strictly a exercise in visualization, I make no

Re: [R] R numerical integration

2012-03-26 Thread Hans W Borchers
casperyc hotmail.co.uk> writes: > I don't know what is wrong with your Maple calculations, but I think you should check them carefully, because: (1) As Petr explained, the value of the integral will be < 0.5 (2) The approach of Peter still works and returns : 0.4999777 (3) And the same result c

Re: [R] row, col function but for a list (probably very easy question, cannot seem to find it though)

2012-03-26 Thread David Winsemius
On Mar 25, 2012, at 6:17 PM, MBoersma wrote: Hi guys, I'm quite new to R but quite enthousiastic. I'm trying to rewrite a bit of code in order to make it faster, so instead of nesting for loops I'm trying some apply functions. It is an urban myth that using 'apply' functions will delive

Re: [R] SPSS R-Menu for Ordinal Factor Analysis

2012-03-26 Thread Eik Vettorazzi
Hi Till, you need a plug-in for SPSS to run R, which is bound to a fixed R version. SPSS 19 uses R2.10 and SPSS 20 uses R2.12 (both not up-to-date R versions). So you have to download this plugin (after registering on IBM Support) for your spss version and the according R version - or start with a

Re: [R] Seeming failure of options(width=60)

2012-03-26 Thread Duncan Murdoch
On 26/03/2012 9:30 AM, John C Nash wrote: Yihui is correct that an error is generated. I should have mentioned that this is something I wanted to show in a vignette, and I got 103 characters as the length of the maximal line from a sink() file. Yihui's use of nchar is more elegant. Thus the qu

Re: [R] many curves to the same plot

2012-03-26 Thread Petr PIKAL
Hi If you went through help page you probably could find it yourself in shorter time then you spend writing email and waited for others to write back. see ?plot.stepfun > Dear all, > I would like to plot under the same plot > many curves like > > mycdf<-ecdf(runif(100)) > plot(mycdf) > curve(

Re: [R] SPSS R-Menu for Ordinal Factor Analysis

2012-03-26 Thread peter dalgaard
On Mar 26, 2012, at 16:31 , Duncan Murdoch wrote: > I think you will need to ask this question in an SPSS help forum: > > - Version 2.10.x of R is quite old, and is no longer supported. > - The error message is coming from SPSS, not R and actually, it doesn't look like an error message at all,

Re: [R] many curves to the same plot

2012-03-26 Thread R. Michael Weylandt
You can use lines() with ecdf objects or use the not-at-all-surprisingly-named add = TRUE parameter of curve(). Michael On Mon, Mar 26, 2012 at 10:44 AM, Alaios wrote: > Dear all, > I would like to plot under the same plot > many curves like > > mycdf<-ecdf(runif(100)) > plot(mycdf) > curve(mycd

[R] many curves to the same plot

2012-03-26 Thread Alaios
Dear all, I would like to plot under the same plot many curves like mycdf<-ecdf(runif(100)) plot(mycdf) curve(mycdf,from=-1,to=1) mycdf<-ecdf(runif(200)+3) plot(mycdf) curve(mycdf,from=-1,to=1) as you can see each new call to curve redraws (erases) the window. How I can have an effect like plo

Re: [R] SPSS R-Menu for Ordinal Factor Analysis

2012-03-26 Thread Duncan Murdoch
On 26/03/2012 7:32 AM, Till Below wrote: Dear all, I am trying to conduct an enhanced version of factor analysis with a SPSS interface that allows to use R. This approach has been suggested in the recent article: Basto, M. and J.M. Pereira An SPSS R-Menu for Ordinal Factor Analysis. Journal of

Re: [R] R_unload_[PACKAGENAME] not called

2012-03-26 Thread Duncan Murdoch
On 26/03/2012 6:24 AM, Henrik Alsing Friberg wrote: Hi R-help users.. I mistakenly posted a now rejected bug report (https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14855), but the subject still bugs me..! If I have a package called MyPackage with C code inside, then library or require(MyP

Re: [R] R Error : DATA to MATRIX

2012-03-26 Thread Petr PIKAL
> > On similar lines, how do I assign the position of the an occurence of a > value say 7 in a data vector to another data vector? > > > nFields > [1] 6 6 6 6 6 6 7 7 6 6 6 7 6 6 6 6 > I need the output data vector showing occurence of 7 as: > [1] 7 8 12 which(nFields==7) Regards Petr >

Re: [R] reading header in txt file and making histogram

2012-03-26 Thread John Kane
Please provide your code as is requested in the posting guidelines. At a guess, you have read in your data into a data.frame called dhb with a variable called dhb. Try hist(dhb$dhb) and see what happens. To see a bit more of what you've got try str(dhb) to see what the sdtructure of the data is

Re: [R] copy the columns based on the code

2012-03-26 Thread Sarah Goslee
It isn't quite clear to me that cod in data frame city and pos in travel are are actually the same index, but if so then you can easily use merge() for this task. Sarah On Mon, Mar 26, 2012 at 5:41 AM, MSousa wrote: > >  Hello, > > I have two different dataset, and wanted to join the two. >   Fo

Re: [R] Seeming failure of options(width=60)

2012-03-26 Thread John C Nash
Yihui is correct that an error is generated. I should have mentioned that this is something I wanted to show in a vignette, and I got 103 characters as the length of the maximal line from a sink() file. Yihui's use of nchar is more elegant. Thus the question remains of how to avoid margin over-r

[R] R_unload_[PACKAGENAME] not called

2012-03-26 Thread Henrik Alsing Friberg
Hi R-help users.. I mistakenly posted a now rejected bug report (https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14855), but the subject still bugs me..! If I have a package called MyPackage with C code inside, then library or require(MyPackage) will call loadNamespace() which will look for

[R] SEM: Dependent binary: impact estimating wrong standard errors with hetcor()

2012-03-26 Thread Tryntsje Hoving-Wesselius
Hi, I'm using the SEM package to estimate a model with a binary variabele as dependent variable. In the literature I have to use then the correlation matrix, made by function hetcor(). Literature also says that the standard errors are not correct then. My question is if somebody knows what the imp

[R] copy the columns based on the code

2012-03-26 Thread MSousa
Hello, I have two different dataset, and wanted to join the two. For example I have a table of codes of cities, and other with with the codes of travels, [source for the destine]. what he wanted was to have a new data.frame with all the information city<-data.frame(city="Barcelona",cod=1)

[R] Circular statistics- range.circular

2012-03-26 Thread Benedikt Niesterok
Hi everyone, does anyone know, which test of uniformity is run under the command range.circular() in the circular statistics package? It didn't say anything in the description of this command. Your help would be appreciated a lot. Benedikt [[alternative HTML version deleted]] _

[R] SPSS R-Menu for Ordinal Factor Analysis

2012-03-26 Thread Till Below
Dear all, I am trying to conduct an enhanced version of factor analysis with a SPSS interface that allows to use R. This approach has been suggested in the recent article: Basto, M. and J.M. Pereira An SPSS R-Menu for Ordinal Factor Analysis. Journal of Statistical Software 46, pp. 1-29.

[R] how to scale tokens

2012-03-26 Thread Alekseiy Beloshitskiy
Hi All, I need to scale variable of tokens (several words per observation) to be able to use it for svm(). For example, i have varible x4=(how,grow,tree) Any ideas how to scale to use in svm()? Thank you, -Alex [[alternative HTML version deleted]]

Re: [R] how to cluster rows of words in a text file

2012-03-26 Thread Alekseiy Beloshitskiy
Hello, I didn't quite understand what you need, but maybe you can have a look here: www.slideshare.net/whitish/textmining-with-r R code fragments are in appendixes of the presentation. Hope this will help, -Alex From: r-help-boun...@r-project.org [r-help-

Re: [R] circles()

2012-03-26 Thread Duncan Murdoch
On 26/03/2012 8:09 AM, John D. Muccigrosso wrote: I cannot for the life of me figure this out: What's the parameter to fill in with color circles made with circles()? col changes the line color, but all I see in the help is a reference to "additional graphic parameters", and no examples via go

[R] Dependence Hypothesis Test

2012-03-26 Thread Andrea Sica
Dear all, I have a data-set of 91 variables. It is related with a qualitative analysis I made to analyse a few phenomena. For this reason the questions are grouped in 10 clusters, since they express different phenomena of the analysis. I made the subset to collect the questions and represent the p

Re: [R] Struggling with zoo and aggregate

2012-03-26 Thread Thomas Adams
Gabor, That does it! I can't thank you enough… Many thanks, Tom On Mon, Mar 26, 2012 at 7:22 AM, Gabor Grothendieck wrote: > On Sun, Mar 25, 2012 at 10:20 PM, Thomas Adams > wrote: > > Gabor, > > > > Thank you for your help -- it did help me a lot. However, with my data: > > > >lead_time

Re: [R] NA in R package randomForest

2012-03-26 Thread Weidong Gu
Your data set probably has character variables. You can transform them into factors before running na.roughfix. Weidong Gu On Mon, Mar 26, 2012 at 8:17 AM, silje skår wrote: > I have a question regarding NA in randomForest (in R). I have a dataset > which include both numerical and non-numerical

[R] NA in R package randomForest

2012-03-26 Thread silje skår
I have a question regarding NA in randomForest (in R). I have a dataset which include both numerical and non-numerical variables, and the data includes some NA. I tried to use na.roughfix but then i get an error message "na.roughfix only works for numeric or factor". I also tried rfImpute but this

[R] circles()

2012-03-26 Thread John D. Muccigrosso
I cannot for the life of me figure this out: What's the parameter to fill in with color circles made with circles()? col changes the line color, but all I see in the help is a reference to "additional graphic parameters", and no examples via google. Thanks! John Muccigrosso __

Re: [R] Error in par(pin = p) : invalid value

2012-03-26 Thread Aurelie Cosandey Godin
Should of seen that! It works now. Thank you Duncan, Aurelie On 2012-03-26, at 8:39 AM, Duncan Murdoch wrote: > On 12-03-26 7:17 AM, Aurelie Cosandey Godin wrote: >> Dear list, >> >> I am getting an error message with "pin" and I am not quiet sure how to fix >> it. >> >> library(maps) >> op<-

Re: [R] Error in par(pin = p) : invalid value

2012-03-26 Thread Duncan Murdoch
On 12-03-26 7:17 AM, Aurelie Cosandey Godin wrote: Dear list, I am getting an error message with "pin" and I am not quiet sure how to fix it. library(maps) op<-par(mar=c(1,1,1,1)) map(xlim=c(-40,-45),ylim=c(60,65), boundary=T, fill=T, col='gray95') Error in par(pin = p) : invalid value sp

Re: [R] Struggling with zoo and aggregate

2012-03-26 Thread Gabor Grothendieck
On Sun, Mar 25, 2012 at 10:20 PM, Thomas Adams wrote: > Gabor, > > Thank you for your help -- it did help me a lot. However, with my data: > >    lead_time cycle    r_squared  fcst_date > 1  6 0 5.405095e-02 07/31/2010 > 2 12 0 5.521620e-06 07/31/2010 > 3 18 0 1

[R] Error in par(pin = p) : invalid value

2012-03-26 Thread Aurelie Cosandey Godin
Dear list, I am getting an error message with "pin" and I am not quiet sure how to fix it. library(maps) op<-par(mar=c(1,1,1,1)) map(xlim=c(-40,-45),ylim=c(60,65), boundary=T, fill=T, col='gray95') >Error in par(pin = p) : invalid value specified for graphical parameter "pin" par("pin") > pa

  1   2   >