Re: [R] Normality test

2011-05-29 Thread Bogaso Christofer
Hi Greg, please forgive me as I could not understand one part of your wishful reply. You said: distributions where one is uniform between 0 and 1 with height 1; the other also has height 1 between 0 and 0.99, but is also 1 between 999.99 and 1000, zero elsewhere. Can you be more specific on this

[R] newbie xml parsing question

2011-05-29 Thread eric
I am trying to read some data off the zillow site. Newbie to xml, html, parsing and the xml package. I've been able to load the web page I'm interested with the following code but I'm not sure of the next step to get the information I'm interested in into R : library(XML) url -

[R] How to do operations on zoo/xts objects with Monthly and Daily periodicities

2011-05-29 Thread thierrydb
Is there an elegant way to do operations (+/-/*/ / ) on zoo/xts objects when one serie is monthly (end of month) and the other daily (weekdays only) - typically a monthly economic indicator and a stock index price? Thanks, TDB -- View this message in context:

[R] Relevel() catagorical variables in a GLM

2011-05-29 Thread ashley
Hello list readers, I am running a set of GLMs on fish spp presence/absence as a function of various habitat characteristics. My response is binomial and I have four predictors, three of which are categorical. So, R takes one of my predictor-variables away to use as the intercept (the first one

[R] EMA package

2011-05-29 Thread Rosario Garcia Gil
Hello I want to use the test.nested.model, in order to compare two nested models, which is under package EMA, however, I did not find it in the list of packages to install in R. How is this possible? Thanks for help in advance. Rosario __

Re: [R] Problem in installing and starting Rattle

2011-05-29 Thread yz
I replace the zlib1.dll in system32 C:\WINDOWS\system32\zlib1.dll with the zlib1.dll in GTK2 D:\GTK2-Runtime\bin\zlib1.dll -- View this message in context: http://r.789695.n4.nabble.com/Problem-in-installing-and-starting-Rattle-tp3042502p3558335.html Sent from the R help mailing list archive at

Re: [R] Relevel() catagorical variables in a GLM

2011-05-29 Thread Joshua Wiley
Hi Ashley, It does not look like you have done the wrong thing to me. The results will be different because eacho f the parameter estimates is now the change from SS to ___ instead of from HH to . In fact, from your first table, you can calculate all the parameters in the second. The

Re: [R] EMA package

2011-05-29 Thread Joshua Wiley
Hi Rosario, Can you provide the results of sessionInfo() ? install.packages(EMA) works for me. Cheers, Josh On Sat, May 28, 2011 at 4:27 PM, Rosario Garcia Gil m.rosario.gar...@slu.se wrote: Hello I want to use the test.nested.model, in order to compare two nested models, which is under

Re: [R] rqss help in Quantreg

2011-05-29 Thread Roger Koenker
This is _not_ a reproducible example so one can only guess, but the fact that with returns the analysis goes suggests that there is something amiss with your price variable. Roger Koenker rkoen...@illinois.edu On May 28, 2011, at 1:47 PM, Sergius Cerice wrote: Dear All, I,m trying to

Re: [R] ggplot pale colors

2011-05-29 Thread Victor Gabillon
Hi Ista, Thank you so much for your explanation!! I know now how to handle this scale_color_manual() function. Le 28/05/2011 19:56, Ista Zahn a écrit : Hi Victor, The problem is that you have not grasped the difference between setting an aesthetic to a fixed value and mapping it to a

Re: [R] Changing the name of the R process in top

2011-05-29 Thread Barry Rowlingson
On Sat, May 28, 2011 at 7:48 PM, Matthew Keller mckellerc...@gmail.com wrote: Perhaps this is more of a unix question, but I'll give it a try here. I am running 9 different R processes at the same time (called from a shell script using R CMD BATCH).  When I use the top program to monitor how

Re: [R] Relevel() catagorical variables in a GLM

2011-05-29 Thread ashley
Thanks Josh, This makes sense. The coefficient of one parameter is given in reference to another parameter. (Aha! The reference parameter.) I'm still a little confused on the standard errors (SEs) and why they change too? Should I change the reference around until I find the best-looking SEs?

Re: [R] Plot rows of CSV

2011-05-29 Thread rmje
http://r.789695.n4.nabble.com/file/n3558595/help_snap.jpg Why do R rename my rows and columns when loading it like in the image above? -- View this message in context: http://r.789695.n4.nabble.com/Plot-rows-of-CSV-tp3555898p3558595.html Sent from the R help mailing list archive at

Re: [R] remove , at the end of each line for all lines except the first line in a data frame

2011-05-29 Thread xiaerwhite
Thank you very much for your help.I was confused about how to find the length of a file without using the length function. Thank you so much for your answer ,Dennis -- View this message in context:

[R] Applying a function to a subset

2011-05-29 Thread gaiarrido
Here´s my problem, i have developed the function kurtosis (using R-book as a guide) with this commands: kurtosis-function(x) { m4-sum((x-mean(x))^4)/length(x) s4-var(x)^2 m4/s4 - 3 } Then create the object fem, which is the difference between the count of a trait in the left side of the body

Re: [R] Applying a function to a subset

2011-05-29 Thread Jim Holtman
kurtosis(fem[!is.na(fem)]) Sent from my iPad On May 29, 2011, at 4:54, gaiarrido gaiarr...@usal.es wrote: Here´s my problem, i have developed the function kurtosis (using R-book as a guide) with this commands: kurtosis-function(x) { m4-sum((x-mean(x))^4)/length(x) s4-var(x)^2 m4/s4 - 3 }

Re: [R] Plot rows of CSV

2011-05-29 Thread Jim Holtman
Because your header contains strings that are not legal names. Check out the parameter check.name (cannot tell for sure since R is not available on the iPad). Sent from my iPad On May 29, 2011, at 5:17, rmje robinmje...@gmail.com wrote:

Re: [R] Questions regrading the lasso and glmnet

2011-05-29 Thread Patrick Breheny
On 05/28/2011 12:54 PM, Ben Haller wrote: 1. Is my choice of glmnet() ok? On what basis should I choose glmnet() vs. lars()? LARS is for linear regression; your outcome is binary. 2. Is the way I'm scaling the variables before calling glmnet() correct? Or should the squares themselves be

Re: [R] rqss help in Quantreg

2011-05-29 Thread Sergius Cerice
Dear Roger, Thanks for the reply. I have discovered that the problem was in NA data for the last two months appeared after loading from .csv file. The problem was solved applying the complete.cases() function. Sergius. -- View this message in context:

[R] dynamic programming

2011-05-29 Thread garciap
Dear members of R forum, I'm trying to perform a simply dynamic programming model in R, following the reccomendations of Soetart Herman (A practical guide to ecological modeling). However, I've obtained a number of problems, that I'm unable to solve (even thoughI've tried during at least 2

Re: [R] dynamic programming

2011-05-29 Thread Patrick Breheny
On 05/29/2011 06:07 AM, garciap wrote: V-fitness*(c+dive*pfood, t+1) What are you trying to do in this line? Multiply fitness by two different things at once? The expression (1,2) Causes problems in R. If you want to combine them into a vector, you need c(1,2) Otherwise, please go

Re: [R] tm package

2011-05-29 Thread mpavlic
it should be findFreqTerms instead of findfreqTerms. m -- View this message in context: http://r.789695.n4.nabble.com/tm-package-tp3558064p3558783.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] tm package

2011-05-29 Thread mpavlic
it should be findFreqTerms instead of findfreqterms. m -- View this message in context: http://r.789695.n4.nabble.com/tm-package-tp3558064p3558784.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] How to do operations on zoo/xts objects with Monthly and Daily periodicities

2011-05-29 Thread Gabor Grothendieck
On Sat, May 28, 2011 at 5:22 PM, thierrydb thierr...@gmail.com wrote: Is there an elegant way to do operations (+/-/*/ / ) on zoo/xts objects when one serie is monthly (end of month) and the other daily (weekdays only) - typically a monthly economic indicator and a stock index price? Merge

