[R] Matching pairs of values

2010-03-27 Thread David Scott
I am sure someone can come up with a clever way of doing what I want---I don't seem to be able to. I want to check if a pair of numbers occurs as one of the rows of an n by 2 matrix. If I was only checking whether a single number was in a vector of numbers I would use %in% but I can't see how

Re: [R] RODBC : reading binary data from a TXT field belonging to a PostgeSQL table

2010-03-27 Thread Laurent Rhelp
Le 25/03/2010 20:28, Laurent Rhelp a écrit : Dear R-List, I am working with binary data that I want to store in a PostgreSQL DataBase. I decided to use a TXT field. I read my binary file with readBin function, I succeed in my data storage in the database but I have some trouble to extract

Re: [R] Matching pairs of values

2010-03-27 Thread Berend Hasselman
David Scott-6 wrote: I am sure someone can come up with a clever way of doing what I want---I don't seem to be able to. I want to check if a pair of numbers occurs as one of the rows of an n by 2 matrix. If I was only checking whether a single number was in a vector of numbers I

Re: [R] Multilevel modeling with count variables

2010-03-27 Thread Emmanuel Charpentier
Your request might find better answers on the R-SIG-mixed-models list ... Anyway, some quick thoughts : Le vendredi 26 mars 2010 à 15:20 -0800, dadrivr a écrit : By the way, my concern with lmer and glmer is that they don't produce p-values, The argumentation of D. Bates is convincing ... A

[R] Trouble loading package

