[R] Ignoring loadNamespace errors when loading a file

2011-08-22 Thread Allan Engelhardt
On a Unix machine I ran caret::rfe using the multicore package, and I saved the resulting object using save(lm2, file = lm2.RData). [Reproducible example below.] When I try to load(lm2.RData) on my Windows laptop, I get Error in loadNamespace(name) : there is no package called 'multicore' I

Re: [R] Changing data scales

2011-08-22 Thread Jim Lemon
On 08/22/2011 10:04 AM, Jim Silverton wrote: I have data that ranges from 0.3 to 2 and I want to change the scale to be from 0 to 1. Can this be done in R? Hi Jim, library(prettyR) rescale(x,c(0,1)) will linearly transform x into the specified range. Jim

Re: [R] I have a problem with R!!

2011-08-22 Thread Petr PIKAL
Hi Your code is rather baroque and it is difficult to see what is exactly going on without having appropriate data. I does not consider your process of reading data from Excel problematic. Maybe the difference is in that d- rnorm(whatever) produces vector while d- read.delim(clipboard,

Re: [R] Quadratic equation

2011-08-22 Thread Uwe Ligges
On 22.08.2011 03:34, Brad Patrick Schneid wrote: these guys wont help you with your homework. But have you ever heard of Google?... if so, R has plenty of online manuals and cheat sheets. 1. This went to R-help (and hence not necessarily to the original poster). 2. You forgot to cite the

Re: [R] Wiki/revision control to management of CRAN package repository

2011-08-22 Thread Philippe Grosjean
Hello, For the R Wiki, not very realistic to think about fusing it with the other tools, due to the nature of a wiki on one hand, and the necessity to share the CRAN site across different repositories on the other hand. Also, I think that packages development is in the hand of their

Re: [R] Ignoring loadNamespace errors when loading a file

2011-08-22 Thread Uwe Ligges
On 22.08.2011 08:52, Allan Engelhardt wrote: On a Unix machine I ran caret::rfe using the multicore package, and I saved the resulting object using save(lm2, file = lm2.RData). [Reproducible example below.] When I try to load(lm2.RData) on my Windows laptop, I get Error in

Re: [R] Multiple R linear models into one Latex table

2011-08-22 Thread Rmh
please look at the latex() function in package Hmisc. Sent from my iPhone On Aug 22, 2011, at 0:55, Alex Ruiz Euler rruizeu...@ucsd.edu wrote: Dear community, I had been looking for an easy way to produce latex tables from R output. xtable() and the package apsrtable produce good

Re: [R] questions about metafor package

2011-08-22 Thread Mike Cheung
Hi, Emilie. For your second question. You may check Gleser and Olkin (2009). They gave several formulas to estimate the sampling covariance for dependent effect sizes. One of them can be applied in your case. Gleser, L. J., Olkin, I. (2009). Stochastically dependent effect sizes. In H. Cooper,

Re: [R] Multiple R linear models into one Latex table

2011-08-22 Thread Matevž Pavlič
Hi, thanks for the help. Class says as follows : class(DF) [1] SpatialPointsDataFrame attr(,package) [1] sp class(grd) [1] SpatialPixels attr(,package) [1] sp Anyway, the problem was, as Rmh suggested, with the zerodist(). Tnx, m -Original Message- From:

Re: [R] Multiple R linear models into one Latex table

2011-08-22 Thread Matevž Pavlič
Sorry wrong thread ;) m -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Matevž Pavlič Sent: Monday, August 22, 2011 12:14 PM To: Rmh; Alex Ruiz Euler Cc: r-help@r-project.org Subject: Re: [R] Multiple R linear models into one

Re: [R] Sweave doesn't work

