Re: [R] Zero-inflated regression models: predicting no 0s

2011-06-01 Thread Achim Zeileis
On Tue, 31 May 2011, Jean-Simon Michaud wrote: Hi all, First post for me here, but I have been reading on the forum for almost two years now. Thanks to everyone who contributed btw! I have a dataset of 4000 observations of count of a mammal and I am trying to predict abundance from a inflated-

[R] conversion of matrix into list

2011-06-01 Thread Martin Spindler
Dear all, I have a matrix X which consists of 2 columns. I would like to convert this matrix into a list where every entry of the list consists of a single row of the matrix. Does anyone have a suggestions how to manage this? Thank you for your efforts in advance! Best, Martin

[R] Odp: conversion of matrix into list

2011-06-01 Thread Petr PIKAL
Hi > Dear all, > > > > I have a matrix X which consists of 2 columns. I would like to convert this > matrix into a list where every entry of the list consists of a single row of > the matrix. e.g. split(mat, 1:nrow(mat)) Regards Petr > > Does anyone have a suggestions how to manage this

Re: [R] Metafor: Differences between two categories of a moderator

2011-06-01 Thread Holger Steinmetz
Hi Wolfgang that's good news. One further small follow-up question: When I conduct multiple comparisons via the relevel-command: should I adjust the p-value? Thanks in advance, Holger -- View this message in context: http://r.789695.n4.nabble.com/Metafor-Differences-between-two-categories-of-a-

Re: [R] different results from lme() and lmer()

2011-06-01 Thread ONKELINX, Thierry
Dear Miya, Notice the very strong negative correlation between the random intercept and the random slope in the lme() model. That is usually an indication of problems (in this case overfitting). If you drop the random slope, then both models yield the same parameters. Plotting the data reviels

[R] problems with converting into dxf file

2011-06-01 Thread kamilaplis
Hello, I'm using R to calculate MCP home ranges to my master thesis. I have problem with converting shapes of home ranges to .dxf file, which I can use in ArcMap. Problems are showing when I'm opening attribute table, because somehow during converting int dxf file R is deleting all input informati

[R] bayesglm with weights