2010-03-27 Thread Glenn E Stauffer
I am trying to load a package called Rmark, but when I run library(Rmark) I get the following: library(RMark) Error in !character.only : invalid argument type Error in library(RMark) : .First.lib failed for 'RMark' When I try to load Rmark from the packages menu, I get: local({pkg -

[R] a vectorized solution to some simple dataframe math?

2010-03-27 Thread Dgnn
I have a data frame containing the results of time measurements taken from several cells. Each cell was measured in conditions A and B, and there are an arbitrary number of measurements in each condition. I am trying to calculate the difference of each measurement from the mean of a given cell in

[R] Odd results with %% and conserving memory

2010-03-27 Thread JustinNabble
Can anyone explain this? I have a matrix with double components. It's taking up a lot of memory, so I want to multiply then turn it to integers. I'm pretty certain that there are only 2 decimal places, but I wanted to check by using modulo. E.g. mat = matrix(11:50/100, ncol=4,nrow=10) #Matrix

Re: [R] Competing with SPSS and SAS: improving code that loops through rows (data manipulation)

2010-03-27 Thread Jim Price
Here's my first stab. It removes some of the typical redundencies in your code (loops, building data frames by adding one column at a time) and instead does what is probably more canonical R style (although I'm willing to be corrected, as I suspect my code is a little suspect at times). For

Re: [R] R loop help

2010-03-27 Thread Patrick Burns
An aside to the main question: I don't think that i+1:3 is doing what you think it is. On 26/03/2010 23:01, casperyc wrote: Hi, I am tring to write a loop to compute this, == x1=c( rep(-1,4), rep(1,4) ) x2=c( rep(c(-1,-1,1,1),2)

[R] select n rows

2010-03-27 Thread leobon
Hello everyone, I have a matrix with 8000 rows. If I want to select every 8 rows, (i.e. row1, row2, ..., row8), what should I do? Appriciate for any hints! Thanks a lot! Leo -- View this message in context: http://n4.nabble.com/select-n-rows-tp1693136p1693136.html Sent from the R help mailing

[R] large dataset

2010-03-27 Thread n.via...@libero.it
Hi I have a question, as im not able to import a csv file which contains a big dataset(100.000 records) someone knows how many records R can handle without giving problems? What im facing when i try to import the file is that R generates more than 100.000 records and is very slow... thanks a

Re: [R] select n rows

2010-03-27 Thread Patrick Burns
Your question is ambiguous -- at least to me. The posting guide: http://www.r-project.org/posting-guide.html suggests that examples can be helpful to explain what you want. From the main statement I think the answer might be: mymatrix[seq(1, nrow(mymatrix), by=8), ] From the 'i.e.' clause

Re: [R] Odd results with %% and conserving memory

2010-03-27 Thread Patrick Burns
You seem to be in Circle 1 of 'The R Inferno'. Your technique does work, just not the way that you expect. Try doing: range( (mat * 100) %% 1) The 'zapsmall' function might be of interest as well. On 26/03/2010 21:05, JustinNabble wrote: Can anyone explain this? I have a matrix with

[R] [R-pkgs] micEcon split into micEconSNQP, micEconCES, and micEcon

2010-03-27 Thread Arne Henningsen
In December, the packages miscTools and micEconAids were separated from the micEcon package. Now, two further packages have been separated from the micEcon package: micEconSNQP and micEconCES. The micEconSNQP package (version 0.6-2) provides tools for production analysis with the Symmetric

[R] producing a QQ plot.

2010-03-27 Thread Philip Wong
Hello everyone I'm a beginner in Stats and R, I'm using R 2.10.1. I need to create a multivariate qq plot, there is 8 variable group with each has 55 number of input. An example of what I did so far, just to get my point out: data=read.csv(file.choose(),header=T) data country

Re: [R] large dataset

2010-03-27 Thread Orvalho Augusto
I do not know what is the limit for R. But on your problem you may try this: - Install MySQL server (download somewhere on www.mysql.com) - From inside MySQL you may import that CSV into a MySQL table - Then using RMySQL or ROBDC you will choose the Fields to use and import them to R. Good luck

Re: [R] producing a QQ plot.

2010-03-27 Thread Joshua Wiley
Dear Philip, It is difficult to tell what is wrong without a reproducible example. It would be very helpful if you would provide sample data. That said, the most obvious issue from what you have provided is that some of your data is character. mean() and var() will not work with character data.

Re: [R] producing a QQ plot.

2010-03-27 Thread Philip Wong
Hello, this is the first 10 data of the population. country village group av_expenP2ary_edno_fisher B_Leth B_LutjanWt_Leth Wt_Lutjan Cook IslandsAitutakiD 5239.127472 0.7 666.9998558 3.286283997 1.971519001 520.6454552

Re: [R] producing a QQ plot.

2010-03-27 Thread Stefan Grosse
Am 27.03.2010 10:45, schrieb Philip Wong: mah=mahalanobis(data,apply(data,2,mean),var(data)) mah=mahalanobis(data,apply(data,2,mean),var(no_fisher)) qqplot(qchisq(ppoints(data),ncol(data),data) As Joshua already pointed out: you are trying mathematical functions on names.

Re: [R] large dataset

2010-03-27 Thread Stefan Grosse
Am 27.03.2010 10:19, schrieb n.via...@libero.it: What im facing when i try to import the file is that R generates more than 100.000 records and is very slow... thanks a lot!!! Maybe your physical memory is too limited. R uses this and if your data are to large Linux and windows start to

Re: [R] producing a QQ plot.

2010-03-27 Thread Philip Wong
Aha! I see now! thanks guys! really helpful! -- View this message in context: http://n4.nabble.com/producing-a-QQ-plot-tp1693228p1693259.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] obtaining the index

2010-03-27 Thread arindam fadikar
I have a vector with entries 0 and 1. I want the positions for which the entries are 1. - arindam fadikar [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] producing a QQ plot.

2010-03-27 Thread Joshua Wiley
It is a bit of a side note really, but a convenient way to provide data (particularly when it is complex) is via dput(). Not only is this easier to read in, it preserves classes and other handy info. For instance, once I had played around to get Cook and Islands into one column (since there was a

Re: [R] a vectorized solution to some simple dataframe math?

2010-03-27 Thread Dennis Murphy
Hi: Does this do what you want? # Create some fake data... df - data.frame(id = factor(rep(c('cell1', 'cell2'), each = 10)), cond = factor(rep(rep(c('A', 'B'), each = 5), 2)), time = round(rnorm(20, 350, 10), 2)) # Create a function to subtract each element

[R] R runs in a usual way, but simulations are not performed

2010-03-27 Thread Nomen Omen
Dear addresses, I need perform a batch of 10 000 simulations for each of 4 options considered. (The idea is to obtain the parameter estimates in a heteroskedastic linear regression model - with additive or mixed heteroskedasticity - via the Kenward-Roger small-sample adjusted covariance matrix of

[R] Simulation of VAR

2010-03-27 Thread Ron_M
Dear all, is there any package/function available which simulates a co-integrating VAR model once the model parameters are input over some arbitrary horizon? Please let me know anyone aware of that. Thanks -- View this message in context:

[R] insert/copy skipped lines to output

2010-03-27 Thread Muhammad Rahiz
Hello all, I'd like some advise on this. When I read my files, I pass the argument, skip=6, to skip 6 lines of header information. After performing the desired calculations, I have the output. Now I want to copy the 6 lines of skipped information to the output. What I've been doing so far

Re: [R] Competing with SPSS and SAS: improving code that loops through rows (data manipulation)

2010-03-27 Thread Dimitri Liakhovitski
Dear all, thank you so much for your advice, and special thanks to you, Jim, for digging into my code (which was too long). I'll dig into yours now - it definitely looks very fast - and it's a lot of great learning for me. Because you can see - I am just a rudimentary programmer. Thank you

Re: [R] Error in library(gplots) : there is no package called 'gplots'

2010-03-27 Thread Andrew Dolman
OK, can't help you then sorry. Sometimes folk are confused between install and attach when they're complete beginners so it's worth checking. You're obviously not. andydol...@gmail.com On 25 March 2010 10:40, Martin Valere valere.mar...@vogelwarte.ch wrote: Dear Andrew, thanks for our

Re: [R] obtaining the index

2010-03-27 Thread David Winsemius
On Mar 27, 2010, at 6:35 AM, arindam fadikar wrote: I have a vector with entries 0 and 1. I want the positions for which the entries are 1. ?which - arindam fadikar [[alternative HTML version deleted]] __ R-help@r-project.org

Re: [R] large dataset

2010-03-27 Thread Jay Emerson
A little more information would help, such as the number of columns? I imagine it must be large, because 100,000 rows isn't overwhelming. Second, does the read.csv() fail, or does it work but only after a long time? And third, how much RAM do you have available? R Core provides some guidelines

Re: [R] large dataset

2010-03-27 Thread Gabor Grothendieck
Try using read.csv.sql in sqldfSee example 13 on the sqldf home page: http://code.google.com/p/sqldf/#Example_13._read.csv.sql_and_read.csv2.sql Also read ?read.csv.sql On Sat, Mar 27, 2010 at 5:19 AM, n.via...@libero.it n.via...@libero.it wrote: Hi I have a question, as im not able to

Re: [R] More efficient alternative to combn()?

2010-03-27 Thread Søren Højsgaard
Perhaps slightly off topic but there is a faster alternative to combn() called combnPrim() in the gRbase package: library(gRbase) system.time({for (ii in 1:1) combn(1:6,3)}) user system elapsed 4.020.004.02 system.time({for (ii in 1:1) combnPrim(1:6,3)}) user

Re: [R] producing a QQ plot.

2010-03-27 Thread David Winsemius
On Mar 27, 2010, at 6:45 AM, Joshua Wiley wrote: It is a bit of a side note really, but a convenient way to provide data (particularly when it is complex) is via dput(). Not only is this easier to read in, it preserves classes and other handy info. For instance, once I had played around to

Re: [R] Matching pairs of values

2010-03-27 Thread Peter Ehlers
On 2010-03-27 2:46, Berend Hasselman wrote: David Scott-6 wrote: I am sure someone can come up with a clever way of doing what I want---I don't seem to be able to. I want to check if a pair of numbers occurs as one of the rows of an n by 2 matrix. If I was only checking whether a single

Re: [R] Matching pairs of values

2010-03-27 Thread Peter Ehlers
(Sorry, I think that I just hit a wrong button and managed to send a non-reply.) I think that David might have meant that the column order of the numbers in lookfor is unimportant. In that case, a simple fix would be either to check both lookfor and rev(lookfor) (since the matrix is nX2) or to

Re: [R] a vectorized solution to some simple dataframe math?

2010-03-27 Thread David Winsemius
On Mar 27, 2010, at 6:53 AM, Dennis Murphy wrote: Hi: Does this do what you want? # Create some fake data... df - data.frame(id = factor(rep(c('cell1', 'cell2'), each = 10)), cond = factor(rep(rep(c('A', 'B'), each = 5), 2)), time = round(rnorm(20, 350,

[R] anova table for glm with p values

2010-03-27 Thread arindam fadikar
I have to obtain an ANOVA table with suitable p-values for an glm of binomial model with probit link function. I can fit the model but how can i get the anova table with suitable p values? Ref: example in help(esoph) -arindam fadikar [[alternative HTML version deleted]]

Re: [R] question regarding conversion from factor to vector

2010-03-27 Thread David Winsemius
On Mar 26, 2010, at 12:37 PM, Oliver Kullmann wrote: Hello, let me show you the following part of a session: table(E$singles) 0 1 2 3 4 5 6 7 8 14 15 461752 5487 93224379658 1099 4053 2 1868 1 21

Re: [R] Matching pairs of values

2010-03-27 Thread Berend Hasselman
Peter Ehlers wrote: I think that David might have meant that the column order of the numbers in lookfor is unimportant. In that case, a simple fix would be either to check both lookfor and rev(lookfor) (since the matrix is nX2) or to sort before testing: vtest - function(x, lookfor){

[R] Error lm.fit(...) - pairs cointegrated trading

2010-03-27 Thread petital
Hello guys, I'm trying to do a pairs trading cointegration analysis on two stocks (AXAP and AXANY), but I get an error that I don't understand... Here's my code: setwd(S:/Users/Alexis/Desktop/Essai) #chemin du dossier contenant les données donnees - read.csv(Data_R.csv, head=T, sep=;,

[R] Calling R from c in Windows XP

2010-03-27 Thread dkStevens
I'm searching for answers to four questions (I've been searching the net for hours...) In Windows XP, is it possible to call R functions from a c program? (I've found examples for Linux/Unix but not Windows) If so, is there a simple example to get started using gcc with R-2.10.0? If so, is it

Re: [R] Calling R from c in Windows XP

2010-03-27 Thread Khanh Nguyen
Have you looked at RInside ? -k On Sat, Mar 27, 2010 at 10:53 AM, dkStevens david.stev...@usu.edu wrote: I'm searching for answers to four questions (I've been searching the net for hours...) In Windows XP, is it possible to call R functions from a c program? (I've found examples for

Re: [R] large dataset

2010-03-27 Thread Khanh Nguyen
This was *very* useful for me when I dealt with a 1.5Gb text file http://www.csc.fi/sivut/atcsc/arkisto/atcsc3_2007/ohjelmistot_html/R_and_large_data/ On Sat, Mar 27, 2010 at 5:19 AM, n.via...@libero.it n.via...@libero.it wrote: Hi I have a question, as im not able to import a csv file which

Re: [R] Discrete values in levelplot?

2010-03-27 Thread David Winsemius
On Mar 26, 2010, at 11:08 AM, Filipe Cadete wrote: Dear all, I am trying represent a matrix of discrete values. At the moment I am using levelplot from the lattice package, but it seems to only work with numerical values. Is there an option in levelplot that will allow me to assign a

Re: [R] Calling R from c in Windows XP

2010-03-27 Thread Erich Neuwirth
If you want to call R from within VB.NET you might want to look at the statconnDCOM server (available at rcom.univie.ac.at) It wraps R into a (D)COM server and therefore allows any (D)COM client to access R on windows. VB.NET is a (D)COM client. On 3/27/2010 3:53 PM, dkStevens wrote: I'm

Re: [R] anova table for glm with p values

2010-03-27 Thread David Winsemius
On Mar 27, 2010, at 10:29 AM, arindam fadikar wrote: I have to obtain an ANOVA table with suitable p-values for an glm of binomial model with probit link function. I can fit the model but how can i get the anova table with suitable p values? The manner in which this request is posed

Re: [R] Multilevel modeling with count variables

2010-03-27 Thread dadrivr
Thanks everyone for the helpful ideas. It appears that this will be more difficult than I thought. I don't necessary have an inclination toward p-values, but many journals certainly do. I would be willing to try to calculate the confidence intervals around the estimates, but I haven't gotten

Re: [R] Calling R from c in Windows XP

2010-03-27 Thread dkStevens
I've looked at this a bit and it seems ok, if not a little convoluted. We're trying to stay away from com objects, so I was hoping for something more direct. I've seen some examples (e.g. RInside) but can't get them to work -too many include files, etc. that I can't find. -- View this message in

Re: [R] Calling R from c in Windows XP

2010-03-27 Thread dkStevens
I have - but when I tried their simple example no luck - too many missing include files to chase down. I'm looking for something more direct, I guess, that I have a little control over. -- View this message in context: http://n4.nabble.com/Calling-R-from-c-in-Windows-XP-tp1693440p1693478.html

[R] replace id by running number

2010-03-27 Thread sun
Dear all, I want to replace an (unsorted) id variable in a large dataset by a running number without changing the order of the cases. E.g., y - c(4,4,4,2,45,12,12) should be replaced by something like x - c(1,1,1,2,3,4,4) Sorry for this simple question thank you very much for your help!

Re: [R] Competing with SPSS and SAS: improving code that loops throughrows (data manipulation)

2010-03-27 Thread Martin Morgan
On 03/26/2010 06:40 PM, Dimitri Liakhovitski wrote: My sincere apologies if it looked large. Let me try again with less code. It's hard to do less than that. In fact - there is nothing in this code but 1 formula and many loops, which is the problem I am not sure how to solve. I also tried to

[R] data fitting and confidence band

2010-03-27 Thread Giovanni Azua Garcia
Hello, I am fitting data using different methods e.g. Local Polynomial and Smoothing splines. The data is generated out of a true function model with added normally distributed noise. I would like to know how often the confidence band for all points simultaneously contain all true values. I

Re: [R] Calling R from c in Windows XP

2010-03-27 Thread Khanh Nguyen
What examples are you talking about. You only need to include RInside.h... More information is here http://dirk.eddelbuettel.com/code/rinside.html The other external thing you need is the Rcpp package, which you can do with install.packages('Rcpp') On Sat, Mar 27, 2010 at 11:40 AM, dkStevens

Re: [R] replace id by running number

2010-03-27 Thread Phil Spector
The rle (run length encoding) function is ideal for problems like this: y - c(4,4,4,2,45,12,12) rr = rle(y) rep(seq(along=rr$values),rr$lengths) [1] 1 1 1 2 3 4 4 - Phil Spector Statistical Computing Facility

Re: [R] replace id by running number

2010-03-27 Thread Henrique Dallazuanna
Try this: as.numeric(factor(y, levels = unique(y))) On Sat, Mar 27, 2010 at 12:42 PM, sun sun.sonn...@googlemail.com wrote: Dear all, I want to replace an (unsorted) id variable in a large dataset by a running number without changing the order of the cases. E.g., y - c(4,4,4,2,45,12,12)

Re: [R] Error in library(gplots) : there is no package called 'gplots'

2010-03-27 Thread Tal Galili
Hi Martin, The same happened to me a while ago, I changed the mirror to another country and it worked for me. Hope it will for you too. Best, Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me:

Re: [R] replace id by running number

2010-03-27 Thread Dimitris Rizopoulos
try this: y - c(4,4,4,2,45,12,12) match(y, unique(y)) I hope it helps. Best, Dimitris On 3/27/2010 4:42 PM, sun wrote: Dear all, I want to replace an (unsorted) id variable in a large dataset by a running number without changing the order of the cases. E.g., y- c(4,4,4,2,45,12,12)

Re: [R] Calling R from c in Windows XP

2010-03-27 Thread dkStevens
This may simply expose my ignorance in this type of coding, but, unfortunately it's not that simple because I did using the RInside.h and received several screens of error messages from gcc telling me that it couldn't find the include file and the scores of additional include files that rinside.h

[R] Calculate variance/covariance with complex numbers

2010-03-27 Thread Gang Chen
Anybody knows what functions can be used to calculate variance/covariance with complex numbers? var and cov don't seem to work: a 1 V1 0.00810014+0.00169366i V2 0.00813054+0.00158251i V3 0.00805489+0.00163295i V4 0.00809141+0.00159533i V5 0.00813976+0.00161850i var(a)

Re: [R] replace id by running number

2010-03-27 Thread Gabor Grothendieck
Here is a comparison of the speed of the solutions so far plus one based on cumsum. It seems that cumsum was the fastest and is 26x faster than the slowest solution. The speed may not be so important here and readability might be key in which case a good compromise might be match which was still

Re: [R] Calling R from c in Windows XP

2010-03-27 Thread Dirk Eddelbuettel
On 27 March 2010 at 11:50, Khanh Nguyen wrote: | What examples are you talking about. You only need to include | RInside.h... More information is here | http://dirk.eddelbuettel.com/code/rinside.html Khanh is quite correct: RInside is self-contained. It also doesn't get much simpler than the

Re: [R] Competing with SPSS and SAS: improving code that loops through rows (data manipulation)

2010-03-27 Thread hadley wickham
# Set up the ratio variables system.time({ temp - cbind(data, do.call(cbind, lapply(names(data)[3:4], function(.x)        {                unlist(by(data, data$group, function(.y) .y[,.x] / max(.y[,.x])))        }))) colnames(temp)[5:6] - paste(colnames(data)[3:4], 'ind.to.max', sep =

Re: [R] Competing with SPSS and SAS: improving code that loops throughrows (data manipulation)

2010-03-27 Thread hadley wickham
 exp1^(a[case] * l * 10) would be better written out of the loop as  b - exp1^(a * l * 10) And even better as b - exp(a * l * 10) Hadley -- Assistant Professor / Dobelman Family Junior Chair Department of Statistics / Rice University http://had.co.nz/

Re: [R] Calling R from c in Windows XP

2010-03-27 Thread Dirk Eddelbuettel
On 27 March 2010 at 09:02, dkStevens wrote: | This may simply expose my ignorance in this type of coding, but, | unfortunately it's not that simple because I did using the RInside.h and | received several screens of error messages from gcc telling me that it | couldn't find the include file and

Re: [R] question regarding conversion from factor to vector

2010-03-27 Thread Oliver Kullmann
thank you! (I was on the wrong track, and thinking these would be levels.) Oliver In this case where the is only one dimension, the table object is more like a named vector. The first vector in your terminology (but would be more accurately called labels) can be accessed with: names(

Re: [R] Calling R from c in Windows XP

2010-03-27 Thread dkStevens
Thanks for your prompt response. Apparently my problem is with my R or Windows setup. When I followed the advice in your return email, here's the result. I've been an R user for a number of years and have installed/uninstalled several versions, plus I've installed MinGW, RTools, gcc/gfortran,

Re: [R] R runs in a usual way, but simulations are not performed

2010-03-27 Thread jim holtman
The script you sent seems to be too large for me to spend time debugging, plus it seems that there are files being read that are not part of the data. I would suggest that if you have a long running program that you put messages (cat('reached part 1\n')) throughout the program so you can trace

[R] emacs: reformat \items paragraph in .Rd

2010-03-27 Thread Hans-Peter Suter
(emacs newb here) After having made some changes in an \items paragraph of \arguments the lines are no longer nicely wrapped. I was looking for a command to reindent/rewrap/reformat the whole \items paragraph but couldn't find anything. The only way, I found, was to go to the end of the first

Re: [R] Odd results with %% and conserving memory

2010-03-27 Thread jim holtman
FAQ 7.31 Follow the link to what you should know about floating point numbers. On Fri, Mar 26, 2010 at 5:05 PM, JustinNabble justinmmcgr...@hotmail.comwrote: Can anyone explain this? I have a matrix with double components. It's taking up a lot of memory, so I want to multiply then turn it

Re: [R] Calling R from c in Windows XP

2010-03-27 Thread Dirk Eddelbuettel
David, On 27 March 2010 at 10:08, dkStevens wrote: | Thanks for your prompt response. Apparently my problem is with my R or | Windows setup. When I followed the advice in your return email, here's | the result. I will eat my hat. What you show I had too -- you need to define the environment

[R] string width calculation

2010-03-27 Thread Dennis Fisher
Colleagues, I am trying to create a PDF document in which I use margin text with two different fonts. The resulting text might be: XyZZZ where X and Z are one font and Y is the other. My plan was to do this in the following manner: mtext(X ZZZ, cex=2, adj=0.5,

Re: [R] Calling R from c in Windows XP

2010-03-27 Thread Martin Morgan
On 03/27/2010 07:53 AM, dkStevens wrote: I'm searching for answers to four questions (I've been searching the net for hours...) In Windows XP, is it possible to call R functions from a c program? (I've found examples for Linux/Unix but not Windows) If so, is there a simple example to

Re: [R] Create NA

2010-03-27 Thread Uwe Ligges
On 23.03.2010 04:27, stephen sefick wrote: I think you don't need to multiply... you need to figure out where your NAs need to be and then index the vector and assign NA to it: x[1:5]- NA ... which would coerce x to be character while x[1:5] - NA keeps the mode of x. Uwe Ligges

[R] can fda handle NA in y?

2010-03-27 Thread Dr. Emilio A. Laca
I have a matrix with 167 columns, each representing the y values of a functional. There are a few scattered NA's in each column. I have been unable to create a useful fd object with any of the functions in fda. The resulting coefficients are all NA. Is this a known limitation? Is there a

Re: [R] string width calculation

2010-03-27 Thread Henrique Dallazuanna
See ?strwidth On Sat, Mar 27, 2010 at 3:42 PM, Dennis Fisher fis...@plessthan.com wrote: Colleagues, I am trying to create a PDF document in which I use margin text with two different fonts.  The resulting text might be:        XyZZZ where X and Z are one font and Y is the other. My

[R] R Cmdr memory

2010-03-27 Thread ManInMoon
Hi, I keep getting this error in console. but I have 30G of RAM: Error: cannot allocate vector of size 154.3 Mb Is there some way to tell it I have more memory available? I am on Windows XP 64 bit -- View this message in context: http://n4.nabble.com/R-Cmdr-memory-tp1693483p1693483.html

[R] Running example in pkg-Ex.R failed

2010-03-27 Thread shruti
Hi ,My name is shruti,I'm new to R when i was checking my package i got a error message saying Running Example in pkg-Ex.R failed.can any one help me with this.I'm inserting command prompt reference for your reference. Thank you, http://n4.nabble.com/file/n1693503/running_ex.jpg -- View this

Re: [R] Running example in pkg-Ex.R failed

2010-03-27 Thread Khanh Nguyen
Basically, R is telling you that the source code of the package you are installing is troublesome.. It doesn't look like the codes is clean.. There are warnings. Perhaps, you can try with a different version of the package? -k On Sat, Mar 27, 2010 at 12:27 PM, shruti shruti.mu...@yahoo.com

Re: [R] R Cmdr memory

2010-03-27 Thread David Winsemius
On Mar 27, 2010, at 11:43 AM, ManInMoon wrote: Hi, I keep getting this error in console. but I have 30G of RAM: Error: cannot allocate vector of size 154.3 Mb Is there some way to tell it I have more memory available? I am on Windows XP 64 bit But you are probably using 32 bit R. You

[R] Problems faced with Levene Test using R

2010-03-27 Thread Philip Wong
Hello everyone, I'm trying to build Levene's test. The below command is what I used to do the test, I also included the error it prompts up and some data example that I used when trying to build the test. Can someone please tell me what did I do wrong? thanks in advance!

Re: [R] Competing with SPSS and SAS: improving code that loops throughrows (data manipulation)

2010-03-27 Thread Sharpie
hadley wickham wrote:  exp1^(a[case] * l * 10) would be better written out of the loop as  b - exp1^(a * l * 10) And even better as b - exp(a * l * 10) Hadley Aye, exp() functions tend to be heavily optimized compared to general functions such as `^` even if e is used as the

[R] Assigning factors probabilistically based on the value of another variable.

2010-03-27 Thread Economics Guy
I am revising a program that I wrote when I was very new at R (2007ish), and while I have been able to write very nice and fast code for almost all of it, there is one issue that I cannot seem to do it in less than 40 ugly and computationally expensive lines. I have a data frame that contains one

Re: [R] Calculate variance/covariance with complex numbers

2010-03-27 Thread Ben Bolker
Gang Chen gangchen6 at gmail.com writes: Anybody knows what functions can be used to calculate variance/covariance with complex numbers? var and cov don't seem to work: How about: y - complex(real=5:1,imag=2:6) z - complex(real=1:5,imag=6:10) complex.var - function(x) { mx - mean(x) n

Re: [R] Linear mixed models with custom link functions in R

2010-03-27 Thread Ben Bolker
Daniel Barton daniel.barton at umontana.edu writes: Hello All, I am looking for an R library/function that allows the specification of a custom link function in a linear mixed model. You might want to try on the r-sig-mixed-mod...@r-project.org list. I would probably call this a

Re: [R] Calculate variance/covariance with complex numbers

2010-03-27 Thread Charles C. Berry
On Sat, 27 Mar 2010, Gang Chen wrote: Anybody knows what functions can be used to calculate variance/covariance with complex numbers? var and cov don't seem to work: How about? xri - matrix(rnorm(1)+1i*rnorm(1),nc=2) crossprod(xri-colMeans(xri))/(nrow(xri)-1) HTH, Chuck a

Re: [R] how to make stacked plot?

2010-03-27 Thread Jim Lemon
On 03/27/2010 03:23 AM, sdzhangping wrote: Dear friends: I'm interested to make a stacked plot of cumulative incidence. that's, the cuminc model is fitted [fit=cuminc(time, relapse)] and cumulative incidence is in place. I'd like to stack the cuminc plots (relapse of luekemia and

Re: [R] Assigning factors probabilistically based on the value of another variable.

2010-03-27 Thread Charles C. Berry
On Sat, 27 Mar 2010, Economics Guy wrote: I am revising a program that I wrote when I was very new at R (2007ish), and while I have been able to write very nice and fast code for almost all of it, there is one issue that I cannot seem to do it in less than 40 ugly and computationally expensive

Re: [R] Matching pairs of values

2010-03-27 Thread David Scott
Many thanks Peter and Berend. I think I can make this work for my problem. Apologies for not giving an example: I was a bit tired and frustrated when I posted to R-help and only on later reflection realised that I didn't really follow the posting guidelines. David Peter Ehlers wrote:

Re: [R] emacs: reformat \items paragraph in .Rd

2010-03-27 Thread David Scott
Hans-Peter Suter wrote: (emacs newb here) After having made some changes in an \items paragraph of \arguments the lines are no longer nicely wrapped. I was looking for a command to reindent/rewrap/reformat the whole \items paragraph but couldn't find anything. The only way, I found, was to go

Re: [R] Calculate variance/covariance with complex numbers

2010-03-27 Thread Gang Chen
Thanks a lot for the help, Ben Bolker and Chuck! Chuck, it seems your version needs a little modification. Instead of this: xri - matrix(rnorm(1)+1i*rnorm(1),nc=2) crossprod(xri-colMeans(xri))/(nrow(xri)-1) it seems to me it should be this (maybe there is a more elegant modification