Re: [R] apply a function down each column

2010-01-12 Thread Laetitia Schmid
Dear Steve, my solution looks like it would work, but it does not. I attached a text file with an extract of my data. Maybe you can try it yourself. I want to compare C1 with M1, C2 with M2, C3 with M3,,, for each column. I do not really know what the problem is. R complains about a syntax

[R] Drought Severity Index (DSI)

2010-01-12 Thread Muhammad Rahiz
Does anyone have the code to calculate the drought severity index? -- Muhammad Rahiz | Doctoral Student in Regional Climate Modeling Climate Research Laboratory, School of Geography the Environment Oxford University Centre for the Environment, University of Oxford South Parks Road, Oxford,

Re: [R] HoltWinters Forecasting

2010-01-12 Thread Peter Ehlers
In situations where an ancient version and a less ancient version of R give different results for the same data it's a good idea to check the NEWS file. For HoltWinters() you will find an entry for R VERSION 2.8.0 that indicates a change in the default number of start periods used to autodetect

[R] Problems with betareg()

2010-01-12 Thread Al Leong
Hi, In using the betareg package, I encounter the following error message: Error in lm.wfit(x, linkfun(y), weights, offset = offset) : NA/NaN/Inf in foreign function call (arg 4) Any help will be most appreciated. Thanks in advance. Alex __

Re: [R] apply a function down each column

2010-01-12 Thread Peter Ehlers
See inline below. Laetitia Schmid wrote: Dear Steve, my solution looks like it would work, but it does not. I attached a text file with an extract of my data. Maybe you can try it yourself. I want to compare C1 with M1, C2 with M2, C3 with M3,,, for each column. I do not really know what the

Re: [R] Problems with betareg()

2010-01-12 Thread Achim Zeileis
On Tue, 12 Jan 2010, Al Leong wrote: Hi, In using the betareg package, I encounter the following error message: Error in lm.wfit(x, linkfun(y), weights, offset = offset) : NA/NaN/Inf in foreign function call (arg 4) Any help will be most appreciated. Thanks in advance. We can't possibly

Re: [R] find the corresponding mean y

2010-01-12 Thread Keith Jewell
Not very clear what you want, but perhaps... ?sortedXyData ...might help. hth KJ luciferyan anniehyh...@googlemail.com wrote in message news:1263231740556-1011427.p...@n4.nabble.com... Hello, I have 49 paired data, x, y. I have sampled x (where replacement is true), and find its mean. How

[R] plot prices and dates in a nice way

2010-01-12 Thread Trafim Vanishek
Dear all, I currently experience the problem with nicely plotting price data against the dates. Data - read.csv(C:/IBM.csv, header = TRUE, sep = ,) plot(Data[,1], Data[,2]) I cannot find the way how can I choose the # of breaks for the x axis - dates in this case? Thanks a lot

Re: [R] warning inside loop

2010-01-12 Thread Rense
Dear William, thank you kindly for this solution: it provides exactly what I need, especially due to the fact that the encapsulating function returns a list, from which I can extract all the information I need. kind regards, Rense Nieuwenhuis William Dunlap wrote: -Original

[R] read.spss: option to.data.frame and string variables

2010-01-12 Thread RINNER Heinrich
Dear R-users, I am using R version 2.10.1 and package foreign version 0.8-39 under windows. When reading .sav-Files (PASW Statistics 18.0.1) containing string variables, these are automatically converted to factors when using option to.data.frame = TRUE (see example below). It's clear to me

Re: [R] R for windows 64 bit

2010-01-12 Thread alessia matano
Dear all, I just download and set this new version of R. I am now trying to download the packages I need which are sperseM and quantreg. I downloaded and insert into the library file the quantreg pacjkage and it seems to work. However, when I try to do the same with sparseM I get the following

[R] plot ylab on the right

2010-01-12 Thread Mister Vanhalen
Hello, I have a graphic and I want to plot the yaxis AND ylab on the right. I manage to plot axis on the right with axis(4) but I don't know how to write the ylab on the right. barplot(data, name=leg, xlab=Probability, ylab=Number of links, axes=F) axis(4) And another question : Is there an

Re: [R] R for windows 64 bit

2010-01-12 Thread Uwe Ligges
On 12.01.2010 11:33, alessia matano wrote: Loading required package: SparseM Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared library 'C:/PROGRA~1/R/R-211~1.0DE/library/SparseM/libs/SparseM.dll': LoadLibrary failure: %1 non è un'applicazione di Win32