2011-06-01 Thread Edouard Chatignoux
Dear list, I have troubles with using Bayesian logistic model with count data in bayesglm. If I consider the following artificial data set, with a response y and a covariate x, in a form of row data (a) and count (b) : a<-data.frame(y=c(rep(1,10),rep(0,6)),x=c(rep(5,6),rep(4,4),rep(5,1),rep(4

[R] Odp: while loop problems

2011-06-01 Thread Petr PIKAL
Hi Without reproducible example or some code I wonder if anybody can give you some advice. As a wild guess do you use if function correctly i.e. input is "length one logical vector" ? And maybe you do not need loop at all Regards Petr > > [R] while loop problems > > Hi , i am trying to get

[R] load seven files (named by date) at a time

2011-06-01 Thread Mathew Brown
Hello, I'm trying to load a weeks worth of files that are each named by the date they were creaded (e.g., 20110601.RData), starting with the day before today so if today is June 1, I would like to load 20110525- 20110531. The script was working until today, and x= 20110593 20110594 201

[R] Odp: load seven files (named by date) at a time

2011-06-01 Thread Petr PIKAL
Hi > [R] load seven files (named by date) at a time > > Hello, > > I'm trying to load a weeks worth of files that are each named by the > date they were creaded (e.g., 20110601.RData), starting with the day > before today so if today is June 1, I would like to load

Re: [R] Odp: load seven files (named by date) at a time

2011-06-01 Thread Mathew Brown
Awesome, thanks a lot! On 6/1/2011 11:22 AM, Petr PIKAL wrote: seq(as.Date(time)-7, as.Date(time)-1, by=1) __ 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/po

[R] Identifying sequences

2011-06-01 Thread christiaan pauw
Hallo Everybody Consider the following vector a=1:10 b=20:30 c=40:50 x=c(a,b,c) I need a function that can tell me that there are three set of continuos sequences and that the first is from 1:10, the second from 20:30 and the third from 40:50. In other words: a,b, and c. regards Christiaan

[R] error in model specification for cfa with lavaan-package

2011-06-01 Thread D. Alain
Dear R-List, (I am not sure whether this list is the right place for my question...) I have a dataframe df.cfa df.cfa<-data.frame(x1=c(5,4,1,5,5,NA,4,NA,NA,5),x2=c(2,3,3,3,NA,1,2,1,2,1),x3=c(5,3,4,1,5,5,5,5,5,5),x4=c(5,3,4,5,5,5,5,5,5,5),x5=c(5,4,3,3,4,4,4,5,NA,5),x6=c(3,5,2,1,4,NA,NA,5,3,4),x7=

Re: [R] error in model specification for cfa with lavaan-package

2011-06-01 Thread Mike Cheung
Dear Alain, There were 16 variables with 10 cases with missing values. The sample covariance matrix is not positive definite. It has nothing to do with lavaan. You need more cases before you can fit a CFA with 16 variables. Regards, Mike -- --

Re: [R] Forcing a negative slope in linear regression?

2011-06-01 Thread John C Frain
In econometrics economic theory often predicts a particular sign for a slope variable. One often gets wrong signs on variables but the coefficients as estimated, in such cases are usually both statistically and economically insignificant. In such cases one generally re-estimates the equation with

[R] retrieving name of a function inside this function

2011-06-01 Thread Jannis
Dear list members, is it possible to retrieve the name of a function or the exact call to that function from the environment created "inside" this function? I wrote a function for debugging on a cluster that saves all the objects inside the whole stack of function environments and would also l

Re: [R] retrieving name of a function inside this function

2011-06-01 Thread Duncan Murdoch
On 11-06-01 7:26 AM, Jannis wrote: Dear list members, is it possible to retrieve the name of a function or the exact call to that function from the environment created "inside" this function? I wrote a function for debugging on a cluster that saves all the objects inside the whole stack of fu

[R] Missing completely at random

2011-06-01 Thread Blaz Simcic
Hello! I would like to sample 5 % of cases and from 1 to 3 variables within selected cases and set them as NA (MCAR-Missing completely at random). I managed to sample cases and variables, but I don’t know how to set them as NA. R code: N <- 1000      number of cases n <- 12      

Re: [R] Import/convert PMML to R model

2011-06-01 Thread Raji
Hi R-helpers, Can you please let me know if it is possible to import a PMML in R? If yes, can you give me the command to do the same? If not, can you tell me the reason why? Many thanks, Raji -- View this message in context: http://r.789695.n4.nabble.com/Import-convert-PMML-to-R-model-tp333277

[R] treemaps

2011-06-01 Thread Richard Slater
Hello, I've created a treemap using the treemap package (tmPlot) showing distribution of my data across 3 countries. The boxes created within the country are proportionate to my data; however how do I make the 3 countries proportionate to the total of all 3 as well? Currently the 3 countries a

[R] Problem with as.POSIXct()

2011-06-01 Thread circe
Hi, when I type in these words: > a=c("2011-06-01 17:21:24.83", "2011-06-01 17:21:24.283") > as.POSIXct(a) the real output is: [1] "2011-06-01 17:21:24.830 CST" "2011-06-01 17:21:24.283 CST" rather than the expected one: [1] "2011-06-01 17:21:24.083 CST" "2011-06-01 17:21:24.283 CST" H

Re: [R] Identifying sequences

2011-06-01 Thread David Winsemius
On Jun 1, 2011, at 6:27 AM, christiaan pauw wrote: Hallo Everybody Consider the following vector a=1:10 b=20:30 c=40:50 x=c(a,b,c) I need a function that can tell me that there are three set of continuos sequences and that the first is from 1:10, the second from 20:30 and the third from

Re: [R] Identifying sequences

2011-06-01 Thread ONKELINX, Thierry
Something like this? a=1:10 b=20:30 c=40:50 x=c(a,b,c) borders <- which(diff(x) != 1) seqs <- data.frame(start = c(1, borders + 1), end = c(borders, length(x))) Best regards, Thierry > -Oorspronkelijk bericht- > Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > N

Re: [R] Identifying sequences

2011-06-01 Thread Jonathan Daily
I am assuming in this case that you are looking for continuity along integers, so if you expect noninteger values this will not work. You can get the index of where breaks can be found in your example using which(diff(x) > 1) On Wed, Jun 1, 2011 at 6:27 AM, christiaan pauw wrote: > Hallo Everyb

[R] Retaining MatchIt output as a dataset

2011-06-01 Thread Shane Phillips
Hi! I am running a simulation testing group balance using different propensity score matching techniques. I am using the MatchIt package to match and analyze the data. Since I am running this analysis many, many times with different simulated data sets, I need to make the output from the Matc

[R] graphical output - customization of x axis

2011-06-01 Thread Christine SINOQUET
Hello, I do not understand why the following source does not success in customizing the x axis. The wished customization just consists in labelling the x ticks with "0kb","1kb","5kb","10kb","20kb","50kb","100kb","inf". pathFileName <- "test1.png" stats4H <- c(0.8623, 0.7142, 0.7211, 0.6753

Re: [R] Problem with as.POSIXct()

2011-06-01 Thread Stefan Peterson
circe hotmail.com> writes: > > Hi, when I type in these words: > > > a=c("2011-06-01 17:21:24.83", "2011-06-01 17:21:24.283") > > as.POSIXct(a) > > the real output is: >[1] "2011-06-01 17:21:24.830 CST" "2011-06-01 17:21:24.283 CST" > > rather than the expected one: >[1] "2011-06-01 1

Re: [R] graphical output - customization of x axis

2011-06-01 Thread David Winsemius
Take out the pos=0 argument in your call to axis. -- David. On Jun 1, 2011, at 8:56 AM, Christine SINOQUET wrote: Hello, I do not understand why the following source does not success in customizing the x axis. The wished customization just consists in labelling the x ticks with "0kb",

[R] Simulating SVAR Data

2011-06-01 Thread Downey, Patrick
Hello, I'd like to simulate data according to an SVAR model in order to demonstrate how other techniques (such as arima) yield biased estimates. I am interested in a 2 variable SVAR with 2 lags (in the notation of the vars vignette, K = 2, P = 2, where B = I_K). I'm using the {vars} package outlin

Re: [R] error in model specification for cfa with lavaan-package

2011-06-01 Thread yrosseel
Dear Alain, As for the first error ("sample covariance can not be inverted"): Mike is right: with only 10 observations and 16 variables, the ML estimation of the sample cov produces a covariance matrix that is not positive definite, and hence the inversion (deliberately) fails. The lesson fo

[R] interpolation and extremum location of a surface‏

2011-06-01 Thread Clement LAUZIN
Hello, I have a x,y,z file.Z is not corresponding to a simple analytical function of x and y (see below). I am trying to find the minimum location of this surface and the z value corresponding to this location by a spline interpolation or from a polynomial fit. I tried with the akima package

[R] Force Sweave to add figure filename extension

2011-06-01 Thread Renaud Gaujoux
Hi, is there a way to force Sweave to add the extension (say .pdf) to the image names included by \includegraphics. I understand that the objective of not putting the extension is to allow the compilation with both latex or pdflatex. However, when option eps=false, the extension could optionall

Re: [R] Force Sweave to add figure filename extension

2011-06-01 Thread Duncan Murdoch
On 01/06/2011 10:13 AM, Renaud Gaujoux wrote: Hi, is there a way to force Sweave to add the extension (say .pdf) to the image names included by \includegraphics. I understand that the objective of not putting the extension is to allow the compilation with both latex or pdflatex. However, when op

Re: [R] Force Sweave to add figure filename extension

2011-06-01 Thread Renaud Gaujoux
Hi, thank you Duncan for your prompt response. I was about to post another solution that worked fine for me (and the journal's system). Add in the preamble the command: \DeclareGraphicsExtensions{.pdf} Bests, Renaud On 01/06/2011 16:18, Duncan Murdoch wrote: On 01/06/2011 10:13 AM, Renaud G

Re: [R] In a formula, what is the interaction of the intercept and a factor?

2011-06-01 Thread Kevin Wright
On Wed, Jun 1, 2011 at 1:19 AM, Prof Brian Ripley wrote: [text deleted] > Note that you usually want to do '*' when you say 'interact with': > >> model.matrix(y ~ (1+x)*group, data = dat) >> > (Intercept) x groupB x:groupB > 11 1 11 > ... Thanks for that suggestion

Re: [R] In a formula, what is the interaction of the intercept and a factor?

2011-06-01 Thread Kevin Wright
Perhaps of interest...in S-Plus 7.0 > model.matrix(y ~ (1+x)*group, data = dat) (Intercept) x group x:group 1 1 1 1 1 2 1 2 1 2 ... > model.matrix(y ~ (1)*group, data = dat) (Intercept) group 1 1 1 2 1 1 ... Kevin

Re: [R] Identifying sequences

2011-06-01 Thread christiaan pauw
Thanks to David, Thierry and Jonathan for your help. I have been able to put this function together a=1:10 b=20:30 c=40:50 x=c(a,b,c) seq.matrix <- function(x){ lower<- x[which(diff(x) != 1)] upper <- x[which(diff(x) != 1)+1] extremities <- c(1,lower, upper,x[length(x)]) m <- data.frame(matrix(e

[R] Create Matrix with Float32 values

2011-06-01 Thread Chris English
Dear R_Help: The following gives me a matrix with integer values. z= matrix(rep(10:1, each= 10), ncol= 10, byrow=TRUE)> str(z) int [1:10, 1:10] 10 9 8 7 6 5 4 3 2 1 ... How do I specify that I want Float32 values instead. Thanks,Chris

[R] RES: conversion of matrix into list

2011-06-01 Thread Filipe Leme Botelho
--- Begin Message --- Hi Martin, I believe this can do the trick. Let me know otherwise. Cheers testing <- matrix(rnorm(10),50,2) testing_list <- lapply(1:nrow(testing), function(j) testing[j,]) -Mensagem original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r

[R] Overlaying two matrices to create a heatmap

2011-06-01 Thread Mark Aquino
Hi, I'm trying to construct a heatmap using two matrices rather than one (Is this possible?) For example, matrix1: (color range black---> blue) acr DPA1-0103 DPA1-0104 DPA1-0201 DPA1-0202 DPA1-0301 DPA1-0103 17 0 2 1 0 DPA1-0104

[R] re-write plot function for ggplot

2011-06-01 Thread rmje
Hi, I have the following function that i use to plot graphs. plot_mi_time = function(mdata, miname) { mdata2 = mdata[row.names(mir_test3) == miname, ] # print(mdata2) xcoords <- c(1,1,2,2,3,3) plot(xcoords, mdata2, xaxt="n", ylab="Expression", xlab="Time(h)", , main=miname)

Re: [R] re-write plot function for ggplot

2011-06-01 Thread Lamke
You should post it on the ggplot2 mailing list. For the long run I would suggest getting the book as it's extremely helpful. -- View this message in context: http://r.789695.n4.nabble.com/re-write-plot-function-for-ggplot-tp3565868p3565950.html Sent from the R help mailing list archive at Nabbl

[R] Plot a network with edges of specified length

2011-06-01 Thread PhDGuy
Hello, I would like to plot a network with given edge lengths by using the plot function of the network package. Assume my network has the following adjacency matrix: a b c a 0 0 0 b 1 0 0 c 1 0 0 so that b and c are linked to a. I would like to specify that the length of the edge from b to a

Re: [R] Identifying sequences

2011-06-01 Thread Mike Marchywka
> Date: Wed, 1 Jun 2011 17:12:29 +0200 > From: cjp...@gmail.com > To: r-help@r-project.org > Subject: Re: [R] Identifying sequences > > Thanks to David, Thierry and Jonathan for your help. > I have been able to put this function together > > a=1:10 > b

Re: [R] interpolation and extremum location of a surface‏

2011-06-01 Thread Hans W Borchers
Clement LAUZIN hotmail.com> writes: > Hello, > > Hello, > > I have a x,y,z file.Z is not corresponding to a simple analytical function > of x and y (see below). I am trying to find the minimum location of this > surface and the z value corresponding to this location by a spline > interpolation

[R] Anyone have experience with kinship pedigree plot?

2011-06-01 Thread Ben Bimber
Hello, I am using the Kinship package to draw a pedigree plot. I am trying to control the spacing between individuals in the pedigree. Currently, it is drawing a pedigree with too little space, so the text is overlapping. I'd like to increase the distance between individuals. According to the d

Re: [R] interpolation and extremum location of a surface‏

2011-06-01 Thread David Winsemius
On Jun 1, 2011, at 9:24 AM, Clement LAUZIN wrote: Hello, I have a x,y,z file.Z is not corresponding to a simple analytical function of x and y (see below). I am trying to find the minimum location of this surface and the z value corresponding to this location by a spline interpolation or

[R] Memory management

2011-06-01 Thread Michael Conklin
I am trying to run a very large Bradley-Terry model using the BradleyTerry2 package. (There are 288 "players" in the BT model). My problem is that I ran the model below successfully. WLMat is a win-loss matrix that is 288 by 288 WLdf<-countsToBinomial(WLMat) mod1<-BTm(cbind(win1,win2),player1,

Re: [R] MAP datafile

2011-06-01 Thread Jim Silverton
Hi, I have a MAP datafile with SNP data and would like to open it and run say fisher's exact test and save the p-values. Anyone has any idea how this can be done? -- Thanks, Jim. [[alternative HTML version deleted]] __ R-help@r-project.org ma

Re: [R] Recode numbers

2011-06-01 Thread Pete Brecknock
Lisa wrote: > > Dear all, > > I have two sets of numbers that look like > > a <- c(1, 2, 3, 3, 4, 4, 5, 6, 1, 2, 2, 3, 1, 2, 1, 2, 3, 3, 4, 5, 1, 2, > 3, 4) > > b <- c(1, 5, 8, 9, 14, 20, 3, 10, 12, 6, 16, 7, 11, 13, 17, 18, 2, 4, 15, > 19) > > I just want to use “b” to encode “a” so that “a”

[R] Recode numbers

2011-06-01 Thread Lisa
Dear all, I have two sets of numbers that look like a <- c(1, 2, 3, 3, 4, 4, 5, 6, 1, 2, 2, 3, 1, 2, 1, 2, 3, 3, 4, 5, 1, 2, 3, 4) b <- c(1, 5, 8, 9, 14, 20, 3, 10, 12, 6, 16, 7, 11, 13, 17, 18, 2, 4, 15, 19) I just want to use “b” to encode “a” so that “a” looks like a1<- c(1, 5, 8, 8, 9, 9,

[R] lattice panel fine control

2011-06-01 Thread maxbre
Hello R experts, what follows is my reproducible example: mydata<-structure(list(ped.avg = c(335.9, 110.8, 645.7, 638.9, 1468.1, 126.4, 4811.1, 88.5, 868.5, 656.6, 723.6, 654, 2.8, 15, 14.2, 17.5, 15.4, 112.1, 424.7, 18.3, 19.9, 28.6, 25.6, 23.5, 15.4, 27, 62.1, 15.6, 74.6), ped.erst = c(96, 5

[R] Qs on "vector of lists", etc.

2011-06-01 Thread Roy Shimizu
I'm pretty new to R, so please forgive the cluelessness of these questions. Is it true that it is not possible to have a "vector or lists" in R? Is a "list of lists" the closest one can get to a "vector of lists"? Is it possible to have a "matrix of lists" in R? Or an "array of lists"? Thanks!

[R] xtable with conditional formatting using \textcolor

2011-06-01 Thread Walmes Zeviani
Hello list, I'm doing a table with scores and I want include colors to represent status of an individual. I'm using sweave <>= and xtable but I can't get a result I want. My attemps are #- # code R da <- data.frame(id=le

Re: [R] Recode numbers

2011-06-01 Thread Lisa
Thank you for your help, Pete. I tried b[a], but it is not a1. -- View this message in context: http://r.789695.n4.nabble.com/Recode-numbers-tp3566395p3566534.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailin

[R] Replacing variables in one dataset with those from another

2011-06-01 Thread mcginnis21
Hoping someone out there can help me...this seems like an easy task but I can't figure it out... I want to replace variables in one dataset (Dataset1) with a variable from another dataset (Dataset2). All the values for variables x1 and x2 in Dataset1 have a unique match to the variable uniquenum

Re: [R] lattice panel fine control

2011-06-01 Thread Bert Gunter
It is perhaps not entirely clear from ?update, but update replaces your original lattice call with your new call and re-drawsthe plot. This means that the panel function used for the update() plot is the one in update(), which only draws the line. That's why you see no points. Obviously, then, you

Re: [R] xtable with conditional formatting using \textcolor

2011-06-01 Thread Marc Schwartz
On Jun 1, 2011, at 1:33 PM, Walmes Zeviani wrote: > Hello list, > > I'm doing a table with scores and I want include colors to represent status > of an individual. I'm using sweave <>= and xtable but I can't > get a result I want. My attemps are > > #-

Re: [R] Recode numbers

2011-06-01 Thread Duncan Murdoch
(The attributions are a little messed up here:) I have two sets of numbers that look like a<- c(1, 2, 3, 3, 4, 4, 5, 6, 1, 2, 2, 3, 1, 2, 1, 2, 3, 3, 4, 5, 1, 2, 3, 4) b<- c(1, 5, 8, 9, 14, 20, 3, 10, 12, 6, 16, 7, 11, 13, 17, 18, 2, 4, 15, 19) I just want to use “b” to encode “a” so that “a”

Re: [R] xtable with conditional formatting using \textcolor

2011-06-01 Thread Walmes Zeviani
Marc, Thank you very much. You gave exactly what I wanted. Bests. Walmes. == Walmes Marques Zeviani LEG (Laboratório de Estatística e Geoinformação, 25.450418 S, 49.231759 W) Departamento de Estatística - Universidade Federa

[R] BiodiversityR GUI on macosx

2011-06-01 Thread János Korponai
Dear List! I installed R and quite a few packages I use. When I try to start BiodiversityR the library loads without any problems but GUI do not start. Rcmdr loads without any problems. I am using R 2.13.0 64 bit. Downgrade to R 2.12.2 works. Thanks, Janos __

Re: [R] Qs on "vector of lists", etc.

2011-06-01 Thread Uwe Ligges
On 01.06.2011 18:59, Roy Shimizu wrote: I'm pretty new to R, so please forgive the cluelessness of these questions. Is it true that it is not possible to have a "vector or lists" in R? Is a "list of lists" the closest one can get to a "vector of lists"? Actually a list is a vector of mode "

[R] weird error from MASS::eqcsplot with postscript driver

2011-06-01 Thread Michael Friendly
[Env: R 2.12.2, Win XP] I'm creating figures using MASS::eqcsplot to provide equal scaling of the axes. My figures work OK when I plot to the screen, but when I try to do the same plot as a postscript file, I get an unexplicable error, > figframe() Error in if (yuin > xuin * ratio) yuin <- x

[R] as.character limits length of result for formula

2011-06-01 Thread Terrence Ireland
If you want a character representation of a long formula (or a formula with long names), you can use: as.character(my.formula) However restriction on length of an as.character result returns only the beginning of a long formula, and without comment. In most cases, the following expres

[R] Force the for loop to stop

2011-06-01 Thread Salih Tuna
Hi, I am looking for a command in R that would force the for loop to stop after it finds what it is looking for. As an example for(i in 1:5){ for(j in 3:6){ if(i==j) # do something... break; } } And i don't want the loop to execute once i = 3 and stop. Is there a way to do

Re: [R] Force the for loop to stop

2011-06-01 Thread Stephan Kolassa
Hi, you could set a dummy variable to FALSE outside the outermost loop. If the break condition is met in the inner loop, set the dummy variable to TRUE before breaking and test its truth status in the outer loop. HTH Stephan Am 01.06.2011 21:25, schrieb Salih Tuna: Hi, I am looking for a c

Re: [R] as.character limits length of result for formula

2011-06-01 Thread William Dunlap
as.character() doesn't give a faithful character representation of its input for lots of language- related inputs. E.g., > f <- reformulate(paste(sep="","X",1:500), quote(log(Y))) > cat(strwrap(as.character(f), 60), sep="\n") ~ log(Y) X1 + X2 + X3 + X4 + X5 + X6 + X7 + X8 + X9 + X10 + X1

[R] Contributed Packages - Hmisc & survey

2011-06-01 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
Hello List, Could someone tell why I can't install the Himsc and survey packages for R version 2.13.0 (2011-04-13)? What am I doing wrong here? Thanks, Pradip > install.packages ("Hmisc", dependencies=TRUE) --- Please select a CRAN mirror for use in this session --- Warning: unable to access

Re: [R] Recode numbers

2011-06-01 Thread Lisa
Thank you, Duncan, Here “a” has the length of 24, and “b” has the length of 20 with numbers from 1 to 20 uniquely. I just want encode “a” from 1 to 20 based on “a” current order using “b”. So, a1[1] = b[1] = 1 a1[2] = b[2] = 5 a1[3] = a1[4] = b[3] = 8 (since third and fourth numbers are the same i

[R] problems with copula

2011-06-01 Thread ANGELA86
Hi, I'd like to know why using the program "R" I can't add a number of margins> 3, I have a problem with the graphics. Post here my script: > myCop.norm <- ellipCopula(family = "normal", dim = 3, param = 0.4) > myMvd <- mvdc(copula = myCop.norm, margins = c("norm", "norm","norm"), > paramMargins

[R] RES: Recode numbers

2011-06-01 Thread Filipe Leme Botelho
--- Begin Message --- I think this is proper. a <- c(1, 2, 3, 3, 4, 4, 5, 6, 1, 2, 2, 3, 1, 2, 1, 2, 3, 3, 4, 5, 1, 2, 3, 4) b <- c(1, 5, 8, 9, 14, 20, 3, 10, 12, 6, 16, 7, 11, 13, 17, 18, 2, 4, 15, 19) ref <- 1 for (i in 2:length(a)) { if (a[i]!=a[i-1]) ref <- c(ref, ref[length(ref)]+1) if

[R] Function to save plots

2011-06-01 Thread Merik Nanish
Hello, I'm using ROCR to plot ROC Curves and I want to automate the saving of plots into PNG files using a custom function. My data frames are named like test1, test2, test3. Each data frame has three variables: method1, method2, goldstandard. Right now, for each plot I have to run: png('test1_

Re: [R] Force the for loop to stop

2011-06-01 Thread Salih Tuna
Hi Stephan, Thanks a lot. But i am not very good at R yet so i dont know how to set the dummy variable to FALSE. Can you please help me with that as well? On Wed, Jun 1, 2011 at 8:34 PM, Stephan Kolassa wrote: > Hi, > > you could set a dummy variable to FALSE outside the outermost loop. If the >

Re: [R] Force the for loop to stop

2011-06-01 Thread Stephan Kolassa
Hi Salih, here you go: dummy <- FALSE for ( ii in 1:5 ) { for ( jj in 3:6 ) { cat("ii=",ii,"; jj=",jj,"\n",sep="") if ( ii == jj ) { dummy <- TRUE break } } if ( dummy ) break } ###

Re: [R] Recode numbers

2011-06-01 Thread William Dunlap
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Lisa > Sent: Wednesday, June 01, 2011 12:28 PM > To: r-help@r-project.org > Subject: Re: [R] Recode numbers > > Thank

Re: [R] Function to save plots

2011-06-01 Thread Joshua Wiley
Hi Merik, I believe this does what you want (and maybe a little more): ## define the function, a1 and a2 correspond to your arguments ## d is the directory to save the file in (by default the working directory) ## ... are additional arguments that can be passed to png() to control things like qua

Re: [R] Force the for loop to stop

2011-06-01 Thread Salih Tuna
That is great Stephan, thanks a lot for your help. best, salih On Wed, Jun 1, 2011 at 9:18 PM, Stephan Kolassa wrote: > Hi Salih, > > here you go: > > > dummy <- FALSE > for ( ii in 1:5 ) { > for ( jj in 3:6 ) { >cat("ii=",ii,"; jj=",jj,"\n",sep="

[R] Problems Dating....

2011-06-01 Thread Struckmeier, Nathanael
I'm trying to convert a column in a data frame with dates from a "Factor" type to a "Date Object" but I am encountering and error. (I am having trouble plotting an x,y scatter and I suspect it's something with my data format). I have a table with two columns and 8,000 rows. > dsort=read.delim("C:

Re: [R] re-write plot function for ggplot

2011-06-01 Thread John Ramey
A useful way to get a feel for ggplot2 is to check out http://yeroon.net/ggplot2/ This site allows for a point-and-click ggplot2 graphs. You will not have all of the options from ggplot2 (e.g. themes), but it's a good place to get started. Also, there are some wonderful video tutorials in the hel

[R] finding numbers in a range

2011-06-01 Thread Salih Tuna
Hi, Is there a quick way of finding if numbers in a vector falls in between a range defined in another matrix. As an example let x y 0 1 3 2 6 9 2515 18 I want to check one by one whether 0,2 and 25 falls in any of the ranges in y. I am using 2 for loops but it is taking a hug

Re: [R] weird error from MASS::eqcsplot with postscript driver

2011-06-01 Thread Rolf Turner
The problem is the ``paper="special" '' specification in your eps() function. This makes par("pin"), which eqcsplot() uses in its calculations, undefined. The ``value'' thus produced is: [1] NaN NaN Which makes perfect sense if you think about it. If you're going to use paper=special, you n

Re: [R] Problems Dating....

2011-06-01 Thread Stephan Kolassa
Hi Nat, I guess something like as.Date(as.character("3/4/2007"),format="%d/%m/%Y") should work - as.character() coerces the factors to characters, which the as.Date() function can work with, given the right format argument. HTH Stephan Am 01.06.2011 22:59, schrieb Struckmeier, Nathanael: I'

Re: [R] Problems Dating....

2011-06-01 Thread Marc Schwartz
On Jun 1, 2011, at 3:59 PM, Struckmeier, Nathanael wrote: > I'm trying to convert a column in a data frame with dates from a > "Factor" type to a "Date Object" but I am encountering and error. (I am > having trouble plotting an x,y scatter and I suspect it's something with > my data format). I hav

Re: [R] Contributed Packages - Hmisc & survey

2011-06-01 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Muhuri, Pradip (SAMHSA/CBHSQ) > Sent: Wednesday, June 01, 2011 1:01 PM > To: 'r-help-requ...@r-project.org'; 'R-help@r-project.org' > Subject: [R] Contributed Packages - Hmisc & s

Re: [R] Problems Dating....

2011-06-01 Thread Struckmeier, Nathanael
I'll give this a try and mess with what format to convert it to. Thanks again! -Original Message- From: Stephan Kolassa [mailto:stephan.kola...@gmx.de] Sent: Wednesday, June 01, 2011 2:10 PM To: Struckmeier, Nathanael Cc: R-help@r-project.org Subject: Re: [R] Problems Dating Hi Na

[R] Plotting from functions

2011-06-01 Thread Yang Zhang
I can plot to png's fine when i run this directly from the top-level script/console: png('diamonds.png');qplot(carat,price,data=diamonds);dev.off() But for some reason it's not working when that's in a function: (function(){png('diamonds.png');qplot(carat,price,data=diamonds);dev.off()})() I su

Re: [R] RES: Recode numbers

2011-06-01 Thread Lisa
Thank you so much, Filipe. Your R script is what I am looking for. -- View this message in context: http://r.789695.n4.nabble.com/Recode-numbers-tp3566395p3566818.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org ma

Re: [R] Plotting from functions

2011-06-01 Thread Yang Zhang
On Wed, Jun 1, 2011 at 1:04 PM, Yang Zhang wrote: > I can plot to png's fine when i run this directly from the top-level > script/console: > > png('diamonds.png');qplot(carat,price,data=diamonds);dev.off() > > But for some reason it's not working when that's in a function: > > (function(){png('dia

Re: [R] RES: Recode numbers

2011-06-01 Thread Lisa
Thank you very much, Bill. Your script works very well. -- View this message in context: http://r.789695.n4.nabble.com/Recode-numbers-tp3566395p3566847.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list h

Re: [R] Plotting from functions

2011-06-01 Thread Joshua Wiley
Hi, Within functions, you often do need to wrap the plotting calls in print() (you would see this if you read the FAQ). Cheers, Josh On Wed, Jun 1, 2011 at 1:06 PM, Yang Zhang wrote: > On Wed, Jun 1, 2011 at 1:04 PM, Yang Zhang wrote: >> I can plot to png's fine when i run this directly from

Re: [R] Missing completely at random

2011-06-01 Thread Steven Kennedy
This works, but there might be a better way: misscols<-lapply(howmanyMiss, function(x) sample(1:n, x)) for (i in 1:nMiss){ for (j in misscols[[i]]){ X[idMiss[i],j]<-NA } } __ R-help@r-project.org mailing list https://sta

Re: [R] finding numbers in a range

2011-06-01 Thread David Winsemius
On Jun 1, 2011, at 5:07 PM, Salih Tuna wrote: Hi, Is there a quick way of finding if numbers in a vector falls in between a range defined in another matrix. As an example let x y 0 1 3 2 6 9 2515 18 I want to check one by one whether 0,2 and 25 falls in any of the ran

Re: [R] Create Matrix with Float32 values

2011-06-01 Thread Peter Ehlers
On 2011-06-01 09:16, Chris English wrote: Dear R_Help: The following gives me a matrix with integer values. z= matrix(rep(10:1, each= 10), ncol= 10, byrow=TRUE)> str(z) int [1:10, 1:10] 10 9 8 7 6 5 4 3 2 1 ... How do I specify that I want Float32 values instead. Thanks,Chris Have you tried

Re: [R] Problems Dating....

2011-06-01 Thread David Winsemius
On Jun 1, 2011, at 5:14 PM, Struckmeier, Nathanael wrote: I'll give this a try and mess with what format to convert it to. Thanks again! You need to decide whether to use "%d/%m/%Y" or "%m/%d/%" , since the information you provided so far leaves that undetermined. -- David. Hi Nat, I

Re: [R] Create Matrix with Float32 values

2011-06-01 Thread Duncan Murdoch
On 01/06/2011 12:16 PM, Chris English wrote: Dear R_Help: The following gives me a matrix with integer values. z= matrix(rep(10:1, each= 10), ncol= 10, byrow=TRUE)> str(z) int [1:10, 1:10] 10 9 8 7 6 5 4 3 2 1 ... How do I specify that I want Float32 values instead. You can't. R doesn't sup

Re: [R] Plotting from functions

2011-06-01 Thread Duncan Murdoch
On 01/06/2011 4:06 PM, Yang Zhang wrote: On Wed, Jun 1, 2011 at 1:04 PM, Yang Zhang wrote: I can plot to png's fine when i run this directly from the top-level script/console: png('diamonds.png');qplot(carat,price,data=diamonds);dev.off() But for some reason it's not working when that's in a

Re: [R] Replacing variables in one dataset with those from another

2011-06-01 Thread Dennis Murphy
Hi: Letting d1 and d2 be your two data frames, > merge(d1, d2, by.x = 'x1', by.y = 'num', all.x = TRUE)[, c(2, 4, 3)] grpnum uniqueid x2 1 D 276 2 B 898 3 A GHU82RK02HD7D6 334 4 C GHU82RK02IXPC7 4077 If you want x1 to be the variable name fo

[R] How to write random effect in MCMCglmm

2011-06-01 Thread Belle
Hi All, The data set that I have is a cluster data, and I want to run a HLM mixed model with multi-level response. Here is my data set: response: - Level (num: 1, 2, 3, 4, 5 - 5 levels) Covariates: - Type (Factor: A, B, C - 3 levels) - yr (num: 2006, 2007, ...) - Male (num: 0=not Male

Re: [R] Plotting from functions

2011-06-01 Thread David Scott
On 02/06/11 10:13, Duncan Murdoch wrote: On 01/06/2011 4:06 PM, Yang Zhang wrote: On Wed, Jun 1, 2011 at 1:04 PM, Yang Zhang wrote: I can plot to png's fine when i run this directly from the top-level script/console: png('diamonds.png');qplot(carat,price,data=diamonds);dev.off() But for som

Re: [R] How to write random effect in MCMCglmm

2011-06-01 Thread Ben Bolker
Belle gmail.com> writes: > > Hi All, > > The data set that I have is a cluster data, and I want to run a HLM mixed > model with multi-level response. Here is my data set: > response: [snip] > library(MCMCglmm) > y <- MCMCglmm(factor(Level) ~ Type+factor(yr>=2006)+Male+Ethnicity+ELL+ > avgTra

  1   2   >