Re: [R] Relevel() catagorical variables in a GLM

2011-05-29 Thread David Winsemius
On May 29, 2011, at 5:10 AM, ashley wrote: Thanks Josh, This makes sense. The coefficient of one parameter is given in reference to another parameter. (Aha! The reference parameter.) I'm still a little confused on the standard errors (SEs) and why they change too? Should I change the

[R] Oddity: I seem to have a variable in a dataframe that doesn't show in colnames() - can anyone advise?

2011-05-29 Thread Chris Evans
I may be being dopey, I surely am, but I'm baffled by this. I've been working, on and off for a few days in R version 2.13.0 (2011-04-13) i386-pc-mingw32/i386 (32-bit) working it through ESS. I've got a dataframe created a couple of days back, during the session: dim(AllDat) [1] 2727094 I

Re: [R] Oddity: I seem to have a variable in a dataframe that doesn't show in colnames() - can anyone advise?

2011-05-29 Thread Phil Spector
Chris - If you check the documentation for the $ operator, for example by typing help($) you'll find (among a lot of other information): name: A literal character string or a name (possibly backtick quoted). For extraction, this is normally (see under

Re: [R] Error with BRugs 0.53 and 0.71, on Win7 with R 2.12.2 and 2.13.0 (crashes R GUI)