Re: [R] plot ylab on the right

2010-01-12 Thread Jim Lemon
On 01/12/2010 09:41 PM, Mister Vanhalen wrote: Hello, I have a graphic and I want to plot the yaxis AND ylab on the right. I manage to plot axis on the right with axis(4) but I don't know how to write the ylab on the right. barplot(data, name=leg, xlab=Probability, ylab=Number of links,

Re: [R] drop1: warning message

2010-01-12 Thread Uwe Ligges
No idea, you may want to tell us all your calls and give a reproducible example as well as properly formatted code that is more readable than the stuff below. I guess you omitted some other warnings that tell you about too few obervations to fit the model (the fitted probabilities numerically

Re: [R] read.spss: option to.data.frame and string variables

2010-01-12 Thread David Winsemius
It would be an significant undertaking to annotate all the places where the default behavior of strings-to-factors conversion might trip up the unwary. You are not the first by any means to complain. You might: a) take the step that the Mayo Clinic has taken of setting the default in

Re: [R] plot prices and dates in a nice way

2010-01-12 Thread Uwe Ligges
On 12.01.2010 10:39, Trafim Vanishek wrote: Dear all, I currently experience the problem with nicely plotting price data against the dates. Data- read.csv(C:/IBM.csv, header = TRUE, sep = ,) plot(Data[,1], Data[,2]) I cannot find the way how can I choose the # of breaks for the x axis -

Re: [R] Drought Severity Index (DSI)

2010-01-12 Thread Jim Lemon
On 01/12/2010 07:21 PM, Muhammad Rahiz wrote: Does anyone have the code to calculate the drought severity index? Hi Muhammad, If you mean does anyone have the algorithm? it seems pretty hard to find. Even that old standby Wikipedia didn't have a description of Palmer's algorithm. If you

[R] Beginer data.frame

2010-01-12 Thread Jean-Baptiste Combes
Hello, I use R 2.10, and I am new in R (I used to use SAS and lately Stata), I am using XP. I have a data which has a data.frame format called x.df (read from a csv file). I want to take from this data observations for which the variable Code starts with an R. I took all the Code and put them

Re: [R] Drought Severity Index (DSI)

2010-01-12 Thread Muhammad Rahiz
Hello Jim, Thanks for the response. I have the algorithm based on the original paper (Bryant et al. 1994) and subsequent modification by Philips and McGregor(1994). The latter gives the formula for calculating the index in MS Excel. I'm trying to translate it to R. Muhammad Muhammad

[R] Reading a file with mixed cyrillic/latin characters

2010-01-12 Thread Stephan Kolassa
Dear useRs, I am trying to read a tab-delimited Unicode text file containing both latin and cyrillic characters and failing miserably. The file looks like this (I hope it comes across right): A B C 3 foo ФОО 5 bar БАР read.table(foo.txt,sep=\t,header=TRUE) I

Re: [R] R for windows 64 bit

2010-01-12 Thread alessia matano
Fine, it worked. I will try in this way. Just the last question and I won't bother you further today. My machine right now has just 6 giga of RAM (it will be increased to 16 in a few days), and I see that with this experimental version memory.limit is 6135. How is the command to increase the

Re: [R] Beginer data.frame

2010-01-12 Thread Stephan Kolassa
Hi Jean-Baptiste, two points: 1) Your variable df is a *local* variable which you define in your function myfunc(), so it is not known outside myfunc(). When you ask is.data.frame(df), R looks at the global definition of df - which is the density function of the F distribution. To make your

Re: [R] Beginer data.frame

2010-01-12 Thread K. Elo
Hi! Jean-Baptiste Combes wrote: Hello, I use R 2.10, and I am new in R (I used to use SAS and lately Stata), I am using XP. I have a data which has a data.frame format called x.df (read from a csv file). I want to take from this data observations for which the variable Code starts with

Re: [R] Beginer data.frame

2010-01-12 Thread David Winsemius
On Jan 12, 2010, at 6:17 AM, Jean-Baptiste Combes wrote: Hello, I use R 2.10, and I am new in R (I used to use SAS and lately Stata), I am using XP. I have a data which has a data.frame format called x.df (read from a csv file). I want to take from this data observations for which the

[R] time series analys by resting the effect of a covariate

