[R] Problem installing libxml2 under Homebrew

2018-02-16 Thread Peter Meilstrup
i am trying to install xml2 from CRAN, and it is throwing an error that it cannot find the libxml2 library configuration. The thing is that pkg-config seems to be set up correctly: $ echo $PKG_CONFIG_PATH :/usr/local/opt/libxml2/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig $ pkg-config --c

[R] indexing data.frame columns

2012-04-05 Thread Peter Meilstrup
Consider the data.frame: df <- data.frame(A = c(1,4,2,6,7,3,6), B= c(3,7,2,7,3,5,4), C = c(2,7,5,2,7,4,5), index = c("A","B","A","C","B","B","C")) I want to select the column specified in 'index' for every row of 'df', to get goal <- c(1, 7, 2, 2, 3, 5, 5) This sounds a lot like the indexing-by

Re: [R] SE from nleqslv

2012-03-20 Thread Peter Meilstrup
You haven't said how the function you're optimizing relates to your data. In the special case that you happen to be using nleqslv to maximize a log-likelihood function (a special case of which is least squares fitting), you can get an approximation to the standard error using the Jacobian matrix th

Re: [R] by output into data frame

2012-03-19 Thread Peter Meilstrup
Thanks for providing a reproducible example. Using the plyr package you can write your whole computation more compactly: library(plyr) library(caTools) #for trapz auc <- ddply(lab.samples, .(challenge, subid), function(df) { df$time <- c(0, seq(60,by=10, len=nrow(df)-1)) summari

Re: [R] Filling matrices

2012-03-19 Thread Peter Meilstrup
http://cran.r-project.org/doc/manuals/R-lang.html#Indexing-matrices-and-arrays matrix[cbind(iRows, iCols)] <- values Peter On Mon, Mar 19, 2012 at 2:07 PM, David Stevens wrote: > I'm a bit clumsy about many things in R. Here's my problem. I'm trying to > build a square sparse matrix and populat

Re: [R] Help with dlply, loop and column names

2012-03-19 Thread Peter Meilstrup
I'm not sure I follow exactly what group of regression models you want to create, but a good first step might be to use reshape so that each party's vote share goes on a different row and the vote shares are all in the same column. Then you can use plyr grouping on tipo and party to make your model

[R] tryCatch interferes with traceback(), debugger(), dump.frames()....

2012-03-16 Thread Peter Meilstrup
dump.frames() or retrace() or some equivalent points me to the right spot? Peter Meilstrup [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide ht

Re: [R] Filling out a data frame row by row.... slow!

2012-02-15 Thread Peter Meilstrup
On Tue, Feb 14, 2012 at 2:31 PM, William Dunlap wrote: > If you must repeatedly append rows to a data.frame, > try making the dataset you are filling in a bunch > of independent vectors, perhaps in a new environment > to keep things organized. One complication is I don't know the names of the c

[R] Filling out a data frame row by row.... slow!

2012-02-14 Thread Peter Meilstrup
I'm reading a file and using the file to populate a data frame. The way the file is laid out, I need to fill in the data frame one row at a time. When I start reading my file, I don't know how many rows I will need. It's on the order of a million. Being mindful of the time expense of reallocation

[R] Expanding rows of a data frame into multiple rows

2011-10-22 Thread Peter Meilstrup
The setup: I have a data frame where one column is in list mode, and each entry contains a vector of varying length. I want to expand this into a data frame with one row for each member of the list-mode column (the other values being replicated) For example, an example input and the desired output

Re: [R] pgfSweave-example not compiling

2011-10-13 Thread Peter Meilstrup
> up the issue to pgfSweave developers: > https://github.com/cameronbracken/pgfSweave/issues/34 > > Regards, > Yihui > -- > Yihui Xie > Phone: 515-294-2465 Web: http://yihui.name > Department of Statistics, Iowa State University > 2215 Snedecor Hall, Ames, IA > >

Re: [R] pgfSweave-example not compiling

2011-10-13 Thread Peter Meilstrup
t; Yihui Xie > Phone: 515-294-2465 Web: http://yihui.name > Department of Statistics, Iowa State University > 2215 Snedecor Hall, Ames, IA > > > > On Thu, Oct 13, 2011 at 7:01 PM, Peter Meilstrup > wrote: >> I'm trying to get pgfSweave up and running. Hopefull

[R] pgfSweave-example not compiling

2011-10-13 Thread Peter Meilstrup
I'm trying to get pgfSweave up and running. Hopefully I can get it working from within LyX, but first I'm just trying to get the simplest possible thing (compiling one of the example files in the pgfSweave package) to work. I'm using the example that comes in the pgfSweave package unmodified, but f

[R] Is it possible to detect whether running as Rscript?

2009-11-10 Thread Peter Meilstrup
I would like to write a block of code that runs when a script is being run from Rscript, but not to run if the same file is being source()d, or submitted via ESS, etc. As a gloss I would like to write a file that looks somewhat like: #!/usr/bin/env Rscript my.func <- function(...) {

Re: [R] abind, but on lists?

2009-09-02 Thread Peter Meilstrup
On Sep 2, 2009, at 8:47 PM, Richard M. Heiberger wrote: Almost certainly, abind is what you need for the task. Please dput() your matlab objects and send that to the list. That will make your example reproducible. Rich From the documentation and behavior, abind seems to really not want to

[R] abind, but on lists?

2009-09-02 Thread Peter Meilstrup
I'm trying to massage some data from Matlab into R. The matlab file has a "struct array" which when imported into R using the R.matlab package, becomes an R list with 3+ dimensions, the first of which corresponds to the structure fields, with corresponding row names, and the second and thi

[R] Where to put source code?

2009-08-21 Thread Peter Meilstrup
I'm trying to move from Matlab to R, and I'm stuck even getting started. This sounds to me like the dumbest question in the world but... how does one put R source code in files? Over the last three days I've gone front to back through the Introduction to R and the R Language Definition, and while I