2011-05-29 Thread Uwe Ligges
Sounds like a hardware problem to me, since I do not expereice any problems with the example you gave at first. Is this all on the same hardware? Uwe Ligges On 27.05.2011 18:38, Chris Chapman wrote: I've run into persistent problems with OpenBUGS crashing when using BRugs .53 and .71, and

[R] Why do not prevent users from creating a local copy of c() ?

2011-05-29 Thread Marco Barbàra
Hi all, sometime in the past I accidentaly created a copy of the c() primitive function inside my ``laboratory'' workspace, which I normally use to experiment and learn. As a consequence, c() stopped to work correctly and started to return lists of symbols instead of vectors, and today I had to

[R] constructing nxn matrices involving calculations conditions based on other tables

2011-05-29 Thread Luma R
Dear R-users, I am having trouble constructing nxn matrices involving calculations conditions based on other tables. Below I describe a simple example of what I am trying to do: Given the Table A (n x m): Species1 Species2 X A1,1 A1,2 Y A2,1 A2,2 Z A3,1 A3,2 I want to

Re: [R] Oddity: I seem to have a variable in a dataframe that doesn't show in colnames() - can anyone advise?

2011-05-29 Thread chrishold
I thought it might have been that but stupidly didn't search on $ and I can now see that the one partial match I tried would have been ambiguous so $ hadn't resolved it. Patrick Burns tells me I could have found this in the wonderful R inferno and I'm sure I could have, probably have, read that

Re: [R] Why do not prevent users from creating a local copy of c() ?

2011-05-29 Thread jim holtman
There is no way to prevent a user from messing up. No matter how many things you put in to prevent such occurances, I have always found that users find new ways to use your system that you never considered. There is always the 'conflicts()' function that might help: # create my 'c' c -

Re: [R] Why do not prevent users from creating a local copy of c() ?

2011-05-29 Thread Joshua Wiley
Hi Marco, I am sure theoretically it would be possible to make it so that copies could not be made of base (or core) functions, but users will always be able to shoot themselves in the foot if they try hard enough. I think the usual recommendation is just not to use common function names for

[R] reshape with function(x,y)?

2011-05-29 Thread John K. Williams
Hi, I'm not sure if this is impossible or if I just don't know the syntax. example: library(reshape); library(corpcor); data-data.frame(ids=c(A,A,A,B,B,B),rate=c(12,14,17,10,8,5),sample=c(100,80,60,50,40,45)); data_melted-melt.data.frame(data,id.vars=c(ids),measure.vars=c(rate,sample)); #the

Re: [R] Applying a function to a subset

2011-05-29 Thread Stephan Kolassa
Or just include is.na=TRUE in the definition of kurtosis(): kurtosis-function(x) { m4-sum((x-mean(x,na.rm=TRUE))^4,na.rm=TRUE)/length(x) s4-var(x,na.rm=TRUE)^2 m4/s4 - 3 } HTH Stephan Am 29.05.2011 11:34, schrieb Jim Holtman: kurtosis(fem[!is.na(fem)]) Sent from my iPad On May 29,

[R] One main caption for an mfrow=c(2,1) plot window