2010-01-12 Thread Simone Santoro
Hi, Does anyone know a way to estimate the existence of a temporal trend (each unit of the sample is a count) by resting the possible effect of a covariate (i.e. climatic factor)? I have periodical counts of several species of waterbirds during the last 13 years and I want to know if, resting

[R] coerce vector into array - change filling sequence

2010-01-12 Thread Kohleth Chia
Dear all, When I coerce a vector into a multi dimensional array, I would like R to start filling the array along the last dimension, then the 2nd last etc. Let's jump straight into an example. x - 1 : 24 y - array(dim=c(2,2,6)) I would like to have: y[1,1,1] = 1 y[1,1,2] = 2 ... y[1,1,6] = 6

Re: [R] coerce vector into array - change filling sequence

2010-01-12 Thread Stephan Kolassa
Hi, you can permute array dimensions using aperm(): x - 1 : 24 z - array(x, dim=c(6,2,2)) y - aperm(z,perm=c(3,2,1)) y[1,1,] HTH, Stephan Kohleth Chia schrieb: Dear all, When I coerce a vector into a multi dimensional array, I would like R to start filling the array along the last

[R] Conditional Sampling

2010-01-12 Thread ehcpieterse
Hi, I am hoping someone can help me with a sampling question. I am using the following function to sample 10 unique observations: x - sample(1:100, 10, replace=F) Given the first 10 observations, I need to sample another 5 unique observations from the remainder. I essentially want to do a Monte

Re: [R] plot ylab on the right

2010-01-12 Thread Mister Vanhalen
It's works perfectly ! ;) Thank you very much !! M A On Tue, Jan 12, 2010 at 11:56 AM, Jim Lemon j...@bitwrit.com.au wrote: On 01/12/2010 09:41 PM, Mister Vanhalen wrote: Hello, I have a graphic and I want to plot the yaxis AND ylab on the right. I manage to plot axis on the right with

Re: [R] Beginer data.frame

