Re: [R] Assign name to object for each iteration in a loop.

2011-12-03 Thread Patrick Connolly
On Thu, 01-Dec-2011 at 10:13AM -0800, lglew wrote: |> Hi R-users, |> |> I'm trying to produce decompositions of a multiple time-series, grouped by a |> factor (called "area"). I'm modifying the code in the STLperArea function of |> package ndvits, as this function only plots produces stl plots, i

Re: [R] rnorm command

2011-12-03 Thread Jeff Newmiller
No. If you want a more informative answer, try following the recommendations in the posting guide mentioned below. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#.

Re: [R] upper bound in the integrate function depends on a parameter

2011-12-03 Thread David Winsemius
On Dec 3, 2011, at 10:23 PM, grttt nbbfg wrote: Sorry for my English, is not my first language.. I have some trouble in terms of using integrate function in R. fx is a function of m and x where m is supposed to be a unknown parameter. R is not an algebraic solver (and R-help is not a homew

Re: [R] density function always evaluating to zero

2011-12-03 Thread David Winsemius
On Dec 3, 2011, at 5:42 PM, napps22 wrote: Dear R users, I'm trying to carry out monte carlo integration of a posterior density function which is the product of a normal and a gamma distribution. The problem I have is that the density function always returns 0. How can I solve this proble

[R] upper bound in the integrate function depends on a parameter

2011-12-03 Thread grttt nbbfg
Sorry for my English, is not my first language.. I have some trouble in terms of using integrate function in R. fx is a function of m and x where m is supposed to be a unknown parameter. >fx=function(m,x){ + x*2/(3*m)*(1-x/(3*m)) + } The problem is in upper bound, it depends on parameter m. >in

[R] Prediction from censReg?

2011-12-03 Thread z2.0
Hi - First post, so excuse any errors in protocol: Wanted to ask if there's an easy way to use 'predict' with objects of class 'censReg', 'maxLik', 'maxim' or 'list'. Have a left-censored dataset, attempting to use a Tobit model and am working with the censReg package. I like how easy it is to

Re: [R] Shading the plot

2011-12-03 Thread avinash barnwal
Hi, I apologies for my naive doubts I have been trying it from a while. I need the area between the curve based on conditions i wrote (whenever red line is above the blue line then area between curves to be grey color and whenever blue line is above red line then area between curves to be red col

[R] Logistic Regression with genetic component

2011-12-03 Thread Danielle Duncan
Greetings, I have a question that I'd like to get input on. I have a classic toxicology study where I artificially fertilized and exposed embryos to a chemical and counted defects. In addition, I kept track of male-female pairs that I used to artificially fertilize and generate embryos with. I need

[R] density function always evaluating to zero

2011-12-03 Thread napps22
Dear R users, I'm trying to carry out monte carlo integration of a posterior density function which is the product of a normal and a gamma distribution. The problem I have is that the density function always returns 0. How can I solve this problem? Here is my code #generate data x1 <- runif(100

[R] rnorm command

2011-12-03 Thread Cheryl Johnson
Hello, I use the command rnorm, and I feed these results into a lmer command. Since I am using the rnorm command I expect to get different results for each iteration, yet for each iteration I am getting the same answer. If someone understands why I am getting the same answer every time with a rand

Re: [R] Shading the plot

2011-12-03 Thread David Winsemius
On Dec 3, 2011, at 5:28 PM, avinash barnwal wrote: Hi Weylandt, I tried it but i was not successful. Here is the full code Any help would be great. time<-c("02-Jan-05","09-Jan-05","16-Jan-05","23-Jan-05","30- Jan-05",

Re: [R] help in removal of fixed pattern

2011-12-03 Thread D. Schruth
A great function for extracting pattern matches is 'm()' library(caroline) vect <- m('([xX][0-9])',df$Input) toupper(vect) #in case you really want all upper case x's It does the hard work of using 'sub' to remove the non-matching parts (sub, grep, regexpr, etc aren't very good for this sort

Re: [R] pivot table help

2011-12-03 Thread jim holtman
Forgot, you can also do this: > dcast(x.m, Cluster ~ value, fun = length) Cluster ind1 ind2 ind3 1 1110 2 2101 3 3110 > On Sat, Dec 3, 2011 at 7:02 PM, jim holtman wrote: > try this: > >> x <- read.table(text = "Cluster   Member1    Member

Re: [R] pivot table help

2011-12-03 Thread jim holtman
try this: > x <- read.table(text = "Cluster Member1Member2 + 1ind1 ind2 + 2ind3 ind1 + 3ind2 ind1", as.is = TRUE, header = TRUE) > require(reshape2) > x.m <- melt(x, id = "Cluster") > x.m Cluster variable value 1 1 Me

Re: [R] pivot table help

2011-12-03 Thread Richard M. Heiberger
Pivot tables are an Excel concept, not an R concept. That means you must give an example of your starting pivot table as an R object (use dump() so we can pick it up from the email and execute it immediately). and an example of the R object you want as the result. Use a trivial but complete exampl

Re: [R] Data Analysis for Gas Prices

2011-12-03 Thread B77S
use a < ? > to get help on a function; example: ?read.table If you do this you will see an option called "header"... use header=T if your top row contains column names. Learn how to read these help pages. Also, read thru a few beginner R manuals and see this website: http://www.statmethods.

[R] pivot table help

2011-12-03 Thread set
Hello R-users, I've got a huge table with about 20.00 rows and 50 columns. The table now has headers as Members1, Members2 etc. My data are 8 different individuals. And I've got a column with clusters. So each individual belongs to different clusters and can occurs multiple times within a cluster

Re: [R] Shading the plot

2011-12-03 Thread avinash barnwal
Hi Weylandt, I tried it but i was not successful. Here is the full code Any help would be great. time<-c("02-Jan-05","09-Jan-05","16-Jan-05","23-Jan-05","30-Jan-05","06-Feb-05","13-Feb-05","20-Feb-05","27-Feb-05","06-Mar-0

[R] Data Analysis for Gas Prices

2011-12-03 Thread inferno846
Hi there, I'm looking to analyze a set of data on local gas prices for a single day. I'm wondering what kind of questions I should be looking to ask and how to find and answer to them with R. Examples would be: Do prices differ between brands? Does location affect (NE, NW, SE, SW) price? Does th

Re: [R] Shading the plot

2011-12-03 Thread R. Michael Weylandt
? polygon example(polygon) Michael On Sat, Dec 3, 2011 at 4:08 PM, avinash barnwal wrote: > Hi all, > > I have been trying to shade the specific part of the plot > > Part to be shaded > > 1. Any color whenever a2>a3 > > 2. Any other color( Not same as 1) whenever a2 > Suggest me some code for th

[R] Shading the plot

2011-12-03 Thread avinash barnwal
Hi all, I have been trying to shade the specific part of the plot Part to be shaded 1. Any color whenever a2>a3 2. Any other color( Not same as 1) whenever a2<>__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do

Re: [R] Moving column averaging

2011-12-03 Thread B77S
I don't know the answer, but would suppose not. You could test this for yourself using: system.time() example: system.time(rnorm(10,0,1)) Chega wrote > > This solved my problem - Thanks a lot for your help! Please allow me one > more question: Works zoo's rollapply on a plain matrix faster

Re: [R] Iteration in R

2011-12-03 Thread R. Michael Weylandt
Because lapply() tries to pass an argument to FUN and there's none that it can receive. This would work however: lapply(rep(100, 6), rnorm, mean = 1, sd = 2) Michael On Sat, Dec 3, 2011 at 2:42 PM, B77S wrote: > Interesting and thank you; I'm confused as to why this doesn't work with: > > lapp

Re: [R] Iteration in R

2011-12-03 Thread R. Michael Weylandt
And with replicate: replicate(100, rnorm(100, 1,2), simplify = FALSE) Michael On Sat, Dec 3, 2011 at 2:38 PM, andrija djurovic wrote: > Hi Brad. Maybe something like this: > > lapply(rep(1,6), function(x) rnorm(10,0,1)) > > Andrija > > On Sat, Dec 3, 2011 at 8:21 PM, B77S wrote: > >> Hi Micha

Re: [R] Iteration in R

2011-12-03 Thread B77S
Interesting and thank you; I'm confused as to why this doesn't work with: lapply(rep(1,6), FUN=rnorm, n=10, mean=1.0, sd=1) andrija djurovic wrote > > Hi Brad. Maybe something like this: > > lapply(rep(1,6), function(x) rnorm(10,0,1)) > > Andrija > > On Sat, Dec 3, 2011 at 8:21 PM, B77S <

Re: [R] Iteration in R

2011-12-03 Thread andrija djurovic
Hi Brad. Maybe something like this: lapply(rep(1,6), function(x) rnorm(10,0,1)) Andrija On Sat, Dec 3, 2011 at 8:21 PM, B77S wrote: > Hi Michael, > How would you do this with lapply to return a list? > I can't seem to get that to work (I haven't used these much and am trying > to > learn). > T

Re: [R] Iteration in R

2011-12-03 Thread B77S
Hi Michael, How would you do this with lapply to return a list? I can't seem to get that to work (I haven't used these much and am trying to learn). Thanks Brad Michael Weylandt wrote > > ? replicate > > or a for loop > > or do all one hundred simulations at once > > x <- matrix(rnorm(100^2,

Re: [R] Iteration in R

2011-12-03 Thread andrija djurovic
Hi. One approach is using replicate. See ?replicate: replicate(3,rnorm(100,1,2)) Andrija On Sat, Dec 3, 2011 at 7:10 PM, Martin Zonyrah wrote: > Hi, > I need help. I am trying to iterate this command x <- rnorm(100, 1.0, > 2.0) one hundred times in R but I don't seem to have a clue. > Can anyo

Re: [R] Iteration in R

2011-12-03 Thread David Winsemius
On Dec 3, 2011, at 1:10 PM, Martin Zonyrah wrote: Hi, I need help. I am trying to iterate this command x <- rnorm(100, 1.0, 2.0) one hundred times in R but I don't seem to have a clue. ?replicate == David Winsemius, MD West Hartford, CT __

Re: [R] Counting the occurences of a charater within a string

2011-12-03 Thread Hadley Wickham
On Thu, Dec 1, 2011 at 10:32 AM, Douglas Esneault wrote: > I am new to R but am experienced SAS user and I was hoping to get some help > on counting the occurrences of a character within a string at a row level. > > My dataframe, x,  is structured as below: > > Col1 > abc/def > ghi/jkl/mno > > I

Re: [R] Iteration in R

2011-12-03 Thread R. Michael Weylandt
? replicate or a for loop or do all one hundred simulations at once x <- matrix(rnorm(100^2, 1, 2), 100) It's going to depend on what you want to do with the numbers. Michael On Sat, Dec 3, 2011 at 1:10 PM, Martin Zonyrah wrote: > Hi, > I need help. I am trying to iterate this command  x <-

Re: [R] Problem with loop

2011-12-03 Thread Komine
Hi, Thank Michael for your help. Komine -- View this message in context: http://r.789695.n4.nabble.com/Problem-with-loop-tp4148083p4154147.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.

[R] Iteration in R

2011-12-03 Thread Martin Zonyrah
Hi, I need help. I am trying to iterate this command  x <- rnorm(100, 1.0, 2.0) one hundred times in R but I don't seem to have a clue. Can anyone help? Your help is very much appreciated. Martin [[alternative HTML version deleted]] __ R-help@

Re: [R] problems using the thin plate spline method

2011-12-03 Thread Jeff Newmiller
I can tell that you are puzzled and confused. Unfortunately, I am not psychic, so I cannot tell what you did, and therefore cannot tell where you went astray. The solution is for you to read the posting guide mentioned at the bottom of every R-help message. Spend a little time to create a small

Re: [R] Problem installing Rtools

2011-12-03 Thread stillerfan
Great, thanks for answering this basic question. On Sat, Dec 3, 2011 at 5:12 AM, Duncan Murdoch-2 [via R] < ml-node+s789695n4152880...@n4.nabble.com> wrote: > On 11-12-02 10:25 PM, stillerfan wrote: > > I'm a new user to R and recently installed R 2.14 for Windows 7 (64 > bit). I > > have downl

Re: [R] replace values

2011-12-03 Thread David Winsemius
On Dec 3, 2011, at 8:41 AM, syrvn wrote: Hello, imagine the following data.frame: ID name 1 *_A 2 *_A 3 *_B 4 *_B * = can be any pattern I want to replace every row which ends with _A by 1 and every row which ends by _B with a 0 You can use grep(patt, x, value=TRUE) to return vlaues t

[R] replace values

2011-12-03 Thread syrvn
Hello, imagine the following data.frame: ID name 1 *_A 2 *_A 3 *_B 4 *_B * = can be any pattern I want to replace every row which ends with _A by 1 and every row which ends by _B with a 0 so that the data.frame looks like the following: ID name 1 1 2 1 3 0 4 0 Which function do I use best

Re: [R] Downloading tab separated data from internet

2011-12-03 Thread HC
Thanks for your reply. I tried to use the postForm function of RCurl as below but do not have much clue as to how to go further with what it does. library(RCurl) stn<-"03015795" myurl<-paste("http://ida.water.usgs.gov/ida/available_records.cfm?sn=",stn,sep="";) mypage1 = readLines(myurl) # Get

[R] problems using the thin plate spline method

2011-12-03 Thread Mintewab Bezabih
Dear R users, I am a beginner in R trying to apply the thin plate spline method to my climate data. I used the example in R to do so, and the lines seem to run fine ( I am not getting errors) but I am not getting any output in the form of graph or anything. I got a warning message saying that

Re: [R] Data alignment

2011-12-03 Thread syrvn
Thanks for your suggestions. I will try them. The "-" in my original post was actually only there to serve as a separator so that it is easier for you to see the data structure but apparently it rather confused you... sorry :) -- View this message in context: http://r.789695.n4.nabble.com/Data-a

Re: [R] Sweave problem on Mac OS when using umlauts and summary()

2011-12-03 Thread Mark Heckmann
I just noticed that the question has already been answered on the R-help list before: http://r.789695.n4.nabble.com/Sweave-font-problems-with-Signif-codes-lines-td977346.html Adding the following R line solves the problem: options(useFancyQuotes = FALSE) Mark > > > On Fri, Dec 2, 2011 at 4:

Re: [R] Reading multiple text files and then combining into a dataframe

2011-12-03 Thread jim holtman
Does this do it for you: > #Creating example data in similar format to data I have > sub <- rep(1,10) > trial <- seq(1,10,1) > size <- rep(3,10) > shortest <- rep(444,10) > startlab <- rep(444,10) > endlab <- rep(444,10) > startconf <- rep(444,10) > endconf <- rep(444,10) > steps <- sample(1:30,10

Re: [R] Data alignment

2011-12-03 Thread jim holtman
try this: > match(x$Name> x <- read.table(text = "Name - Value + A - 400 + A - 300 + B - 200 + B - 350 + C - 500 + C - 350 + D - 450 + D - 600 + E - 700 + E - 750 + F - 630 + F - 650", header = TRUE, as.is = TRUE) > map <- data.frame(key = c("A", "B", "C", "D", "E", "F") + , valu

Re: [R] help in removal of fixed pattern

2011-12-03 Thread Sarah Goslee
You can use gsub() to replace parts of strings. Sarah On Saturday, December 3, 2011, arunkumar wrote: > Hi > > I have column name as given below > > If the variable is in log(X1 + 1) pattern it should be removed and i need > only X1 > > Input > log(x1 + 1) > x2 > log(X3 +1) > > Expected Outp

Re: [R] Data alignment

2011-12-03 Thread Sarah Goslee
I doubt your data frame looks like that, with all the -, but regardless you can use ifelse() to construct your column. Sarah On Saturday, December 3, 2011, syrvn wrote: > Hello! > > I have a data.frame which looks like: > > Name - Value > A - 400 > A - 300 > B - 200 > B - 350 > C - 500 > C - 350

Re: [R] partial mantel tests in ecodist with intential NA values.

2011-12-03 Thread Sarah Goslee
It is not possible in ecodist, and I'd be wary of doing it in other packages. Instead, I would consider the model matrix approach described in Legendre and Fortin 1989. Sarah On Saturday, December 3, 2011, Nevil Amos wrote: > I would like to perform partial mantel tests on only within group val

Re: [R] side-by-side map with different geographies using spplot

2011-12-03 Thread Roger Bivand
David Epstein umich.edu> writes: > > Hello, > > I want to create side-by-side maps of similar attribute data in two > different cities using a single legend. > > To simply display side-by-side census block group boundary > (non-thematic) maps for Minneapolis & Cleveland I do the following: >

[R] Data alignment

2011-12-03 Thread syrvn
Hello! I have a data.frame which looks like: Name - Value A - 400 A - 300 B - 200 B - 350 C - 500 C - 350 D - 450 D - 600 E - 700 E - 750 F - 630 F - 650 I want to add another column where all A,B should get an index 1, all C,D an index of 2 and all E,F an index of 3 so that the data.frame loo

Re: [R] Project local libraries (reproducible research)

2011-12-03 Thread Jim Lemon
On 12/03/2011 06:04 AM, Hadley Wickham wrote: Hi all, I was wondering if any one had scripts that they could share for capturing the current version of R packages used for a project. I'm interested in creating a project local library so that you're safe if someone (e.g. the ggplot2 author) updat

Re: [R] Problem installing Rtools

2011-12-03 Thread Duncan Murdoch
On 11-12-02 10:25 PM, stillerfan wrote: I'm a new user to R and recently installed R 2.14 for Windows 7 (64 bit). I have downloaded and ran Rtools 2.14 but do not see any new packages in the install packages section of R. I installed Rtools in a subdirectory to the /library/ directory. Does a

Re: [R] Help! Big problem when using "browser()" to do R debugging?

2011-12-03 Thread Liviu Andronic
On Sat, Dec 3, 2011 at 2:38 AM, Michael wrote: > Hi all, > > Could you please help me? > > I am having the following weird problem when debugging R programs > using "browser()": > > In my function, I've inserted a "browser()" in front of Step 1. My > function has 3 steps and at the end of each ste

Re: [R] Downloading tab separated data from internet

2011-12-03 Thread Prof Brian Ripley
AFAICS what you mean is 'how can I fill in an HTML form using R'. Answer: use package RCurl. Do study the posting guide: none of the 'at a minimum' information was given here. On 03/12/2011 04:47, HC wrote: Hi all, I am trying to download some tab separated data from the internet. The data

[R] partial mantel tests in ecodist with intential NA values.

2011-12-03 Thread Nevil Amos
I would like to perform partial mantel tests on only within group values, with "between group" values assigned to NA. This is possible in package ncf partial.mantel.test, however this sues a different permutation to that used in ecodist.ecodist will not accept data with NA values, returning a "

[R] Reading multiple text files and then combining into a dataframe

2011-12-03 Thread James Holland
I have a multiple text files, separated by a single space, that I need to combine into a single data.frame. Below is the track I'm on using list.files to capture the names of the files and then lapply with read.table. But I run into problems making a usable dataframe out of the data. #Creating

[R] help in removal of fixed pattern

2011-12-03 Thread arunkumar1111
Hi I have column name as given below If the variable is in log(X1 + 1) pattern it should be removed and i need only X1 Input log(x1 + 1) x2 log(X3 +1) Expected Output X1 X2 X3 Please help me -- View this message in context: http://r.789695.n4.nabble.com/help-in-removal-of-fixed-pattern-tp

[R] Problem installing Rtools

2011-12-03 Thread stillerfan
I'm a new user to R and recently installed R 2.14 for Windows 7 (64 bit). I have downloaded and ran Rtools 2.14 but do not see any new packages in the install packages section of R. I installed Rtools in a subdirectory to the /library/ directory. Does anyone have any idea what I could be doing

[R] Downloading tab separated data from internet

2011-12-03 Thread HC
Hi all, I am trying to download some tab separated data from the internet. The data is not available directly at the URL that could be known apriori. There is an intermediate form where start and end dates have to be given to get to the required page. For example, I want to download data for a st

Re: [R] simple lm question

2011-12-03 Thread Worik R
> > Please note that your "df" and "M" are undoubtedly different > objects by now: > > Right. Not my most coherent day. thanks W > > M <- matrix(runif(5*20), nrow=20) > > colnames(M) <- c('a', 'b', 'c', 'd', 'e') > > l1 <- lm(e~., data=as.data.frame(M)) > > l1 > > Call: > lm(formula = e ~ .,