2011-05-29 Thread Alexander Engelhardt
Hello, I'm trying to plot a series of pages in a pdf with one main caption for each page. Each page should then have two plots in one row, preferably with an own caption. I can't plot the main caption in a window, and subsequently plot the two graphics (next to each other) below it. Here is

Re: [R] Applying a function to a subset

2011-05-29 Thread gaiarrido
That's it. thanks very much, I save hours if work qith your reply - Mario Garrido Escudero PhD student Dpto. de Biología Animal, Ecología, Parasitología, Edafología y Qca. Agrícola Universidad de Salamanca -- View this message in context:

[R] how to combine two data frames via factors (or somehow else)

2011-05-29 Thread Philipp Chapkovski
Hello! The question should be very naive, but I am a beginner and stuck with this unfortunately. There is a dataset of people's affiliation to companies that looks like that (a data frame actually) x y 1 a X 2 b X 3 c X 4 f Z 5 e Z 6 g Z where x is a name of a person and y is a company name.

[R] Fitting spline using Pspline

2011-05-29 Thread guy33
Hey all, I seem to be having trouble fitting a spline to a large set of data using PSpline. It seems to work fine for a data set of size n=4476, but not for anything larger (say, n=4477). For example: THIS WORKS: - random = array(0,c(4476,2)) random[,1] =

Re: [R] how to combine two data frames via factors (or somehow else)

2011-05-29 Thread Sarah Goslee
merge() should do the trick. Using strings instead of factors works better, though. Sarah On Sun, May 29, 2011 at 4:51 PM, Philipp Chapkovski chapkov...@gmail.com wrote: Hello! The question should be very naive, but I am a beginner and stuck with this unfortunately. There is a dataset of

Re: [R] how to combine two data frames via factors (or somehow else)

2011-05-29 Thread Phil Spector
Philipp - I believe you're looking for the merge function. If you need more guidance, please provide a meaningful reproducible example. - Phil Spector Statistical Computing Facility

Re: [R] how to combine two data frames via factors (or somehow else)

2011-05-29 Thread Joshua Wiley
Hi Philipp, ## Read in your data ## posting the output of dput() would have made our lives easier d1 - read.table(textConnection(x y 1 a X 2 b X 3 c X 4 f Z 5 e Z 6 g Z), header = TRUE, row.names = 1) d2 - read.table(textConnection( y1 y2 1 X W 2 Z W), header = TRUE, row.names = 1)

Re: [R] remove , at the end of each line for all lines except the first line in a data frame

2011-05-29 Thread Paul Murrell
Hi On 29/05/2011 2:02 a.m., Dennis Murphy wrote: Homework question? Indeed it is. Dear 220 student. The resources at your university, including your lecturer, should be your first port of call for questions on labs and assignments. Also, if you ever post questions on a forum like this

Re: [R] Fitting spline using Pspline

2011-05-29 Thread Ravi Varadhan
Use the smooth.spline() function in stats package. This is more stable. ?smooth.spline Ravi. From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of guy33 [david.res...@magd.ox.ac.uk] Sent: Sunday, May 29, 2011 1:30 PM To:

[R] Hello!

2011-05-29 Thread Amanda Zeqiri
Hi, I'm a student studing for Math. Infor. Ing. in Tirana,Albania and a have a final project in R to finish in a week, so I badly need your help... The topic of the project is Hermite Interpolation and a I have allready done a script that finds the approximation in a certan point x, H(x)

Re: [R] Error with BRugs 0.53 and 0.71, on Win7 with R 2.12.2 and 2.13.0 (crashes R GUI)

2011-05-29 Thread Chris Chapman
Uwe -- thank you. No, this occurs on three different machines: two at work (a Lenovo laptop running Win7-32, plus an HP workstation running Win7-64) ... and I just tried another Compaq desktop machine at home running WinXP-32, with the same result. I agree that this seems highly unusual

Re: [R] Fitting spline using Pspline