2010-01-12 Thread Gabor Grothendieck
See help(grepl) so using built in data frame CO2 this gets rows whose Plant column start with Qn: subset(CO2, grepl(^Qn, Plant)) On Tue, Jan 12, 2010 at 6:17 AM, Jean-Baptiste Combes jeanbaptiste.combes.a...@googlemail.com wrote: Hello, I use R 2.10, and I am new in R (I used to use SAS and

[R] Pharmacokinetic and pharmacodynamic modeling and simulation

2010-01-12 Thread Dick Verkerk
Pharmacokinetic and pharmacodynamic modeling and simulation By Dr. Jan Freijer March 18, 2010 Amsterdam, The Netherlands http://www.can.nl/events/details.php?id=57 This course is aimed at users of R or S-PLUS in the bio-pharmaceutical sciences who would like to use R for clinical trial

Re: [R] Conditional Sampling

2010-01-12 Thread Ted Harding
On 12-Jan-10 12:58:13, ehcpieterse wrote: Hi, I am hoping someone can help me with a sampling question. I am using the following function to sample 10 unique observations: x - sample(1:100, 10, replace=F) Given the first 10 observations, I need to sample another 5 unique observations

[R] trouble with installing SJava

2010-01-12 Thread Jiiindo
Colleagues, How i can solve this error when i install SJava package Thanks R CMD INSTALL -c /usr/local/lib/R/SJava_0.69-0.tar.gz * installing to library ‘/usr/local/lib/R/site-library’ * installing *source* package ‘SJava’ ... checking for java...

Re: [R] Drought Severity Index (DSI)

2010-01-12 Thread Steve_Friedman
A few years ago, I work with Stuart Gage who had developed a Heat / Precipitation Index as a measure of drought severity. It works just as well if not better than the Palmer Drought Index. You can find the formula in this only pdf report: Climate Variability in the North Central Region:

Re: [R] Drought Severity Index (DSI)

2010-01-12 Thread Muhammad Rahiz
Thanks Steve! Muhammad Rahiz | Doctoral Student in Regional Climate Modeling Climate Research Laboratory, School of Geography the Environment Oxford University Centre for the Environment South Parks Road, Oxford, OX1 3QY, United Kingdom Tel: +44

Re: [R] Conditional Sampling

2010-01-12 Thread ehcpieterse
Thanks Ted, your solution does make perfect sense. The only question I still have is that I would like to sample the remaining 5 observations after I have randomly selected the first 10. Given the initial 10, I would like to sample the following 5 say 1,000 times to get a simulated conditional

Re: [R] sparseM and kronecker product_R latest version

2010-01-12 Thread Martin Maechler
am == alessia matano alexis@gmail.com on Mon, 11 Jan 2010 16:20:57 +0100 writes: am Many thanks for it. am However it is strange that when I put the numbers rather than ncol(R) am (a matrix with ncol=36698) it worked. Look below dim(res2) am [1] 170471 25822

Re: [R] Conditional Sampling

2010-01-12 Thread Magnus Torfason
Would the following work, or is there a reason why it would not? risk.set - 1:100 first.10 - sample(risk.set, 10) remainder - setdiff(risk.set, first.10) for ( i in 1:1000 ) { next.5 - sample(remainder, 5) do.something.with(next.5) } Best, Magnus On 1/12/2010 9:00 AM,

Re: [R] Conditional Sampling

2010-01-12 Thread Ted Harding
On 12-Jan-10 14:00:24, ehcpieterse wrote: Thanks Ted, your solution does make perfect sense. The only question I still have is that I would like to sample the remaining 5 observations after I have randomly selected the first 10. Given the initial 10, I would like to sample the following 5

Re: [R] Solving graph theory problems with R ? (minimum vertex cover)

2010-01-12 Thread Magnus Torfason
On 1/12/2010 12:12 AM, Johannes Hüsing wrote: Tal Galili schrieb: My specific problem is called: Minimum vertex cover for a hypergraph I know nothing about the problem at hand, but on the Wikipedia page it says that the problem can be formulated as an integer linear program. There is an R

[R] The TeX-source for the package manual.

2010-01-12 Thread BXC (Bendix Carstensen)
I have noted that the later versions of Rcmd check cleans out the directory pkg.Rcheck so that only package-manual.log and package-manual.pdf are left. Formerly the package-manual.tex was around too --- very handy for various purposes. Is there a way to generate the .tex - version of the manual

[R] List arguments from data frame columns in formula

2010-01-12 Thread npobedina
Hi! I'm trying to run logistic regression on a dataset which is contained in dataframe data (y is in the first col, and 28 parameters for the model). How can I write formula for function `glm` without listing explicitly all 28 paramaters?

Re: [R] List arguments from data frame columns in formula

2010-01-12 Thread Gabor Grothendieck
Try this: glm(y ~ ., family = binomial, data = data, ...) On Tue, Jan 12, 2010 at 9:45 AM, npobedina npobed...@gmail.com wrote: Hi! I'm trying to run logistic regression on a dataset which is contained in dataframe data (y is in the first col, and 28 parameters for the model). How can I

[R] Multiple symbols per single line in a legend

2010-01-12 Thread Primoz PETERLIN
Hello everybody, Is it possible to coax legend() into displaying more than one simbol per line in legend? I have a graph like the one attached to this mail; I would like to reorganize the legend in such a way that the duplicate text would be omitted, i.e., the first line would read square

[R] problem with bio3d package

2010-01-12 Thread rgfrance
Hello, I have a problem, when I run read.fasta.pdb I get this error: pdb/seq: 1 name: dcluster.1 Error: subscript out of bounds My FASTA file is the sequence of the bovine insuline. Thanks in advance, Rg -- View this message in context:

Re: [R] Conditional Sampling

2010-01-12 Thread ehcpieterse
Thanks Ted, it's exactly what I'm after. Thanks for the help. -- View this message in context: http://n4.nabble.com/Conditional-Sampling-tp1012072p1012180.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

Re: [R] List arguments from data frame columns in formula

2010-01-12 Thread npobedina
Thanks a lot for help! :) I've invented a more complicated way to make it work: f - as.formula(paste(data.y~, paste( names(data.x), collapse = +))) fml-glm(f, data=data.x,family=binomial) Try this: glm(y ~ ., family = binomial, data = data, ...) -- View this message in context:

[R] optim: abnormal termination in lnsrch

2010-01-12 Thread Mario Valle
I'm using optim() to minimize a certain function. Often the minimization ends with the message: ERROR: ABNORMAL_TERMINATION_IN_LNSRCH What is optim() trying to say? What have I to change in my function to make the minimization succeed? Do you think using BBoptim() instead of optim() changes

[R] optim: abnormal termination in lnsrch (resend)