2011-08-22 Thread Eik Vettorazzi
Hi Daniele, _ in dati_england is treated as a special character in LaTeX math mode and causes your LaTeX-compiler trying to switch to math mode (you might have noticed a warning abaout missing `$' inserted). To produce a plain _ in TeX you have to mask it as \_. Package Hmisc has some sanitization

Re: [R] Ignoring loadNamespace errors when loading a file

2011-08-22 Thread Martin Morgan
On 08/21/2011 11:52 PM, Allan Engelhardt wrote: On a Unix machine I ran caret::rfe using the multicore package, and I saved the resulting object using save(lm2, file = lm2.RData). [Reproducible example below.] When I try to load(lm2.RData) on my Windows laptop, I get Error in

[R] Data Frame Indexing

2011-08-22 Thread Jesse Brown
Hello, I've been dealing with a set of values that contain time stamps and part of my summary needs to look at just weekend data. In trying to limit the data I've found a large difference in performance in the way I index a data frame. I've constructed a minimal example here to try to explain

[R] Selecting cases from matrices stored in lists

2011-08-22 Thread mdvaan
Hi, I have two lists (c and h - see below) containing matrices with similar cases but different values. I want to split these matrices into multiple matrices based on the values in h. So, I did the following: years-c(1997:1999) for (t in 1:length(years)) {

[R] Did I find a bug on TSERIES or URCA packages?

2011-08-22 Thread Dail
I'm tring the functions to check the cointegration of a matrix. I'm using **Phillips Ouliaris Cointegration Test** The function in *tseries* package is **po.test** and **ca.po** in *urca* The results with **URCA** are: ca.po(prices, demean='none')

Re: [R] Histogram from frequency data in pre-made bins

2011-08-22 Thread RobinLovelace
Update: I have recreated an artificial distribution using uniform random numbers n - c(runif(Car[1],0,2), runif(Car[2],2,5),runif(Car[3],5,10), runif(Car[4],10,20), runif(Car[5],20,30), runif(Car[6],30,40), runif(Car[7],40,60), runif(Car[8],60,200) ) The resulting density

Re: [R] How to generate piecewise cubic spline with many knots?

2011-08-22 Thread xuyongdeng
Any commons is great appreciated. -- View this message in context: http://r.789695.n4.nabble.com/How-to-generate-piecewise-cubic-spline-with-many-knots-tp3755419p3759893.html Sent from the R help mailing list archive at Nabble.com. __

[R] Hat Matrix

2011-08-22 Thread hyak
Hi, I'm a new user of R - Is this how you construct a hat matrix? H - x %*% solve(t(x) %*% x) %*% t(x) H colnames(H) = rep('', 11) round(H,2) If so can you make them for more than 2 matrices? Why do you have to use the 2nd piece of code to round and stuff? Shouldn't it be correct from the

Re: [R] Increase the size of the boxes but not the text in a legend

2011-08-22 Thread Jean V Adams
[R] Increase the size of the boxes but not the text in a legend Jürgen Biedermann to: r-help 08/21/2011 06:02 PM HI there, I want to add a legend to a plot using the density and angle argument, so patterns with lines in different angles are used in the plot and should be referred

Re: [R] Selecting cases from matrices stored in lists

2011-08-22 Thread Jean V Adams
[R] Selecting cases from matrices stored in lists mdvaan to: r-help 08/22/2011 07:24 AM Hi, I have two lists (c and h - see below) containing matrices with similar cases but different values. I want to split these matrices into multiple matrices based on the values in h. So, I did

Re: [R] Data Frame Indexing

2011-08-22 Thread jim holtman
The problem is that the way you are using *apply, there are individual calls to the function for each item. In the direct indexing, you are only making a single call with a vector of values; Here is a illustration that shows the number of calls: # count the calls f.test - function(x) callCnt -

Re: [R] Groups and bwplot

2011-08-22 Thread Sébastien Bihorel
I got it to works. The problem was mainly how data were passed to my panel and panel.groups function. For reference, here is what I ended with: require(lattice) mybwplot - function(x,y,data,group){ if (missing(group)||is.null(group)) { group - 'NULL' ngroups - 1 } else {

Re: [R] Wiki/revision control to management of CRAN package repository

2011-08-22 Thread Ista Zahn
Hi, Much of the tagging/sorting/commenting stuff is already implemented as http://crantastic.org. Unfortunately few people have taken the time to contribute reviews. I propose that those of us who would like to bring more order to the R package universe should start by contributing reviews, tags,

Re: [R] Calculating p-value for 1-tailed test in a linear model

2011-08-22 Thread David Winsemius
On Aug 22, 2011, at 9:44 AM, Andrew Campomizzi wrote: David, It's fair to question my intentions. I'm running power analyses using simulations (based on Bolker's Ecological Models and Data in R) and need to provide decision-makers with options. So, I'm attempting to make it clear that if

Re: [R] Sweave doesn't work

2011-08-22 Thread Joshua Wiley
Hi Eik, On Mon, Aug 22, 2011 at 4:14 AM, Eik Vettorazzi e.vettora...@uke.uni-hamburg.de wrote: Hi Daniele, _ in dati_england is treated as a special character in LaTeX math mode and causes your LaTeX-compiler trying to switch to math mode (you might have noticed a warning abaout missing `$'

[R] neuralnet

2011-08-22 Thread azam jaafari
Hi   I used neuralnet for predciton new covarites. Ir give me the predictions as matrix 1*, . I want to convert the predictions to grid map.   Please help me   Thank you so much [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] Calculating p-value for 1-tailed test in a linear model

2011-08-22 Thread Andrew Campomizzi
David, It's fair to question my intentions. I'm running power analyses using simulations (based on Bolker's Ecological Models and Data in R) and need to provide decision-makers with options. So, I'm attempting to make it clear that if the research hypothesis (e.g., response variable declines

[R] d, p, q, r - What are the math relations with each other of this functions?

2011-08-22 Thread . .
Hi all, Using the exponential distribution to exemplify: The dexp function is the PDF (1) and pexp is the CDF (2), that is obtained integrating the PDF. How can I get the qexp and the rexp? Considering that I have the PDF, how this two are mathematically related to the PDF? (1) ke^{-kx} (2)

[R] lattice to ggplot2 conversion help

2011-08-22 Thread ashz
Hi, I am interested in ggplot2 and I found this lattice code very interesting (http://addictedtor.free.fr/graphiques/graphcode.php?graph=48). Code: library(lattice) lattice.options(default.theme = canonical.theme(color = FALSE)) tmp - expand.grid(geology = c(Sand,Clay,Silt,Rock),

[R] Multiple forest plots with the same x-axis and colour coded estimates and lines

2011-08-22 Thread Laura Bonnett
Dear all, I would like to draw three forest plots to represent results at years 1, 2 and 3. I have the data as point estimates and 95% confidence intervals. Using the following code I can get three basic forest plots - the first which has the table of results. I have to plot each separately as

[R] Using the ConText editor?

2011-08-22 Thread Robert Lundqvist
In my orgainzation, the people resonsible for the network are not that keen on setting up new software, so when I asked them to set up emacs or some other common R editor, I was told to have a look at ConText. This editor is avaliable in the network, and there is some R support. Special

[R] Extracting columns with specific string in their names

2011-08-22 Thread Jay
Hi, Let's say that I have a set of column names that begin with the string Xyz. How do I extract these specific columns? I tried to do the following: dataframe1[,grep(Xyz,colnames(dataframe1))] But it does not work. What is wrong with my expression?

Re: [R] Selecting cases from matrices stored in lists

2011-08-22 Thread mdvaan
Jean V Adams wrote: [R] Selecting cases from matrices stored in lists mdvaan to: r-help 08/22/2011 07:24 AM Hi, I have two lists (c and h - see below) containing matrices with similar cases but different values. I want to split these matrices into multiple matrices based on the

Re: [R] Calculating p-value for 1-tailed test in a linear model

2011-08-22 Thread Andrew Campomizzi
It's not that it's known to be false, rather it's not of interest in this case. If animal density (response) decreases with increasing year (predictor), then a change in land management practices might be needed. Whereas, if animal density is increasing, then the status quo should suffice.

Re: [R] Coding question for behavioral data analysis

2011-08-22 Thread jabroesch
Thank you both for the replies. While neither produced the exact desired results, they spurred some new thinking about how to approach the problem. I came up with a way to get the output desired, but it is probably pretty clunky. I will post it here anyway, in case someone is interested in the

Re: [R] Sweave doesn't work

2011-08-22 Thread Eik Vettorazzi
Hi Josh, you are absolutly right. Thanks for pointing that out. It is the Scode- environment which causes the error in TeX. @Daniele: have a look at the Sweave user manual (page 7ff) and try Sweave('example.Rtex',syntax=SweaveSyntaxLatex) Your Scode block should not be asterisked. I don't know

Re: [R] d, p, q, r - What are the math relations with each other of this functions?

2011-08-22 Thread R. Michael Weylandt
Read the documentation by typing ?qexp (or whatever other function) at the command line. But, since you asked and it won't take long to answer, the general pattern is: rDIST gives random numbers sampled from the distribution dDIST gives the PDF pDIST gives the CDF qDIST gives the quantile

Re: [R] Extracting columns with specific string in their names

2011-08-22 Thread R. Michael Weylandt
Can you say a little more about what you mean it does not work? I'd guess you have a regular expression mistake and are probably getting more columns than desired, but without an example, it's hard to be certain. Use dput() and head() to give a small cut-and-paste-able example. Michael On Mon,

Re: [R] Selecting cases from matrices stored in lists

2011-08-22 Thread Gabor Grothendieck
On Mon, Aug 22, 2011 at 9:07 AM, Jean V Adams jvad...@usgs.gov wrote: [R] Selecting cases from matrices stored in lists mdvaan to: r-help 08/22/2011 07:24 AM Hi, I have two lists (c and h - see below) containing matrices with similar cases but different values. I want to split these

Re: [R] lattice to ggplot2 conversion help

2011-08-22 Thread Ista Zahn
Hi Ashz, On Mon, Aug 22, 2011 at 8:42 AM, ashz a...@walla.co.il wrote: Hi, I am interested in ggplot2 and I found this lattice code very interesting (http://addictedtor.free.fr/graphiques/graphcode.php?graph=48). Code: library(lattice) lattice.options(default.theme = canonical.theme(color

Re: [R] How to add horizontal lines above bar graph to display p-values?

2011-08-22 Thread Sébastien Vigneau
Thanks! Sebastien 2011/8/20 Uwe Ligges lig...@statistik.tu-dortmund.de On 19.08.2011 22:27, Sébastien Vigneau wrote: Hi, I would like to draw horizontal lines above a bar graph, in order to display the p-values of a Fisher test. Here is an

Re: [R] pooled hazard model with aftreg and time-dependent variables

2011-08-22 Thread JPF
In STATA, multiple observations correspond to the same individual, the cluster( ) option can be employed to request that the analysis be clustered by individual. Any suggestion with aftreg? Thanks, J -- View this message in context:

Re: [R] Selecting cases from matrices stored in lists

2011-08-22 Thread Jean V Adams
Re: [R] Selecting cases from matrices stored in lists mdvaan to: r-help 08/22/2011 09:46 AM Jean V Adams wrote: [R] Selecting cases from matrices stored in lists mdvaan to: r-help 08/22/2011 07:24 AM Hi, I have two lists (c and h - see below) containing matrices

[R] Edit 2

2011-08-22 Thread RobinLovelace
Sorry to anyone who tried but failed to download the data - seems not to be there. Here's a new link to it please take a look. http://ubuntuone.com/p/1C6U/ -- View this message in context: http://r.789695.n4.nabble.com/Histogram-from-frequency-data-in-pre-made-bins-tp3758198p3760458.html Sent

[R] Multiple regression in R - unstandardised coefficients are a different sign to standardised coefficients, is this correct?

2011-08-22 Thread JC Matthews
Hello, I have a statistical problem that I am using R for, but I am not making sense of the results. I am trying to use multiple regression to explore which variables (weather conditions) have the greater effect on a local atmospheric variable. The data is taken from a database that has

[R] test if vector contains elements of another vector (disregarding the position)

2011-08-22 Thread Martin Batholdy
Hi, I have the following problem: I have two vectors: i - c('a','c','g','h','b','d','f','k','l','e','i') j - c('a', 'b', 'c') now I would like to generate a vector with the length of i that has zeros where i[x] != any element of j and 1 where i[x] == any element of j. So for the

Re: [R] test if vector contains elements of another vector (disregarding the position)

2011-08-22 Thread R. Michael Weylandt
%in% Here, i %in% j Hope this helps, Michael On Mon, Aug 22, 2011 at 11:51 AM, Martin Batholdy batho...@googlemail.comwrote: Hi, I have the following problem: I have two vectors: i - c('a','c','g','h','b','d','f','k','l','e','i') j - c('a', 'b', 'c') now I would like to

Re: [R] Ignoring loadNamespace errors when loading a file

2011-08-22 Thread Allan Engelhardt
On 22/08/11 12:26, Martin Morgan wrote: On 08/21/2011 11:52 PM, Allan Engelhardt wrote: [...] Obligatory reproducible example: On the Unix machine do library(multicore) a - list(data = 1:10, fun = mclapply) save(a, file = a.RData) and then try to load the a.RData file on Windows. The

Re: [R] Multiple regression in R - unstandardised coefficients are a different sign to standardised coefficients, is this correct?

2011-08-22 Thread Ista Zahn
Hi JC, You have interactions in your model, which means that your models specifies that the coefficients for hum, wind, and rain should vary depending on the value of the other two (and depending on their own value actually, since you also have quadratic effects for each of these variables in

[R] automatic file input

2011-08-22 Thread Bansal, Vikas
Dear all, I have 100 files which are used as input.and I have to input the name of my files again and again.the name of the files are 1.out, 2.out..100.out. I want to know if there is anything like perl so that i can use something like this- for($f = 1; $f = 100; $f++) { $file =

Re: [R] Extracting columns with specific string in their names

2011-08-22 Thread Jay
Sorry, my mistake. The thing is that the command return no results at all. However, when I just tried a simpler version of this (I had no capital letters or no spaces in the string), it worked fine. I cant figure it out, I think it all boils down to the fact that I'm no expert at regexp's...

Re: [R] automatic file input

2011-08-22 Thread Ista Zahn
Hi Vikas, please do make an effort to search for the answer before posting. A google search for R read multiple files will give you everything you need. Best, Ista On Mon, Aug 22, 2011 at 12:08 PM, Bansal, Vikas vikas.ban...@kcl.ac.uk wrote: Dear all, I have 100 files which are used as

Re: [R] Multiple regression in R - unstandardised coefficients a

2011-08-22 Thread Ted Harding
On 22-Aug-11 15:37:40, JC Matthews wrote: Hello, I have a statistical problem that I am using R for, but I am not making sense of the results. I am trying to use multiple regression to explore which variables (weather conditions) have the greater effect on a local atmospheric variable. The

[R] select columns array2 not equal to 10

2011-08-22 Thread Changbin Du
Dear R community, I have a data set like the following: probe_name chr_id position array1 array2 array3 array4 array5 array6 array7 1C-3 10 16566949 10 10 10 10 10 10 10 2C-3AAAB 17 33478940 10 10 10 10 10 10 10 3

Re: [R] test if vector contains elements of another vector (disregarding the position)

2011-08-22 Thread Henrique Dallazuanna
Try this: i %in% j * 1 On Mon, Aug 22, 2011 at 12:51 PM, Martin Batholdy batho...@googlemail.com wrote: Hi, I have the following problem: I have two vectors: i - c('a','c','g','h','b','d','f','k','l','e','i') j - c('a', 'b', 'c') now I would like to generate a vector with the

Re: [R] automatic file input

2011-08-22 Thread Bansal, Vikas
Dear Ista I have searched about the problem and came to know that we can make a list of our file names.But the thing is I am using this code- define- function() { repeat{ hojy=readline(Enter the name of your file: ) if(file.exists(hojy)==T) {return(hojy) break} else print(File does not

[R] Reading DESCRIPTION files to create dependency diagram

2011-08-22 Thread Rainer M Krug
Hi I want to create a dependence diagram of a subset of the packages on CRAN and would therefore like to read the DEACRIPTION files into a list. The list should be as follow for each package: - package name: list - Package: character - Version: character - Date: character - ... -

Re: [R] select columns array2 not equal to 10

2011-08-22 Thread R. Michael Weylandt
I want to select the array columns that are not equal to 10. is ambiguous to me. Just to clarify, do you want to simply drop the column named array10 or do you want to check each column for having one/all 10's as values and drop based on that test? Michael On Mon, Aug 22, 2011 at 12:35 PM,

[R] email with authentication

2011-08-22 Thread Ben qant
Hello, I'd like to send an email from R using Windows Outlook. The sendmailR package doesn't allow for authentication (usernames and passwords). Is there any other way to do this? From the Windows command line? Right now I am using a .bat file to send an email via a program called Blat. I'd

Re: [R] select columns array2 not equal to 10

2011-08-22 Thread Changbin Du
HI, Michael, What I want to do is remove all the rows, for which array1, array2, ..array15 are all equal to 10. I want to keep all the rows at least one of the array variables are not equal to 10. sorry for the confusion. On Mon, Aug 22, 2011 at 9:52 AM, R. Michael Weylandt

Re: [R] Convert week value to date

2011-08-22 Thread Folkes, Michael
Here is my solution to produce a date value if your data set only has week values associated with data (ie no date). It gives the first monday of the week. Michael Folkes s - seq(as.Date(2010-01-01), as.Date(2010-12-31), by = day) #produce all days of the year

Re: [R] Reading DESCRIPTION files to create dependency diagram

2011-08-22 Thread Uwe Ligges
On 22.08.2011 18:43, Rainer M Krug wrote: Hi I want to create a dependence diagram of a subset of the packages on CRAN and would therefore like to read the DEACRIPTION files into a list. The list should be as follow for each package: - package name: list - Package: character - Version:

Re: [R] automatic file input

2011-08-22 Thread Ista Zahn
Why don't you just use list.files() and iterate over the result in your for loop? fileNames - list.files(pattern = \\.out) myFiles - list() for(i in fileNames) { myFiles[[i]] - read.table(i, fill=T,colClasses = character) } ? Best, Ista On Mon, Aug 22, 2011 at 12:34 PM, Bansal, Vikas

Re: [R] select columns array2 not equal to 10

2011-08-22 Thread R. Michael Weylandt
This isn't the most beautiful code, but I think it should work for you: # Some sample data M = cbind(matrix(rnorm(10),ncol=2),matrix(sample(c(10,1),15,replace=T),ncol=3)) colnames(M) = c(Thing1,Thing2,paste(array,1:3,sep=)) colsToCheck = grepl(array,colnames(M)) # Isolate the array columns

Re: [R] email with authentication

2011-08-22 Thread Ben Bolker
Ben qant ccquant at gmail.com writes: Hello, I'd like to send an email from R using Windows Outlook. The sendmailR package doesn't allow for authentication (usernames and passwords). I don't know about Outlook, but you can try

Re: [R] Calculating p-value for 1-tailed test in a linear model

2011-08-22 Thread Ben Bolker
Campomizzi, Andrew J acampomizzi at neo.tamu.edu writes: On 20/08/11 10:20, Andrew Campomizzi wrote: Hello, I'm having trouble figuring out how to calculate a p-value for a 1-tailed test of beta_1 in a linear model fit using command lm. My model has only 1 continuous, predictor

Re: [R] automatic file input

2011-08-22 Thread Bansal, Vikas
Because i have to use the value of i in for loop also.example- for(i in 1:100){ df=read.table($i.out,fill=T,colClasses = character) if(i=50){ df$V6 - sapply(df$V6, function(a) paste(as.integer(charToRaw(a)), collapse = ' '))} else{ df$V5 - sapply(df$V6, function(a)

Re: [R] select columns array2 not equal to 10

2011-08-22 Thread Changbin Du
THANKS SO MUCH, Michael! Appreciated! On Mon, Aug 22, 2011 at 10:16 AM, R. Michael Weylandt michael.weyla...@gmail.com wrote: This isn't the most beautiful code, but I think it should work for you: # Some sample data M =

Re: [R] automatic file input

2011-08-22 Thread Ista Zahn
On Mon, Aug 22, 2011 at 1:25 PM, Bansal, Vikas vikas.ban...@kcl.ac.uk wrote: Because i have to use the value of i in for loop also.example-  for(i in 1:100){  df=read.table($i.out,fill=T,colClasses = character) if(i=50){  df$V6 - sapply(df$V6, function(a)  paste(as.integer(charToRaw(a)),

Re: [R] Calculating p-value for 1-tailed test in a linear model

2011-08-22 Thread Albyn Jones
For H_0: beta = 0, then the correct p-value is pt(tvalue,df) regardless of the sign of tvalue. Negative tvalues of large magnitude will yield small p-values. albyn On Mon, Aug 22, 2011 at 05:22:06PM +, Ben Bolker wrote: Campomizzi, Andrew J acampomizzi at neo.tamu.edu writes:

Re: [R] select columns array2 not equal to 10

2011-08-22 Thread Changbin Du
HI, Michael, Sorry for my numb, I have one more question. When you use function(x){any (x != 10), here x is a vector, x!=10 will give a vector of logical value, right? If it is, how can vector be compared to a scale, 10 in this case? Thanks! On Mon, Aug 22, 2011 at 10:16 AM, R. Michael

Re: [R] Extracting columns with specific string in their names

2011-08-22 Thread Dennis Murphy
Hi: You need a leading ^ in your grep string. Here's a reproducible example to illustrate: df - data.frame(Xyz1 = rnorm(5), Xyz2 = rnorm(5), Xyz3 = rnorm(5), Abc1 = rnorm(5), Abc2 = rnorm(5)) df[, grep('^Xyz', names(df))] df[, grep('^Abc', names(df))] HTH, Dennis On Mon, Aug

Re: [R] select columns array2 not equal to 10

2011-08-22 Thread R. Michael Weylandt
The different lengths work because R recycles values whenever you try to do a binary operation on things of different lengths: in essence, R copies 10 however many times needed to make something that has the right length for an elementwise comparison with x.** If you did something like x !=

[R] Two-levels labels on x-axis?

2011-08-22 Thread Sébastien Vigneau
Hi, I would like to draw a stacked bar chart with four bars (say a, b, c, d) . Two bars belong to group A and the two others to group B. Therefore, I would like to have, on the x-axis, a label for each bar and an additional label for each group, positioned underneath. To give an idea, the x-axis

Re: [R] select columns array2 not equal to 10

2011-08-22 Thread Changbin Du
Thanks, Michael! You have an heart of gold! Appreciated! On Mon, Aug 22, 2011 at 10:53 AM, R. Michael Weylandt michael.weyla...@gmail.com wrote: The different lengths work because R recycles values whenever you try to do a binary operation on things of different lengths: in essence, R

Re: [R] Two-levels labels on x-axis?

2011-08-22 Thread Joshua Wiley
Hi Sébastien, Not sure about an elegant, general way but here is something quick and dirty: p - barplot(matrix(1:8, 2)) axis(1, at = p, labels = letters[1:4]) axis(1, at = c(mean(p[1:2]), mean(p[3:4])), labels = paste(\n, LETTERS[1:2]), padj = 1) Cheers, Josh On Mon, Aug 22, 2011 at 10:14

Re: [R] Extracting columns with specific string in their names

2011-08-22 Thread David Winsemius
On Aug 22, 2011, at 1:45 PM, Dennis Murphy wrote: Hi: You need a leading ^ in your grep string. Here's a reproducible example to illustrate: df - data.frame(Xyz1 = rnorm(5), Xyz2 = rnorm(5), Xyz3 = rnorm(5), Abc1 = rnorm(5), Abc2 = rnorm(5)) df[, grep('^Xyz', names(df))]

Re: [R] Two-levels labels on x-axis?

2011-08-22 Thread Marc Schwartz
On Aug 22, 2011, at 12:14 PM, Sébastien Vigneau wrote: Hi, I would like to draw a stacked bar chart with four bars (say a, b, c, d) . Two bars belong to group A and the two others to group B. Therefore, I would like to have, on the x-axis, a label for each bar and an additional label for

Re: [R] CDFs

2011-08-22 Thread Jim Silverton
Hello all, I have two columns of numbers. I would like to do the following: (1) Plot both cdfs, F1 and F2 on the same graph. (2) Find smoothed approximations of F1 and F2 lets call them F1hat and F2hat (3) Find values for F1hat when we substitue a value of x in it. (4) Find the corresponding

Re: [R] CDFs

2011-08-22 Thread R. Michael Weylandt
Number 1 can be done as follows: x = rnorm(50); y = rnorm(50) xCDF = ecdf(x); yCDF = ecdf(y) plot(xCDF) lines(yCDF,col=2) For the other ones, you are going to have to be a little more specific as to how you want to do the approximation...but ?density might be a place to start for #4, assuming

[R] Problem with xtable

2011-08-22 Thread ea819
Dear all, I am having trouble creating LaTex tables using the xtable command. I am using the bayesm package to analyse data. However, I am unable to generate LaTex tables converting the output from summary(out$deltadraws.) I have made several attempts using xtable but have been unsuccessful and

[R] Counting Elements Conditionally

2011-08-22 Thread Edward Patzelt
R - I have 3 variables with data below. Variable Rev is a vector that changes from 1 to 2, 2 to 3, etc Variable FF is a binary variable with 1's and 0's. Variable bin is a different binary variable with 1's and 0's. I want to calculate the number of elements: 1. Starting with the first

Re: [R] Problem with xtable

2011-08-22 Thread David Winsemius
On Aug 22, 2011, at 3:18 PM, ea819 wrote: Dear all, I am having trouble creating LaTex tables using the xtable command. I am using the bayesm package to analyse data. However, I am unable to generate LaTex tables converting the output from summary(out$deltadraws.) I have made several

[R] Threads in R

2011-08-22 Thread Immanuel
Hello all, I posted a questions on how to terminate a function call that does not return after a certain time ( I can not modify the function code) some time ago. Since I didn't find a solution I just came up with the idea to run the functions call in a separate thread who I could terminate a

Re: [R] I have a problem with R!!

2011-08-22 Thread David L Carlson
When you read Excel data from the Windows clipboard, the delimiter is a tab, not a comma. -- David L Carlson Associate Professor of Anthropology Texas AM University College Station, TX 77843-4352 -Original Message- From:

Re: [R] CDFs

2011-08-22 Thread R. Michael Weylandt
Yes. The xCDF/yCDF objects that are returned by the ecdf function can be called like functions. For example: x = rnrom(50); xCDF = ecdf(x); xCDF(0.3) # This value tells you what fraction of x is less than 0.3 You can also assign this behavior to a function: F - function(z) { xCDF(z) } F does

Re: [R] Two-levels labels on x-axis?

2011-08-22 Thread Sébastien Vigneau
Thanks! Sebastien On Mon, Aug 22, 2011 at 2:11 PM, Marc Schwartz marc_schwa...@me.com wrote: On Aug 22, 2011, at 12:14 PM, Sébastien Vigneau wrote: Hi, I would like to draw a stacked bar chart with four bars (say a, b, c, d) . Two bars belong to group A and the two others to group B.

Re: [R] Threads in R

2011-08-22 Thread Peter Langfelder
On Mon, Aug 22, 2011 at 12:39 PM, Immanuel mane.d...@googlemail.com wrote: Hello all, I posted a questions on how to terminate a function call that does not return after a certain time ( I can not modify the function code) some time ago. Since I didn't find a solution I just came up with the

Re: [R] CDFs

2011-08-22 Thread David Winsemius
On Aug 22, 2011, at 3:50 PM, R. Michael Weylandt wrote: Yes. The xCDF/yCDF objects that are returned by the ecdf function can be called like functions. Because they _are_ functions. function %in% class(xCDF) [1] TRUE is.function(xCDF) [1] TRUE For example: x = rnrom(50); xCDF =

[R] looping with paste

2011-08-22 Thread Juta Kawalerowicz
Dear list, I have a spacialPolygonDataFrame where variables were unnecessarily imported as factors. So I am trying to unfactor variables from spatialPolygonDataFrame@data with a loop for (i in (1:length(names( spatialPolygonDataFrame{

Re: [R] Selecting cases from matrices stored in lists

2011-08-22 Thread mdvaan
Thanks Jean, changing c[[t]] to c[[year]] solved the issue. Math Jean V Adams wrote: Re: [R] Selecting cases from matrices stored in lists mdvaan to: r-help 08/22/2011 09:46 AM Jean V Adams wrote: [R] Selecting cases from matrices stored in lists mdvaan to: r-help

Re: [R] looping with paste

2011-08-22 Thread Sarah Goslee
Juta, On Mon, Aug 22, 2011 at 4:29 PM, Juta Kawalerowicz juta.kawalerow...@stx.ox.ac.uk wrote: Dear list, I have a spacialPolygonDataFrame where variables were unnecessarily imported as factors. So I am trying to unfactor variables from spatialPolygonDataFrame@data with a loop for (i in

Re: [R] Counting Elements Conditionally

2011-08-22 Thread Jean V Adams
[R] Counting Elements Conditionally Edward Patzelt to: r-help 08/22/2011 02:33 PM R - I have 3 variables with data below. Variable Rev is a vector that changes from 1 to 2, 2 to 3, etc Variable FF is a binary variable with 1's and 0's. Variable bin is a different binary

Re: [R] Counting Elements Conditionally

2011-08-22 Thread Jean V Adams
Re: [R] Counting Elements Conditionally Jean V Adams to: Edward Patzelt 08/22/2011 03:53 PM [R] Counting Elements Conditionally Edward Patzelt to: r-help 08/22/2011 02:33 PM R - I have 3 variables with data below. Variable Rev is a vector that changes from 1 to 2,

Re: [R] Counting Elements Conditionally

2011-08-22 Thread Edward Patzelt
Awesome, this is close, couple changes. Below is full data set for 1 person. I want the code to look at the first time it sees a 0 in FF after the transition in Rev. I then want it to test whether bin is also a 0. If and only if this is the first 0 in FF after the transition, and bin = 0, then

Re: [R] Counting Elements Conditionally

2011-08-22 Thread Edward Patzelt
after it sees the first occurrence of 0 in FF following a transition, I want it to ignore all further elements until the next transition. On Mon, Aug 22, 2011 at 3:58 PM, Edward Patzelt patze...@umn.edu wrote: Awesome, this is close, couple changes. Below is full data set for 1 person. I

Re: [R] CDFs

2011-08-22 Thread David Winsemius
On Aug 22, 2011, at 4:34 PM, David Winsemius wrote: On Aug 22, 2011, at 3:50 PM, R. Michael Weylandt wrote: Yes. The xCDF/yCDF objects that are returned by the ecdf function can be called like functions. Because they _are_ functions. function %in% class(xCDF) [1] TRUE

Re: [R] Counting Elements Conditionally

2011-08-22 Thread Jean V Adams
So, using the full data set, what should the result look like? c(NA, NA, NA, 3, NA,NA, NA, 2) ? Jean Edward Patzelt patze...@umn.edu wrote on 08/22/2011 03:58:38 PM: [image removed] Re: [R] Counting Elements Conditionally Edward Patzelt to: Jean V Adams 08/22/2011

Re: [R] Counting Elements Conditionally

2011-08-22 Thread Edward Patzelt
that is exactly correct, assuming we did not start at the beginning, but started at the first transition (this is the correct way to think about it) On Mon, Aug 22, 2011 at 4:08 PM, Jean V Adams jvad...@usgs.gov wrote: So, using the full data set, what should the result look like? c(NA, NA,

Re: [R] Threads in R

2011-08-22 Thread Immanuel
Hello, thanks for the input. Below is a small example, simpler then expected :) I'm just curious why I can't see any output from print(i). -- library(multicore) f_long - function() { for (i in 1:1){ a=i} print(i) return(finished) } p_long -

  1   2   >