2011-05-29 Thread guy33
Ravi, Thanks so much! You're right, smooth.spline does work on larger n. Although, for some reason it's results are different (slightly less good?, but I'm not sure). For example, on the simple doppler function below, sm.spline seems to be closer to the true function than smooth.spline:

Re: [R] Simulation from discrete uniform

2011-05-29 Thread SERDAR NESLIHANOGLU
Hi Also , same problem to create discrete uniform Distribution , But sample () and runif() not useful to generate discrete uniform . Ex: u-round(runif(10*10,min=1,max=10),0) table(u) u 1 2 3 4 5 6 7 8 9 10 6 10 9 10 14 6 11 14 12 8 Not useful for large number OR #

Re: [R] Simulation from discrete uniform

2011-05-29 Thread Jorge Ivan Velez
Hi Serdar, Take a look at the following: sample(0:9, 100, replace = FALSE) Error in sample(0:9, 100, replace = FALSE) : cannot take a sample larger than the population when 'replace = FALSE' sample(0:9, 100, replace = TRUE) [1] 5 6 5 7 3 0 8 4 8 2 2 4 7 6 0 7 0 0 0 7 5 6 3 6 0 9 6 1 2 6 9

[R] why does scan(gzfile(file), what='integer') import data as mode character ?

2011-05-29 Thread Matthew Keller
Hi all, My code: x - scan(gzfile(file),what='integer') x is imported, but as mode character rather than integer. I know I can do as.integer() when importing, but am still trying to figure out why the above occurs. When I do summary(as.integer(x)), there are no NAs introduced by coercion, so the

Re: [R] why does scan(gzfile(file), what='integer') import data as mode character ?

2011-05-29 Thread William Dunlap
Try giving what an example of an integer instead of the character string integer. E.g., what = 0L or what = integer(0) 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

[R] ideas about how to reduce RAM improve speed in trying to use lapply(strsplit())

2011-05-29 Thread Matthew Keller
hi all, I'm full of questions today :). Thanks in advance for your help! Here's the problem: x - c('18x.6','12x.9','302x.3') I want to get a vector that is c('18x','12x','302x') This is easily done using this code: unlist(lapply(strsplit(x,.,fixed=TRUE),function(x) x[1])) So far so good. The

Re: [R] ideas about how to reduce RAM improve speed in trying to use lapply(strsplit())

2011-05-29 Thread jim holtman
Try this approach: x - c('18x.6','12x.9','302x.3') gsub(^(.*)\\..*, '\\1', x) [1] 18x 12x 302x On Sun, May 29, 2011 at 8:10 PM, Matthew Keller mckellerc...@gmail.com wrote: hi all, I'm full of questions today :). Thanks in advance for your help! Here's the problem: x -

Re: [R] ideas about how to reduce RAM improve speed in trying to use lapply(strsplit())

2011-05-29 Thread Joshua Wiley
Hi Matt, There are likely more efficient ways still, but this is a big performance boost time-wise for me: x - c('18x.6','12x.9','302x.3') gsub(\\.(.+$), , x) x - rep(x, 10^5) system.time(out1 - unlist(lapply(strsplit(x,.,fixed=TRUE),function(x) x[1]))) user system elapsed 2.89

Re: [R] ideas about how to reduce RAM improve speed in trying to use lapply(strsplit())

2011-05-29 Thread Ian Gow
Not a new approach, but some benchmark data (the perl=TRUE speeds up Jim's suggestion): x - c('18x.6','12x.9','302x.3') y - rep(x,10) system.time(temp - unlist(lapply(strsplit(y,.,fixed=TRUE),function(x) x[1]))) user system elapsed 1.203 0.018 1.222 system.time(temp2 -

Re: [R] ideas about how to reduce RAM improve speed in trying to use lapply(strsplit())

2011-05-29 Thread Timothy Bates
Hi Matt, Though it's the last solution on your list, I would treat this as a text editing problem: just find and replace \.[0-9], then read in the result. perl -pi -e 's/x\.[0-9]//g' *test.txt likely done in seconds. But other R solutions seem to be coming in in a fairly timely manner too. t

Re: [R] Fitting spline using Pspline

2011-05-29 Thread Ravi Varadhan
Yes, you are right that the results of smooth.spline are slightly worse than that of sm.spline. The Doppler function is tricky. At small `x' values, it oscillates rapidly. Hence it is not surprising that the smoothers do not do as well. Here is a noisy version of your Doppler function. I