2010-01-12 Thread Mario Valle
[sorry, forgot some details...] I'm using optim(param, fun, method='L-BFGS-B', lower=lo, upper=up) to minimize a certain function. Often the minimization ends with the message: ERROR: ABNORMAL_TERMINATION_IN_LNSRCH What is optim() trying to say? What have I to change in my function to make

Re: [R] optim: abnormal termination in lnsrch (resend)

2010-01-12 Thread Ravi Varadhan
You forgot a lot of details. Can you send us more information about the fn and also some minimal code that can reproduce the problem? Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and

[R] Placing eps files from R into Adobe InDesign documents: specifying fontfamily

2010-01-12 Thread dwalcerz
This is a solution I am posting for a problem that others may have. If you want to: 1. Place lattice graphics from R into an Adobe InDesign document, and 2. Use the export as eps function in R to maximize resolution (it is much better than exporting as a metafile or bitmap), and 3. Use long

[R] getting p values

2010-01-12 Thread Rosario Garcia Gil
Dear colleges I need to get the p values for a table with 15000 entries of t values. Does any of you know how to do it? I can, of course, get one by one but that is not sensible. Thanks Rosario __ R-help@r-project.org mailing list

[R] barplot: border color when stacked

2010-01-12 Thread RINNER Heinrich
Dear R-users, I am using R version 2.10.1 under windows. In a barplot, I want to mark one of the bars with a special border color. For example: barplot(c(3, 7, 11), border = c(NA, red, NA)) But how to do this when the bars are stacked? for example: barplot(matrix(1:6, ncol=3)) # border of

Re: [R] barplot: border color when stacked

