[R] Saving Lattice Plots with RInside and Rcpp

2014-06-23 Thread Manoj G
Hi, I am trying to build an R application in C++ using RInside. I wanted to save the plots as images in specified directory using codes, png(filename = "filename", width = 600, height = 400) xyplot(data ~ year | segment, data = dataset, layout = c(1,3), type = c("l", "p"), ylab = "Y Label"

[R] help plsr function

2014-06-23 Thread annie Zhang
Hi All, I want to produce scores from X using $projection. When I predict, I cannot match the predicted scores and scores using x%*%projection. Below is a very simple example, set.seed(seed=1) y <- c(1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0) x <- matrix(runif(200),nrow=20) data

Re: [R] Custom sampling method in R XXXX

2014-06-23 Thread Daniel Nordlund
Something like this could work x <- 0.250 new_sample <- function(xx) { j<-c(0.000,0.125,0.250,0.375,0.500,0.625,0.750,0.875,1.000) probs<-c(0.02307692,0.20769231,0.53846154,0.20769231,0.02307692) jj <- c(0,0,j,1,1) ndx <- which(j == xx) sample(jj[ndx:(ndx+4)], size=1, p=probs, replace=T

Re: [R] Delaunay Graph, once again

2014-06-23 Thread Rolf Turner
On 24/06/14 06:24, Raphael Päbst wrote: I have the same suspicion, unfortunately I am no Matlab-User either and only have a adjacency-matrix created by the corresponding matlab functions to compare with my own output. So, even though I don't see any use for collinear triples either, is there a

Re: [R] Using RPostgreSQL

2014-06-23 Thread Anirudh Kondaveeti
Just to add to the previous message: ad_data_new table has less than 10 columns. Anirudh Kondaveeti Senior Data Scientist Pivotal (EMC) On Mon, Jun 23, 2014 at 4:15 PM, Anirudh Kondaveeti < anirudh.kondave...@gmail.com> wrote: > Hi All,

[R] Using RPostgreSQL

2014-06-23 Thread Anirudh Kondaveeti
Hi All, I am using RPostgreSQL to pull data from Greenplum database. I have successfully connected to the database and am using the following command to retrieve the first 100 records from a table by the name "ad_data_new" s <- dbSendQuery(con, "select * from ad_data_new limit 100") This is taki

Re: [R] Custom sampling method in R XXXX

2014-06-23 Thread Dan Abner
Hi Greg, Thanks, this makes sense. I can envision the call to the sample fn like you are discribing. Any ideas on how to construct the vector? I still am unclear about that. Thanks, Dan On Mon, Jun 23, 2014 at 5:26 PM, Greg Snow <538...@gmail.com> wrote: > The sample function can be used to sam

[R] c() with POSIXlt objects and their timezone is lost

2014-06-23 Thread Marc Girondot
When two POSIXlt objects are combine with c(), they lost their tzone attribute, even if they are the same. I don't know if it is a feature, but I don't like it ! Marc > es <- strptime("2010-02-03 10:20:30", format="%Y-%m-%d %H:%M:%S", tz="UTC") > es [1] "2010-02-03 10:20:30 UTC" > attributes(

Re: [R] sparse factor and findAssocs

2014-06-23 Thread Sarah Goslee
Hi, On Mon, Jun 23, 2014 at 9:11 AM, ashwin ittoo wrote: > Hello > I have been using R for some text pre-processing. I have 2 qestions > concerning the tm package/ > 1) the function removeSparseTerms takes as parameters a matrix and a > sparsefactor. Can anyone please tell me how is the sparsefa

Re: [R] Custom sampling method in R XXXX

2014-06-23 Thread Greg Snow
The sample function can be used to sample discrete values with designated probabilities. I would just construct your list of 5 values based on the selected value (duplicating end values if needed, so a choice of x=0 would be the vector c(0,0,0, 0.125, 0.25) ), then sample from this vector with the

[R] Custom sampling method in R XXXX

2014-06-23 Thread Dan Abner
Hi all, I have the following situation and a good efficient way to perform this operation in R has not come to me. Any suggestions/input are welcome. I have a user-defined parameter (let's call it x) whose value is selected from a set of possible values (j). Once the user selects one of the valu

[R] Problem with "nlm" function to minimize the negative log likelihood

2014-06-23 Thread Ferra Xu
Hi all  I have a problem in using "nlm" function to minimize the negative log likelihood of a function in R. The problem is that it gives me the same estimated values for all the parameters, except one of them, in each iteration!! Does anyone have any ideas what may cause this mistake?  Thank y

[R] sparse factor and findAssocs

2014-06-23 Thread ashwin ittoo
Hello I have been using R for some text pre-processing. I have 2 qestions concerning the tm package/ 1) the function removeSparseTerms takes as parameters a matrix and a sparsefactor. Can anyone please tell me how is the sparsefactor calculated? I have tried playing around with different values an

[R] Dead link in the help page of as.Date()

2014-06-23 Thread Christofer Bogaso
Hi, I was reading the help page for as.Date() function for some reason, and noticed a Matlab link: http://www.mathworks.com/help/techdoc/matlab_prog/bspgcx2-1.html It looks like this link is dead. So may be it would be better to put a correct link or remove this altogether. Thanks and regards,

Re: [R] Reading CSV file every time when R starts

2014-06-23 Thread MacQueen, Don
However, be careful, because .Rprofile runs before any saved .RData file is loaded. If the object you created in .Rprofile is later saved when you quit R, then the next time you start R, the saved version will replace the version created in .Rprofile. (Unless you start R using R --no-restore) This

Re: [R] Delaunay Graph, once again

2014-06-23 Thread Raphael Päbst
I have the same suspicion, unfortunately I am no Matlab-User either and only have a adjacency-matrix created by the corresponding matlab functions to compare with my own output. So, even though I don't see any use for collinear triples either, is there a way to get them with deldir as well? All th

Re: [R] Reading CSV file every time when R starts

2014-06-23 Thread Christofer Bogaso
Hi Greg, Thanks for your prompt reply. I have added 'library(utils)' in my Rprofile file and now it is working fine. Thanks and regards, On Mon, Jun 23, 2014 at 11:34 PM, Greg Snow <538...@gmail.com> wrote: > The .Rprofile file is processed before all the standard packages are > loaded, that is

Re: [R] Reading CSV file every time when R starts

2014-06-23 Thread Greg Snow
The .Rprofile file is processed before all the standard packages are loaded, that is why you are seeing the error. If you instead run the command as utils::read.csv or use library or require to manually load the utils package before calling read.csv then everything should work for you. On Mon, Ju

[R] Reading CSV file every time when R starts

2014-06-23 Thread Christofer Bogaso
Hi again, I am trying to build a procedure such that whenever R starts, it will read some CSV file. Therefore I put a code sometime like 'read.csv(...)' in my Rprofile file. However if I put this function there then I am getting an error saying 'Error: could not find function "read.csv"', wheneve

Re: [R] Help partimat()

2014-06-23 Thread daniel_stahl
I am a bit late for this discussion but hope that I might still get an answer. I tried to follow your advice and had a look at "drawparti" but could not find the relevant section about how to plot specific pairs of variables I am trying to plot only a few combinations a few several combinatio

Re: [R] lattice : superpose symbols with a great many points

2014-06-23 Thread Laurent Rhelp
Le 23/06/2014 01:03, Dennis Murphy a écrit : Hi: There are times when lattice is easier than ggplot2 and times when the converse is true. This is a case where ggplot2 is easier to code once you understand what it is doing. I'm going to try to reproduce your lattice graph in ggplot2 as follows:

Re: [R] Cox regression model for matched data with replacement

2014-06-23 Thread Therneau, Terry M., Ph.D.
On 06/23/2014 05:00 AM, r-help-requ...@r-project.org wrote: My problem was how to build a Cox model for the matched data (1:n) with replacement. Usually, we can use stratified Cox regression model when the data were matched without replacement. However, if the data were matched with replacement

Re: [R] Fwd; Trellis devices and pointize

2014-06-23 Thread Patrick Connolly
Thanks Deepayan, I'd never have figured that out for myself. On Sat, 21-Jun-2014 at 08:47PM +0530, Deepayan Sarkar wrote: |> On Sat, Jun 21, 2014 at 1:00 PM, Patrick Connolly |> wrote: |> > Hello Deepayan, |> > |> > The question below I asked on the Rhelp list. For the first time in |> > my e

Re: [R] fortran package crashes

2014-06-23 Thread Prof Brian Ripley
On 23/06/2014 10:06, Karl May wrote: Hi all, I have written a small Fortran routine to be attached to R for private use, that is reading matrices written to binary files by a Fortran program (I could not get "readBin" to read it). Unfortunately, when using the package R crashes every now and the

[R] fortran package crashes

2014-06-23 Thread Karl May
Hi all, I have written a small Fortran routine to be attached to R for private use, that is reading matrices written to binary files by a Fortran program (I could not get "readBin" to read it). Unfortunately, when using the package R crashes every now and then, but not always, with a segmentati