Re: [R] sum(hist$density) == 2 ?!

2012-03-13 Thread Jeff Newmiller
Your clue is... density! Probability density is not the same as probability... you have to multiply it by something before you can sum it. Try typing h by itself and review your options. --- Jeff Newmiller

[R] sum(hist$density) == 2 ?!

2012-03-13 Thread Sam Steingold
> x <- rnorm(1000) > h <- hist(x,plot=FALSE) > sum(h$density) [1] 2 - shouldn't it be 1?! > h <- hist(x,plot=FALSE, breaks=(-4:4)) > sum(h$density) [1] 1 - now it's 1. why?! -- Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (onei

Re: [R] Visualising multiple response contingency tables

2012-03-13 Thread ilai
Not sure I understand your question (or if there is one) and I am not familiar with vcd::mosaic. But if you are asking is there a simpler way ? than yes: 1. work with ?array and ?aperm 2. create the array directly in R from the original data - not excel 3. ?mosaicplot (no package required - it's in

Re: [R] multi-histogram plotting

2012-03-13 Thread Sam Steingold
> * David Winsemius [2012-03-13 17:53:14 -0400]: > On Mar 13, 2012, at 5:33 PM, Sam Steingold wrote: >> I can, of course, plot log(h$density), but then the number labels will >> be wrong. > > You could try apply a log transform to the appropriate component of > the "h" object and using barplot to

[R] twitteR package -- geocode

2012-03-13 Thread z2.0
Question: twitteR's searchTwitter() function contains a 'geocode' argument that returns tweets from users whose location falls within a given radius. I'm not completely familiar with the API from which twitteR pulls, but no mechanism exists to extract location coordinates from the tweets themse

Re: [R] Writing a .pdf file within a function - what do I need to return()?

2012-03-13 Thread R. Michael Weylandt
See R FAQ 7.22 -- in short, you need to print() your plot to the graphics device -- just wrap xyplot() in print() and it should work. Michael On Tue, Mar 13, 2012 at 3:55 PM, Dgnn wrote: > I am trying to write a function that generates one PDf containing plots from > several .csv files within a

Re: [R] Rolling regressions with sample extended one period at a time

2012-03-13 Thread R. Michael Weylandt
Perhaps zoo::rollapply from the zoo package can get you started. Michael On Tue, Mar 13, 2012 at 4:49 PM, pie' wrote: > Hi, > > I would like suggestions as to how to perform rolling regressions with the > window extended one period at a time. That is, an initial sample period is > passed to esti

Re: [R] MANOVA and Extra Sums-of-Squares Tests

2012-03-13 Thread John Fox
Dear chris33, Well, actually as I said, the anova() function *will* do what you want. You can fit multivariate linear models with lm(), mod.1 <- lm(cbind(Y1, Y2, Y3, Y4, Y5) ~ X1*X2 +X1*X3 + X1*X4) mod.2 <- lm(cbind(Y1, Y2, Y3, Y4, Y5) ~ X1 + X2 + X3 + X4) and then use anova() to get multivaria

Re: [R] Amount of memory occupied by data type

2012-03-13 Thread David Winsemius
On Mar 13, 2012, at 7:02 PM, Folkes, Michael wrote: Hello all, I was under the (false?) assumption that an object that is class logical, would take up less memory than an object with class integer. Nope. Below am I correctly showing this is not the case? This was an attempt to reduce memor

Re: [R] MANOVA and Extra Sums-of-Squares Tests

2012-03-13 Thread chris33
Hi John, Thanks for your response. The anova funtion will not work in my case, because I have multiple response variables. In other words, I would like to conduct an extra sums-of-squares and cross-products test between the following models: FULL.MODEL: (Y1, Y2, Y3, Y4, Y5) as a function of

Re: [R] how to write crossed and nested random effects in a model

2012-03-13 Thread Ben Bolker
Niroshan ucalgary.ca> writes: > I have a question based on my research. I am analyzing reader-based > diagnostic data set. My study involves diabetic patients who were evaluated > for treatable diabetic retinopathy based on the presence or absence of two > pathologies in their eyes. Pathologies

[R] Amount of memory occupied by data type

2012-03-13 Thread Folkes, Michael
Hello all, I was under the (false?) assumption that an object that is class logical, would take up less memory than an object with class integer. Below am I correctly showing this is not the case? This was an attempt to reduce memory usage. I'm dealing with two large arrays (could be integers).

Re: [R] sunflower plot, making vectors?

2012-03-13 Thread R. Michael Weylandt
I don't know much about sunflowerplots, but perhaps hexagonal binning might make be worth a look in your case if you are generally looking for a scatterplot but the point density is too high. http://cran.r-project.org/web/packages/hexbin/index.html Take a look at the vignettes. You can also hexb

[R] sunflower plot, making vectors?

2012-03-13 Thread Henry
I'm having a bit of trouble finding and understanding the correct function to make numeric vectors to feed the sunflowerplot function. I have 33k points to show and I want to do better than the standard scatter plot. I gather that I need two vectors (x and y) of the same count containing the "cent

Re: [R] 3D Black-Scholes Graph Help!

2012-03-13 Thread ilai
On Tue, Mar 13, 2012 at 3:34 PM, David Winsemius wrote: > > When I got around to running it I was hampered by a lack of knowledge about > what sort of data-object "price" might have been. I tried putting in a > single number on hte theory that it would saitisfy the seq() call, and also >  got the

Re: [R] multi-histogram plotting

2012-03-13 Thread David Winsemius
On Mar 13, 2012, at 5:33 PM, Sam Steingold wrote: I have a vector x: table(x) 2 3 4 5 6 7 8 9101112 1314 45547 11835 4692 2241 1386 820 593 425 298 239 176 158 115 1516171819202122232

Re: [R] help please. 2 tables, which test?

2012-03-13 Thread Greg Snow
For this case I would use a permutation test. Start by choosing some statistic that represents your 4 students across the different grades, some possibilities would be the sum of scores across grades and students, or mean, or median, or ... Compute the selected statistic for your 4 students and s

Re: [R] 3D Black-Scholes Graph Help!

2012-03-13 Thread David Winsemius
On Mar 13, 2012, at 4:49 PM, Berend Hasselman wrote: On 13-03-2012, at 21:40, David Winsemius wrote: On Mar 13, 2012, at 4:24 PM, Anna Dunietz wrote: Hello all! I would like to create a 3d plot, with the option price explained by the underlying price and time. Unfortunately, I can't q

[R] multi-histogram plotting

2012-03-13 Thread Sam Steingold
I have a vector x: table(x) 2 3 4 5 6 7 8 91011121314 45547 11835 4692 2241 1386 820 593 425 298 239 176 158 115 15161718192021222324252627 9488766747

Re: [R] Interface or Select menu

2012-03-13 Thread Marcio Pupin Mello
For Windows you can use winMenuAdd function. Type ?winAddMenu to see how... Good luck, Marcio www.dsr.inpe.br/~mello On 3/6/08 10:35 AM, Alberto Monteiro wrote: er MIMI& piki PIKINHA wrote: Hello, I´m spanish student, and I´m making the finish project of computer science. I´m working in R

Re: [R] MANOVA and Extra Sums-of-Squares Tests

2012-03-13 Thread John Fox
Dear chris33, You can use the anova() function to compare the two multivariate linear models. Alternatively, the Anova() function in the car package will compute "type II" or "type III" MANOVA tests, which aren't quite what you're asking about. I hope this helps, John

[R] Rolling regressions with sample extended one period at a time

2012-03-13 Thread pie'
Hi, I would like suggestions as to how to perform rolling regressions with the window extended one period at a time. That is, an initial sample period is passed to estimation and that very sample is then extended one period at a time through the remaining sample. Is there a specific package? Thnk

[R] Writing a .pdf file within a function - what do I need to return()?

2012-03-13 Thread Dgnn
I am trying to write a function that generates one PDf containing plots from several .csv files within a directory. When I manually execute the code it seems to work, but not when it is a function. I think I need to return() something, but haven't had much luck figuring out what/how. plot.isi<-fu

[R] MANOVA and Extra Sums-of-Squares Tests

2012-03-13 Thread chris33
I would like to conduct an extra sum-of -squares test that compares a full MANOVA model (with all 1st order interactions) to a reduced model (no interactions) to determine if I can drop all interactions at the same time. This is analagous to an extra sum-of-squares F-test in ANOVA, but instead usi

Re: [R] 3D Black-Scholes Graph Help!

2012-03-13 Thread Berend Hasselman
On 13-03-2012, at 21:40, David Winsemius wrote: > > On Mar 13, 2012, at 4:24 PM, Anna Dunietz wrote: > >> Hello all! >> >> I would like to create a 3d plot, with the option price explained by the >> underlying price and time. Unfortunately, I can't quite get it to work. I >> would very muc

Re: [R] 3D Black-Scholes Graph Help!

2012-03-13 Thread David Winsemius
On Mar 13, 2012, at 4:24 PM, Anna Dunietz wrote: Hello all! I would like to create a 3d plot, with the option price explained by the underlying price and time. Unfortunately, I can't quite get it to work. I would very much appreciate your help! The usual problem with lattice calls th

[R] 3D Black-Scholes Graph Help!

2012-03-13 Thread Anna Dunietz
Hello all! I would like to create a 3d plot, with the option price explained by the underlying price and time. Unfortunately, I can't quite get it to work. I would very much appreciate your help! Thanks, Anna # Black-Scholes Option Graph library(lattice) blackscholes <- function(s, k,

Re: [R] beginner's loop issue

2012-03-13 Thread Paul Johnson
On Tue, Mar 13, 2012 at 11:27 AM, aledanda wrote: > Dear All, > > I hope you don't mind helping me with this small issue. I haven't been using > R in years and I'm trying to fill in a matrix > with the output of a function (I'm probably using the Matlab logic here and > it's not working). > Here i

Re: [R] size of graphs when using multiple figures by row

2012-03-13 Thread Jean V Adams
Personally, I find it easier to fix the overall size of the "page" and modify the margins in line size (mar and oma rather than mai and omi), until I get the plots the way I want them. You don't specify what OS you're using, but in windows, I would use something like windows(h=16, w=9) par(mfr

Re: [R] simulate an gradually increase of the number of subjects based on two variables

2012-03-13 Thread Paul Johnson
Suggestion below: On Tue, Mar 13, 2012 at 1:24 PM, guillaume chaumet wrote: > I omit to precise that I already try to generate data based on the mean and > sd of two variables. > > x=rnorm(20,1,5)+1:20 > > y=rnorm(20,1,7)+41:60 > > simu<-function(x,y,n) { >    simu=vector("list",length=n) > >    

Re: [R] Using caegorical variables in package randomForest.

2012-03-13 Thread Liaw, Andy
The way to represent categorical variables is with factors. See ?factor. randomForest() will handle factors appropriately, as most modeling functions in R. Andy > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of abhishek >

Re: [R] reshaping a dataset for a network

2012-03-13 Thread William Dunlap
Is the following what you want? > a <- c(1,2,3,4,4,4,5,5) > b <- c(11,7,4,9,8,3,12,4) > split(b, a) $1 [1] 11 $2 [1] 7 $3 [1] 4 $4 [1] 9 8 3 $5 [1] 12 4 Note that your df<-cbind(a,b) produces a matrix, not the data.frame that your df suggests you want. Use df<-da

[R] filter out some gene sets

2012-03-13 Thread elodie
I am working on the following database of gene sets. database<-GSA.read.gmt( "C:/c5.all.v2.5.symbols.gmt") I need to filter out the gene sets that contain less than 5 genes or more than 200 genes. I would appreciate help with that matter. Thanks in advance [[alternative HTML version

[R] reshaping a dataset for a network

2012-03-13 Thread Marco Guerzoni
dear all, apologizes for bothering with a probably stupid question but I really don' t know how to proceed. I have a dataset which look like df a <- c(1,2,3,4,4,4,5,5) b <- c(11,7,4,9,8,3,12,4) df <-cbind(a,b) I would like to have one which looks like this: a 1 11 2 7 3 4 4 9 8 3 5 12 4 a a

Re: [R] p-value of the pooled Z score

2012-03-13 Thread Thomas Lumley
On Wed, Mar 14, 2012 at 3:41 AM, cheba meier wrote: > Hello, > > I have to compute the pooled z-value and I would like to know which way is > more appropriate > > > b <- c( -0.205,1.040,0.087) > s <- c(0.449,0.167,0.241) > n <- c(310, 342, 348) > z <- b/s > > Z <- sum(z)/sqrt(length(n)) > P <- 2*(

Re: [R] Idea/package to "linearize a curve" along the diagonal?

2012-03-13 Thread Emmanuel Levy
Dear David and Jeff, > Only if you were going apply some sort of transformation that did not extend > globally Exactly, this is why the LPCM package is great, as it assigns points to parts of a curve. I think I pretty much got what I need - it is not perfect yet but it should be enough to give

Re: [R] simulate an gradually increase of the number of subjects based on two variables

2012-03-13 Thread guillaume chaumet
I omit to precise that I already try to generate data based on the mean and sd of two variables. x=rnorm(20,1,5)+1:20 y=rnorm(20,1,7)+41:60 simu<-function(x,y,n) { simu=vector("list",length=n) for(i in 1:n) { x=c(x,rnorm(1,mean(x),sd(x))) y=c(y,rnorm(1,mean(y),sd(y)))

[R] ess-tracebug to open a file

2012-03-13 Thread Feng Li
Dear all, First I would like to thank the ESS people's all the hard work. I am watching the project closely and witnessing the improvements day by day. Besides I found a strange situation using `ess-tracebug'. Please tell me if I am wrong or this is a bug. Start Emacs with "emacs -Q" and lo

Re: [R] Converting factor data into Date-time format

2012-03-13 Thread R. Michael Weylandt
No problem. A pro-tip for future posts: the dput() function creates a plain text representation of the data in question which is great for email and is nicely copy-and-pasteable. It wasn't so much a thing here, but for large or complicated data sets, the regular console printout doesn't always rev

[R] Error : package is not installed for 'arch=x64'

2012-03-13 Thread Li, Yan
HI All, I got the error : package is not installed for 'arch=x64' when building my own package for 64bit R. How can I configure the arch ? The 'R CMD config' does not work. Thank you very much! The detailed error is : ** testing if installed package can be loaded Error : package 'xxx' is not

Re: [R] reproducible sample() in mclapply

2012-03-13 Thread David Winsemius
On Mar 13, 2012, at 12:51 PM, Lik Wee Lee wrote: Hi, Using the multicore package and calling sample() in mclapply, how do I get the results to be reproducible? I know the random number is seeded by process id and so is different for each run. You might want to look up the thread in last mont

Re: [R] reproducible sample() in mclapply

2012-03-13 Thread Berend Hasselman
On 13-03-2012, at 17:51, Lik Wee Lee wrote: > Hi, > > Using the multicore package and calling sample() in mclapply, > how do I get the results to be reproducible? > I know the random number is seeded by process id and so is > different for each run. Don't know about those two packages. Have a l

Re: [R] what does "rlm" do if it fails to converge within iteration limits?

2012-03-13 Thread Martin Maechler
> Michael > on Mon, 12 Mar 2012 13:19:19 -0500 writes: > The problem is: by default shouldn't it use "Huber's"? > And it should be convex problem no? > so when I do rlm(y~x) which is a single-beta fitting problem, > shouldn't it always converge? “In theory, theory

Re: [R] Error " subscript out of bounds"

2012-03-13 Thread Houhou Li
Thank you very much David. I should realize myslef that operator precedence cause the problem. Sorry about this:-) I solved the problem. --- On Tue, 3/13/12, David Winsemius wrote: From: David Winsemius Subject: Re: [R] Error " subscript out of bounds" To: "Houhou Li" Cc: r-help@r-project.or

Re: [R] Converting factor data into Date-time format

2012-03-13 Thread R. Michael Weylandt
Just a little typo: see below. On Tue, Mar 13, 2012 at 1:00 PM, Haojie Yan wrote: > Dear Michael, > > Thanks a lot for your hints. > > I have just had a try as below but still got back some error messages as > shown: > > The object containing the 'date_time' data is named 'INTERVAL_END_TIME' and

Re: [R] beginner's loop issue

2012-03-13 Thread R. Michael Weylandt
Yes, the short answer is that you need to define out before running the loop. The most effective way to do so will be to set up a matrix with the exact right dimensions (if you know them up front); something like out <- matrix(NA, nrow = length(input), ncol = 9) Michael On Tue, Mar 13, 2012 at

[R] reproducible sample() in mclapply

2012-03-13 Thread Lik Wee Lee
Hi, Using the multicore package and calling sample() in mclapply, how do I get the results to be reproducible? I know the random number is seeded by process id and so is different for each run. Thanks, Lik [[alternative HTML version deleted]]

[R] beginner's loop issue

2012-03-13 Thread aledanda
Dear All, I hope you don't mind helping me with this small issue. I haven't been using R in years and I'm trying to fill in a matrix with the output of a function (I'm probably using the Matlab logic here and it's not working). Here is my code: for (i in 1:length(input)){ out[i,1:3] <- MyFunc

Re: [R] Converting factor data into Date-time format

2012-03-13 Thread Gabor Grothendieck
On Tue, Mar 13, 2012 at 12:20 PM, Haojie Yan wrote: > Dear R-user, > > I have read a dataset from .csv file into R. This dataset includes one > column containing some data in 'date and time' format, e.g. 'dd/mm/ > hh:mm'. > > These data were automatically read and saved as 'factor' in R. When

Re: [R] Converting factor data into Date-time format

2012-03-13 Thread Joshua Wiley
This is just a little comment to supplement Michael's excellent solution. If there are even a few (e.g., 5 each) repeated values, this: as.POSIXct(as.character(levels(x)), format = "%d/%m/%Y %H:%M")[x] will be substantially faster, with the speed gains strongly associated with the number of repl

Re: [R] Error " subscript out of bounds"

2012-03-13 Thread David Winsemius
On Mar 13, 2012, at 12:18 PM, Houhou Li wrote: Hello, R-users, I have a datafile with 37313 records and each record has 5 different measurements on the same variables. The format looks like this: treeID, VIG0, VIG1, VIG2, VIG3, VIG4 I was trying to convert the one row record to 5 rows reco

Re: [R] Faceted bar plot shows wrong counts (ggplot2)

2012-03-13 Thread Helios de Rosario
Michael, Thanks for the pointer to the discussion in the ggplot list. It seems that the reason of this behaviour of facet_grid() is already known and being discussed by the developers of ggplot2. facet_grid() reduces the original data frame with unique() before applying the stats. If the data fr

Re: [R] how to find best model of time series?

2012-03-13 Thread R. Michael Weylandt
Take a look at example(HoltWinters) Michael On Tue, Mar 13, 2012 at 11:06 AM, sagarnikam123 wrote: > i have data in one file below like  & (i have such type of file =200,each > file have below type of data) >>t > -0.15264004 > 0.056076439 > -0.07276116 > -0.00917326 > -0.02069089 > -0.00416232

Re: [R] Sum results in a matrix

2012-03-13 Thread R. Michael Weylandt
res3 + t(res3) Michael On Tue, Mar 13, 2012 at 8:15 AM, RMSOPS wrote: > Hello, >     With the following code get the results array > res3<-table(df$v_source,df$v_destine) > >  1  2  3  4  5  6  7 >  1  0 10  0  0  0  0  0 >  2 11  0  0  0  0  0  0 >  3  0  0 18 15  0  0  0 >  4  0  0 15 11  0  0

Re: [R] Converting factor data into Date-time format

2012-03-13 Thread R. Michael Weylandt
as.POSIXct(as.character(FACTORHERE), format = "%d/%m/%Y %H:%M") Michael On Tue, Mar 13, 2012 at 12:20 PM, Haojie Yan wrote: > Dear R-user, > > I have read a dataset from .csv file into R. This dataset includes one > column containing some data in 'date and time' format, e.g. 'dd/mm/ > hh:mm'

[R] Converting factor data into Date-time format

2012-03-13 Thread Haojie Yan
Dear R-user, I have read a dataset from .csv file into R. This dataset includes one column containing some data in 'date and time' format, e.g. 'dd/mm/ hh:mm'. These data were automatically read and saved as 'factor' in R. When I was trying to produce some plots (such as time series) with the

[R] Error " subscript out of bounds"

2012-03-13 Thread Houhou Li
Hello, R-users,   I have a datafile with 37313 records and each record has 5 different measurements on the same variables. The format looks like this: treeID, VIG0, VIG1, VIG2, VIG3, VIG4 I was trying to convert the one row record to 5 rows record with format like this (treeID, MEASUREMENT, VIGO

Re: [R] R-help-es have reached 500 members!

2012-03-13 Thread Igor Sosa Mayor
:) congratulations! On Tue, Mar 13, 2012 at 08:59:56AM -0600, Kjetil Halvorsen wrote: > This posting is only to celebrate that R-help-es (R-help for Spanish > Speakers) have reached 500 > members! > > (and to thank Patricia for doing the bulk of admin work). > > Kjetil > >

Re: [R] Standard errors GLM

2012-03-13 Thread Rubén Roa
You have a conceptual problem, as pointed out by previous helpers. You don't have a standard error for the first level of your categorical variable because that level's effect is not estimated. It is being used as a reference level against which the other levels of that categorical variable are b

Re: [R] Matrix Another table

2012-03-13 Thread RMSOPS
Hello, this solve my problem. table(testdata$source, testdata$destine) Thanks -- View this message in context: http://r.789695.n4.nabble.com/Re-Matrix-Another-table-tp4469376p4469384.html Sent from the R help mailing list archive at Nabble.com. __

[R] how to find best model of time series?

2012-03-13 Thread sagarnikam123
i have data in one file below like & (i have such type of file =200,each file have below type of data) >t -0.15264004 0.056076439 -0.07276116 -0.00917326 -0.02069089 -0.00416232 -0.07225855 -0.02654577 -0.06131410 -0.09380202 0.057414014 -0.05239976 0.014397612 0.016145161 -0.00670587 0.018696335

Re: [R] Matrix Results

2012-03-13 Thread RMSOPS
Hello Error: could not find function sqldf: Hello, I'm using R Studio, and installed the option of installing the packages sqldbf function. But When I run the code give the next error. install.packages("sqldf") library("RSQLite") require(sqldf) x <- read.fwf(textConnection("4 - 4 5

[R] ROC Analysis

2012-03-13 Thread Camille Leclerc
Hi everybody, I have a data set with a value and a status (positive or negative case) and I want make a ROC Analysis. So, with ROCR Package, I have got the ROC curve (True Positive Fraction [tpf] according 1-True Negative Fraction [1-tnf]). http://r.789695.n4.nabble.com/file/n4469203/01.png But

Re: [R] Standard errors GLM

2012-03-13 Thread David Winsemius
On Mar 13, 2012, at 9:38 AM, D_Tomas wrote: Dear userRs, when applied the summary function to a glm fit (e.g Poisson) the parameter table provides the categorical variables assuming that the first level estimate (in alphabetical order) is 0. Not really. It returns an estimate for the cont

Re: [R] Matrix Another table

2012-03-13 Thread Sarah Goslee
Hi, On Tue, Mar 13, 2012 at 7:51 AM, RMSOPS wrote: > I have next table > source destine > 3 3 > 7 7 > 6 6 > 3 4 >  4 4 >  4 3 > 3 3 > 3 3 >  3 3 >  3 3 > 3 4 >  4 4 >  4 3 >  3 4 >  4 3 It is so much easier if you use dput to provide reproducible data, as the posting guide asks. There's no way f

Re: [R] Standard errors GLM

2012-03-13 Thread Joshua Wiley
Hi, See inline. On Tue, Mar 13, 2012 at 6:38 AM, D_Tomas wrote: > Dear userRs, > > when applied the summary function to a glm fit (e.g Poisson) the parameter > table provides the categorical variables assuming that the first level > estimate (in alphabetical order) is 0. > > What is the standard

[R] R-help-es have reached 500 members!

2012-03-13 Thread Kjetil Halvorsen
This posting is only to celebrate that R-help-es (R-help for Spanish Speakers) have reached 500 members! (and to thank Patricia for doing the bulk of admin work). Kjetil __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

[R] p-value of the pooled Z score

2012-03-13 Thread cheba meier
Hello, I have to compute the pooled z-value and I would like to know which way is more appropriate b <- c( -0.205,1.040,0.087) s <- c(0.449,0.167,0.241) n <- c(310, 342, 348) z <- b/s Z <- sum(z)/sqrt(length(n)) P <- 2*(1-pnorm(abs(Z))) P w <- sqrt(n) Zw <- sum(w * z)/sqrt(sum(w^2)) Pw <- 1 -

Re: [R] Definition of generic function for subclasses

2012-03-13 Thread Alexander
The definition of simple in "Keep your class hierarchy simple and relevant to your actual problem" is quite difficult. For someone who has programmed the classes etc, it is quite simple to understand the heritance. But for example for someone else, who has to maintain the code and the classes, it m

[R] Standard errors GLM

2012-03-13 Thread D_Tomas
Dear userRs, when applied the summary function to a glm fit (e.g Poisson) the parameter table provides the categorical variables assuming that the first level estimate (in alphabetical order) is 0. What is the standard error for that variable then? Are the standard errors calculated assuming

Re: [R] sort list

2012-03-13 Thread sybil kennelly
Thanks Josh. I'm quite new, just wondering re:factor levels? In this example (shamelessly stolen from the internet): *schtyp* [1] 0 0 1 0 0 0 1 0 1 0 1 1 1 1 0 0 1 1 1 0 *schtyp.f <- factor(schtyp, labels = c("private", "public")) schtyp.f* [1] private private public private private private p

[R] Sum results in a matrix

2012-03-13 Thread RMSOPS
Hello, With the following code get the results array res3<-table(df$v_source,df$v_destine) 1 2 3 4 5 6 7 1 0 10 0 0 0 0 0 2 11 0 0 0 0 0 0 3 0 0 18 15 0 0 0 4 0 0 15 11 0 0 0 5 0 0 0 0 1 0 0 6 0 0 0 0 0 1 0 7 0 0 0 0 0 0 18 my

[R] To generate a pmml for an "hclust" object, showing the error "Error in .Internal(inherits(x, what, which)) : 'x' is missing"

2012-03-13 Thread Yashwanth M.R
# # ## Iris data ## data(iris) #

[R] Using caegorical variables in package randomForest.

2012-03-13 Thread abhishek
Hello, I am sorry if there are already post that answers to this question but i tried to find them before making this post. I did not really find relevant posts. I am using randomForest package for building a two class classifier. There are categorical variables and numerical variables in my data

[R] Matrix Another table

2012-03-13 Thread RMSOPS
I have next table source destine 3 3 7 7 6 6 3 4 4 4 4 3 3 3 3 3 3 3 3 3 3 4 4 4 4 3 3 4 4 3 I'm trying to create an array with the number of occurrences between the source and destination. id_ap<-levels(factor(df$v_source)) num_AP<-length(levels(factor(df$v_source))) mat<-matrix(

Re: [R] Matrix Results

2012-03-13 Thread RMSOPS
Hello is the dataset that was sent to help, has over two columns the source and destination, is the separation of position pos POS DIF SourceDest 4 - 4 56 4 4 4 - 3 61 4 3 3 - 3 300 3 3 3 -

[R] Matrix Counts

2012-03-13 Thread RMSOPS
I have next table source destine 33 77 6 6 3 4 4 4 4 3 3 3 3 3 3 3 3 3 3 4 4 4 4 3 3 4 4 3 I'm trying to create an array with the number of occurrences between the source and destination. id_ap<-level

[R] Visualising multiple response contingency tables

2012-03-13 Thread Marcos Pelenur
Dear R Help Community, I have a question and an answer (based on reading this forum and online research), but I though I should share both since probably there's a much better way to go about my solution. My question is specifically about how to best visualise multiple response contingency tables.

Re: [R] Coding C++ in R. What is faster : Using bosst external libraries or R.h header file?

2012-03-13 Thread Ian Schiller
Thank you Michael, Your advices are truly appreciated! Ian -Original Message- From: R. Michael Weylandt [mailto:michael.weyla...@gmail.com] Sent: 13 mars 2012 09:44 To: Ian Schiller Cc: r-help@r-project.org Subject: Re: [R] Coding C++ in R. What is faster : Using bosst external librari

Re: [R] Coding C++ in R. What is faster : Using bosst external libraries or R.h header file?

2012-03-13 Thread R. Michael Weylandt
There will be ever-so-slight performance differences due to implementation differences (I believe R's functions are just a hair slower because they are more exact -- though that may be a comparison with GSL I'm thinking of), but my advice would be to use the RNGs that come with R. They are the best

Re: [R] Matrix Results

2012-03-13 Thread jim holtman
Try this: > require(sqldf) > x <- read.fwf(textConnection("4 - 4 56 + 4 - 3 61 + 3 - 3 300 + 3 - 327 + 3 - 3 33 + 3 - 3 87 + 3 - 4 49 + 4 - 4 71 + 4 - 3 121 + 3 - 4 138 + 4 - 3 15"), width = c(7,8) , header = FALSE, as.is = TRUE) > close

Re: [R] Definition of generic function for subclasses

2012-03-13 Thread Martin Morgan
On 03/13/2012 04:34 AM, Alexander wrote: Hi, I am working on a project, which contains S4 classes and subclasses. Lets assume the following organisation: A: S4 Class B,C: inherit from A D,E,F,G: inherit from B H,I: inherit from C I want to define now a generic function, which returns me the name

[R] Coding C++ in R. What is faster : Using bosst external libraries or R.h header file?

2012-03-13 Thread Ian Schiller
Hi everyone, I have built an R package and for the sake of speed I have decided to rewrite some part of the code in C++. In my original R code I use the pnorm, qnorm, rnorm, pgamma, dgamma, rgamma, rbeta and runif function. First I was thinking in going with the boost libraries, but I noticed

Re: [R] File data to data.frame

2012-03-13 Thread jim holtman
try this: > x <- readLines(textConnection(" + ")) > > closeAllConnections() > > # process & parse the data > for (i in x){ + if (grepl("^username", i)) username <- sub(".*=(.*)", '\\1', i) + if (grepl("^password", i)){ + password <- sub(".*=(.*)", "\\1", i) + cat("found: us

Re: [R] sort list

2012-03-13 Thread Joshua Wiley
On Tue, Mar 13, 2012 at 5:15 AM, sybil kennelly wrote: > Thanks Josh. I'm quite new, just wondering re:factor levels? > > In this example (shamelessly stolen from the internet): > > schtyp > > [1] 0 0 1 0 0 0 1 0 1 0 1 1 1 1 0 0 1 1 1 0 > > schtyp.f <- factor(schtyp, labels = c("private", "public"

Re: [R] replacing values in Array

2012-03-13 Thread Gerrit Eichner
Hello, "uday", e.g., (data - 1) %/% 3 + 1 would do the job in your very specific situation, but take a look at ?findInterval for possibly more interesting (because more general) solutions. Hth -- Gerrit On Tue, 13 Mar 2012, uday wrote: I want to replace some values in my Array e.g data<

Re: [R] sort list

2012-03-13 Thread Joshua Wiley
Hi Sybil, You cannot turn a list into a factor. You could do: cell_data <-c('cell1','cell2') factor_list <- factor(cell_data) or if you already have a list, unlist() or as.vector() may convert it into a vector that you can then convert to a factor. Cheers, Josh On Tue, Mar 13, 2012 at 4:29 A

Re: [R] Matrix Results

2012-03-13 Thread Petr PIKAL
Hi > > Hello > >I am developing a small program that to calculate the maximum, minimum > and average. > > The data.frame v is > > POS DIF > 4 - 4 56 > 4 - 3 61 > 3 - 3 300 > 3 - 327 > 3 - 3 33 > 3 - 3 87 > 3 - 4 49 > 4 - 4 71 > 4

[R] Definition of generic function for subclasses

2012-03-13 Thread Alexander
Hi, I am working on a project, which contains S4 classes and subclasses. Lets assume the following organisation: A: S4 Class B,C: inherit from A D,E,F,G: inherit from B H,I: inherit from C I want to define now a generic function, which returns me the name of the class. I can now write the function

[R] sort list

2012-03-13 Thread sybil kennelly
Hello can anyone help please? i read two words "cell1", "cell2" into a list. I want to turn this list into a factor. > cell_data <-list(c('cell1','cell2')) > cell_data [[1]] [1] "cell1" "cell2" > factor_list <- factor(cell_data) Error in sort.list(y) : 'x' must be atomic for 'sort.list' Have

[R] replacing values in Array

2012-03-13 Thread uday
I want to replace some values in my Array e.g data<- c(1,2,3,4,5,6,7,8,9,10,11,12) I would like to replace 1,2,3 by 1 , 4,5,6 by 2, 7,8,9 by 3 and 10,11,12 by 4 I am expecting out put data<- 1 1 1 2 2 2 3 3 3 4 4 4 I have tried replace function replace(data, (data==1 |data==2| data==3),1)

[R] size of graphs when using multiple figures by row

2012-03-13 Thread Nerak
Hi all, I have a basic question concerning graphs in R. I’m using the par() function and I’m working with multiple figures by row (mfrow) but my the hight of my figures become compressed. I have 4 rows and 2 columns (because I want to plot 8 histograms (freq = FALSE ) on it. I know I can adapt my

Re: [R] Help with plot Grouped Bar Plot by using R

2012-03-13 Thread R_beginner_starter
Hi, Jim Below is the code that I try and the result I obtained: *br<-read.table("R_beginner_starter.dat",header=TRUE,sep="\t") library(plotrix) barp(t(br[,c(2,4)])) * The result generated: http://r.789695.n4.nabble.com/file/n4468592/ScreenHunter_01_Mar._13_17.10.jpg Which is different with m

[R] Matrix Results

2012-03-13 Thread RMSOPS
Hello I am developing a small program that to calculate the maximum, minimum and average. The data.frame v is POS DIF 4 - 4 56 4 - 3 61 3 - 3 300 3 - 327 3 - 3 33 3 - 3 87 3 - 4 49 4 - 4 71 4 - 3 121 3 - 4 138 4 - 3 15

[R] File data to data.frame

2012-03-13 Thread b4d
Hi, I am playing around with some data and I would like to get data that is stored in a file like this: ... to the data.frame structure, how can I do that directly in R, currently I am doing parse with bash, but I would like to centralize the procedure and learn something new. Thanks -- View

Re: [R] Manipulate strings reordering some elements

2012-03-13 Thread Igor Sosa Mayor
Berend: 1. 1000 thanks for your help. It works perfectly 2. many thanks for the analysis of the expression; i will try to understand it. Perl is really not easy to read thanks again! On Tue, Mar 13, 2012 at 11:51:49AM +0100, Berend Hasselman wrote: > > On 13-03-2012, at 11:28, Igor Sosa Mayor w

Re: [R] Manipulate strings reordering some elements

2012-03-13 Thread Berend Hasselman
On 13-03-2012, at 11:28, Igor Sosa Mayor wrote: > many thanks, Berend. > > It works well... but with a problem because i was not completely clear > in my first email. > > It works with cases such as: > Franco (El) > Regueras (Las) > > but not with other cases such as: > Fauces de San Andrés (L

Re: [R] Manipulate strings reordering some elements

2012-03-13 Thread Igor Sosa Mayor
many thanks, Berend. It works well... but with a problem because i was not completely clear in my first email. It works with cases such as: Franco (El) Regueras (Las) but not with other cases such as: Fauces de San Andrés (Las) any hints? or meaybe if it is very complicated, any short explanati

Re: [R] customizing help, how to replace r.css of all packages

2012-03-13 Thread Joshua Wiley
Hi, Probably yes, but I think this would be more easily handled through the command prompt or some shell. On the command prompt, I would look at "xcopy". xcopy /? will show the arguments available. You will need to do a bit of work to get a list of all the directories to copy your r.css file i

Re: [R] 2 images on one plot

2012-03-13 Thread Petr PIKAL
Thanks Jim For the first glance it seems to do what I want. I must go through it more thoroughly. Petr > > On 03/13/2012 03:07 AM, Petr PIKAL wrote: > > Dear all > > > > with image I can plot only one set of values in one plot. > > > > Do somebody have any insight how to put those 2 matrices i

  1   2   >