2010-01-12 Thread Henrique Dallazuanna
You can edit the barplot function to do this: mybarplot - function (height, width = 1, space = NULL, names.arg = NULL, legend.text = NULL, beside = FALSE, horiz = FALSE, density = NULL, angle = 45, col = NULL, border = par(fg), main = NULL, sub = NULL, xlab = NULL, ylab = NULL, xlim =

Re: [R] apply a function down each column

2010-01-12 Thread Peter Ehlers
Laetitia, I was just responding to your comment that R complains about a syntax error. But I realize now that 2x would probably cause an unexpected symbol error. Here's what I get when I run your loop; what do you get? for (x in 1:(nrow(dat)-1)) { + a - as.character(dat[(2x-1),1]) Error:

Re: [R] sparseM and kronecker product_R latest version

2010-01-12 Thread alessia matano
I see, now I got it. and thanks for the example with matrix. best alessia 2010/1/12 Martin Maechler maech...@stat.math.ethz.ch: am == alessia matano alexis@gmail.com     on Mon, 11 Jan 2010 16:20:57 +0100 writes:    am Many thanks for it.    am However it is strange that when I put the

[R] optim: abnormal termination in lnsrch (resend)

2010-01-12 Thread Mario Valle
Attached a script that reproduces the problem. My function is fold.val() and at the end seems the curve contained in lnsrch.dat is fitted quite well, but optim generates the error. Thanks again! mario - I'm using optim(param, fun, method='L-BFGS-B',

[R] how to handle missing values . when importing data in R

2010-01-12 Thread karena
hi, I have a question about importing data in R. I want to import a file which has missing value in it, and the missing values are denoted as ., I want to first read in the file, and then change the . into the number zero 0. how can I do that? thank you, karena -- View this message in

Re: [R] Functions for QUAIDS and nonlinear SUR?

2010-01-12 Thread Arne Henningsen
On Sat, Jan 9, 2010 at 1:21 AM, Werner W. pensterfuz...@yahoo.de wrote: I would like to estimate a quadratic almost ideal demand system in R which is estimated usually by nonlinear seemingly unrelated regression. But there is no such function in R yet The systemfit package has the function

Re: [R] how to handle missing values . when importing data in R

2010-01-12 Thread jim holtman
?read.table na.strings='.' Then change all NAs to zero df$col[is.na(df$col)] - 0 On Tue, Jan 12, 2010 at 12:46 PM, karena dr.jz...@gmail.com wrote: hi, I have a question about importing data in R. I want to import a file which has missing value in it, and the missing values are

Re: [R] getting p values

2010-01-12 Thread Duncan Murdoch
On 12/01/2010 10:47 AM, Rosario Garcia Gil wrote: Dear colleges I need to get the p values for a table with 15000 entries of t values. Does any of you know how to do it? I can, of course, get one by one but that is not sensible. Put the t values into a vector, then use pt() in an

[R] Calculate the percentages of the numbers in every column.

2010-01-12 Thread Kelvin
Dear friends, I have a table like this, I have A B C D ... levels, the first column you see is just the index, and there are different numbers in the table. A B C D ... 10 2 1 0 21 0 2 1 32 3 0 0 40 0 1 0 50 2 3 1 ... I want to

Re: [R] how to handle missing values . when importing data in R

2010-01-12 Thread karena
Hi, tim, thank you very much for the reply, but I am really a new user. How to change all NAs to zero? thanks again. karena jholtman wrote: ?read.table na.strings='.' Then change all NAs to zero df$col[is.na(df$col)] - 0 On Tue, Jan 12, 2010 at 12:46 PM, karena

[R] optimization challenge

2010-01-12 Thread Greg Snow
I have a challenge that I want to share with the group. This is not homework (but I may assign it as such if I teach the appropriate class again) and I have found one solution, so don't need anything urgent. This is more for fun to see if others can find a better solution than I did. The

[R] Non-metric multidimensional scaling (NMDS) help

2010-01-12 Thread kellys17
Hi, I am currently working on some data and feel that NMDS would return an excellent result. With my current data set however I have been experiencing some problems and cannot carry out metaMDS. I have tried with a few smaller data sets which I created for practice sake and this has worked

Re: [R] svm

2010-01-12 Thread Amy Hessen
Hi Steve, Thank you so much for your reply. I really needed to know how SVM works without removing the class label while receiving it in the formula parameter. It does not if I remove the class label. Cheers, Amy Date: Sat, 9 Jan 2010 15:48:49 -0500 Subject: Re: [R] svm From:

Re: [R] how to handle missing values . when importing data in

2010-01-12 Thread Ted Harding
On 12-Jan-10 17:46:47, karena wrote: hi, I have a question about importing data in R. I want to import a file which has missing value in it, and the missing values are denoted as ., I want to first read in the file, and then change the . into the number zero 0. how can I do that? thank

Re: [R] optim: abnormal termination in lnsrch (resend)

2010-01-12 Thread Ravi Varadhan
Mario, It seems likely that your function is not smooth in the parameters. This may create problems for some optimizers that require smoothness. However, I was able to get good convergence with `spg' function in my BB package. Here is how it works: require(BB) Loading required package: BB

Re: [R] Conditional Sampling

2010-01-12 Thread Greg Snow
The last 2 lines of your code can be replaced with: M - replicate(1000, sample(Y,5,replace=FALSE) ) -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org

[R] post-hoc after ancova

2010-01-12 Thread Mahua Ghara
I have done ancova with categorical and continuous predictor variables. The categorical predictor variable shows significant effect on the dependent variable. I would like to do a post-hoc test to see which groups in the categorical variable differ. I have explored Tukey test in multcomp package.

Re: [R] optim: abnormal termination in lnsrch (resend)

2010-01-12 Thread Berend Hasselman
Mario Valle wrote: [sorry, forgot some details...] I'm using optim(param, fun, method='L-BFGS-B', lower=lo, upper=up) to minimize a certain function. Often the minimization ends with the message: ERROR: ABNORMAL_TERMINATION_IN_LNSRCH What is optim() trying to say? What have I to

[R] Making routine faster by using apply instead of for-loop

2010-01-12 Thread Etienne Stockhausen
Hey everybody, I have a small problem with a routine, which prepares some data for plotting. I've made a small example: c=10 mat=data.frame(matrix(1:(c*c),c,c)) row.names(mat)=seq(c,1,length=c) names(mat)=c(seq(2,c,length=c/2),seq(c,2,length=c/2)) v=as.numeric(row.names(mat))

Re: [R] how to handle missing values . when importing data in R

2010-01-12 Thread jim holtman
What is the structure of the data that you are reading in? Are you using 'read.table', 'scan', etc.? Are all the columns numeric, or do you just want to change some of them? If you have used 'na.strings' to cause the values of the missing data to be set to NA, then you can iterate through the

Re: [R] expand.grid game

2010-01-12 Thread Greg Snow
This also has a closed form solution: choose(16+8-1,7) - choose(7+8-1, 7) - 7*choose(6+8-1,7) [1] 229713 -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org

Re: [R] The TeX-source for the package manual.

2010-01-12 Thread Rolf Turner
On 13/01/2010, at 3:40 AM, BXC (Bendix Carstensen) wrote: I have noted that the later versions of Rcmd check cleans out the directory pkg.Rcheck so that only package-manual.log and package- manual.pdf are left. Formerly the package-manual.tex was around too --- very handy for various

Re: [R] expand.grid game

2010-01-12 Thread baptiste auguie
Nice --- am I missing something or was this closed form solution not entirely trivial to find? I ought to compile the various clever solutions given in this thread someday, it's fascinating! Thanks, baptiste 2010/1/12 Greg Snow greg.s...@imail.org: This also has a closed form solution:

[R] Drop last numeral

2010-01-12 Thread LCOG1
Hello all, Frustrated and i know you can help I need to drop the last numeral of each of my values in my data set. So for the following i have tried the ?substring but since i have to specify the length, but because my data are of varying lengths it doenst work so well Data-c(1131, 1132,

Re: [R] Drop last numeral

2010-01-12 Thread Nutter, Benjamin
Data-c(1131, 1132, 1731 ,1732 ,1821 ,1822, 2221 ,, 2241 ,2242,414342 ,414371 ,414372) Bldgid-substring(as.character(Data),1,nchar(Data)-1) -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of LCOG1 Sent: Tuesday, January 12, 2010

Re: [R] Non-metric multidimensional scaling (NMDS) help

2010-01-12 Thread Gavin Simpson
On Tue, 2010-01-12 at 10:28 -0800, kellys17 wrote: Hi, I am currently working on some data and feel that NMDS would return an excellent result. With my current data set however I have been experiencing some problems and cannot carry out metaMDS. I have tried with a few smaller data sets

Re: [R] Drop last numeral

2010-01-12 Thread Dennis Murphy
Also try sub('[0-9]$', '', Data) [1] 113 113 173 173 182 182 222 222 224 [10] 224 41434 41437 41437 HTH, Dennis On Tue, Jan 12, 2010 at 10:36 AM, LCOG1 jr...@lcog.org wrote: Hello all, Frustrated and i know you can help I need to drop the last numeral of each of my

Re: [R] how to handle missing values . when importing data in R

2010-01-12 Thread karena
thank you guys. All the columns of my data are numeric. I tried both methods, and they both work. I appreciate your help. -k -- View this message in context: http://n4.nabble.com/how-to-handle-missing-values-when-importing-data-in-R-tp1012298p1012397.html Sent from the R help mailing list

Re: [R] R for windows 64 bit

2010-01-12 Thread Alexander Shenkin
Hi Alessia, Note that, while your physical limit might be 6 GB, Windows memory management allows more memory than that to be allocated (aka Virtual Memory, or at least that's what they called it in XP). Windows swaps out memory from RAM to the hard disk and back when necessary (please excuse the

Re: [R] Drop last numeral

2010-01-12 Thread Greg Snow
In addition to the substring and regular expression solutions, if you are certain that everything will be numeric (and integer as in your examples), then you could just convert to numeric, divide by 10, and then drop the decimal (floor or as.integer). -- Gregory (Greg) L. Snow Ph.D.

Re: [R] Drop last numeral

2010-01-12 Thread Steve Taylor
Try this: substr(Data,1,nchar(Data)-1) Steve From: LCOG1 jr...@lcog.org To:r-help@r-project.org Date: 13/Jan/2010 9:15 a.m. Subject: [R] Drop last numeral Hello all, Frustrated and i know you can help I need to drop the last numeral of each of my values in my data set. So for the

Re: [R] Making routine faster by using apply instead of for-loop

2010-01-12 Thread William Dunlap
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Etienne Stockhausen Sent: Tuesday, January 12, 2010 10:59 AM To: r-help@r-project.org Subject: [R] Making routine faster by using apply instead of for-loop Hey everybody, I

Re: [R] Making routine faster by using apply instead of for-loop

2010-01-12 Thread Peter Ehlers
Your code is doing too many needless things. The following takes about one second on my slow Vista laptop. n - 500 mat - matrix(1:(n*n), n) v - n:1 z - 2*1:(n/2) w - c(z, rev(z)) for(i in seq_len(n)){ for(j in seq_len(n)){ if(v[j] + w[i] = n)(mat[i,j] - NA) } } rownames(mat) - v

Re: [R] expand.grid game

2010-01-12 Thread Greg Snow
How trivial is probably subjective, I don't think it is much above trivial. I would not have been surprised to see this question on an exam in my undergraduate (300 or junior level) probability course (the hard part was remembering the details from that class from over 20 years ago). My

Re: [R] LD50 and SE in GLMM (lmer)

2010-01-12 Thread Linda Bürgi
Thank you very much for the code Bill! I only had to change very few things to make it work for probit and lmer (instead of glmmPQL) and it works perfectly! Here's my code (I had some trouble with the output style glm.dose, so I just have it come out as an ugly list now, which isn't a problem

[R] [Solved][Code Snippets] Dropping Empty Regressors

2010-01-12 Thread Idgarad
To make a long story short I was doing some in-sample testing in which some dynamically created regressors would end up either all true or all false based on the validation portion. In my case a new mainframe configuration (this is a crappy way to handle a level shift but I do what I can.) So here

Re: [R] expand.grid game

2010-01-12 Thread Rolf Turner
On 13/01/2010, at 9:19 AM, Greg Snow wrote: How trivial is probably subjective, I don't think it is much above trivial. I would not have been surprised to see this question on an exam in my undergraduate (300 or junior level) probability course (the hard part was remembering the details

Re: [R] Drop last numeral

2010-01-12 Thread LCOG1
The Below worked best for my purposes. Thanks everyone. Data-c(1131, 1132, 1731 ,1732 ,1821 ,1822, 2221 ,, 2241 ,2242,414342 ,414371 ,414372) substr(Data,1,nchar(Data)-1) LCOG1 wrote: Hello all, Frustrated and i know you can help I need to drop the last numeral of each of

Re: [R] some help regarding combining columns from different files

2010-01-12 Thread Harikrishnadhar
Hi Jim, I am want to merge two files into one file : Here is my code . But the problem with this is that I am getting the 2nd file appended to the first when i write temp3 in my code to the text file. I am not sure what mistake I am doing . also find the test files to run the code . Please

[R] Strange behavior when trying to piggyback off of fitdistr

2010-01-12 Thread Adler, Avraham
Hello. I am not certain even how to search the archives for this particular question, so if there is an obvious answer, please smack me with a large halibut and send me to the URLs. I have been experimenting with fitting curves by using both maximum likelihood and maximum spacing estimation

Re: [R] trouble with installing SJava

2010-01-12 Thread Martin Morgan
Jiiindo wrote: Colleagues, How i can solve this error when i install SJava package A more recent version of SJava is available with source('http://bioconductor.org/biocLite.R') biocLite('SJava') rJava is an alternative. Martin Thanks R CMD INSTALL -c

Re: [R] expand.grid game --- never mind, I figured it out!

2010-01-12 Thread Rolf Turner
I re-read the solution that you posted and realized where my thinking was going wrong. Sorry (again!) for being a thicko. cheers, Rolf Turner On 13/01/2010, at 9:19 AM, Greg Snow wrote: How trivial is probably subjective, I don't think it is much above trivial. I

[R] parsing protocol of states

2010-01-12 Thread Andreas Wittmann
Dear R-users, actually i try to parse some state protocols for my work. i an easy stetting the code below works fine, if states are reached only once. in harder settings it could be possible that one state gets visited more times. in this case for me its interesting to see how much waiting

Re: [R] R for windows 64 bit

2010-01-12 Thread Uwe Ligges
On 12.01.2010 21:07, Alexander Shenkin wrote: Hi Alessia, Note that, while your physical limit might be 6 GB, Windows memory management allows more memory than that to be allocated (aka Virtual Memory, or at least that's what they called it in XP). Windows swaps out memory from RAM to the hard

[R] Problems connecting with MySQL using odbcDriverConnect (RODBC package) on Linux

2010-01-12 Thread Marcus, Jeffrey
I am sure I'm doing something wrong here but not sure what. Our system administrator recently installed UnixODBC and the MyODBC driver on a Linux box running Linux version 2.6 x86_64. I have an .odbc.ini file in my home directory with following lines: [mydb] Description = MySQL server on

Re: [R] Forming Portfolios for Fama / French Regression

2010-01-12 Thread jude.ryan
Kai, Your question is best addressed to r-sig-fina...@stat.math.ethz.ch as it is finance related question. Jude ___ Jude Ryan Director, Client Analytical Services Strategy Business Development UBS Financial Services Inc. 1200 Harbor Boulevard,

  1   2   >