[R] easy way to fit saturated model in sem package?

2012-07-11 Thread Joshua Wiley
Hi, I am wondering if anyone knows of an easy way to fit a saturated model using the sem package on raw data? Say the data were: mtcars[, c("mpg", "hp", "wt")] The model would estimate the three means (intercepts) of c("mpg", "hp", "wt"). The variances of c("mpg", "hp", "wt"). The covariance

Re: [R] How to compare stacked histograms/datasets

2012-07-11 Thread Joshua Wiley
Hi, Sure, you could do a qqplot for each variable between two datasets. In a 2d graph, it will be hard to reasonably compare more than 2 datasets (you can put many such graphs on a single page, but it would be pairwise sets of comparisons, I think. Perhaps you could plots multiple qqplots on top

Re: [R] Computing inverse cdf (quantile function) from a KDE

2012-07-11 Thread David L Carlson
Something like this? library(KernSmooth) x <- rnorm(100) KS <- bkde(x) diff <- KS$x[2] - KS$x[1] yc <- cumsum(KS$y*diff) approx(yc, KS$x, runif(1000)) If you are going to use approx() repeatedly, you can create a function with approxfun(). - David L Carlson A

[R] How to call sas in R with SAS9.3

2012-07-11 Thread patrick feifei
Hi, I am trying to call a sas program (test.sas) in R, the directory for test.sas is testfolder. It will work very well in the sas9.2 platform with the following command system(paste('"C://Program Files/SAS/SASFoundation/9.2(32-bit)/sas.exe"', 'C:/testfolder/test.sas'), wait = TRUE) However, w

[R] plot only a same variable timing graph

2012-07-11 Thread imnew
hi all. for example : Table 1 variable: BERTH TIME A 9:52 D 7:43 C 8:33 A 10:13 I want to plot maybe only Berth 'A' timing. How can i do that? -- View this message in context: http://r.789695.n4.nabble.c

Re: [R] The following object(s) are masked from ‘package:stats’

2012-07-11 Thread David
Hi Charlie, Thanks for replying top my post, I really appreciate it. I understand whats going on now. Thank you once again David -- View this message in context: http://r.789695.n4.nabble.com/The-following-object-s-are-masked-from-package-stats-tp4636079p4636250.html Sent from the R help mail

Re: [R] Package 'MASS' (polr): Error in svd(X) : infinite or missing values in 'x'

2012-07-11 Thread Jeremy Little
Thanks Jessi, your insights are extremely helpful. If you would indulge me one more quick question on your script. You have written... newData<-data.frame(JVeg5=factor(Jdata[,"JVeg5"]),scale(Jdata[,c("Elevation","Lat_Y_pos","Coast_dist","Stream_dist")])) I wish to expand this analysis for all ot

Re: [R] how to create the data frame

2012-07-11 Thread arun
Hi, dat1<-read.table(text="     weekly.returns 2010-1-4    -0.015933327 2010-1-11    -0.015042868 2010-1-18    0.005350297 2010-1-25    -0.049324703 2010-2-1    -0.052674121 ",sep="",header=TRUE) str(dat1) 'data.frame':    5 obs. of  1 variable:  $ weekly.returns: num  -0.01

[R] identifying local maxima

2012-07-11 Thread Gary Dong
Dear R users, I have created a Loess surface in R, in which x is relative longitude by miles, y is relative latitude by miles, and z is population density at the neighborhood level. The purpose is to identify some population centers in the region. I'm wondering if there is a way to determine the c

Re: [R] Passing Multiple Variable Into SQLDF Statement as parameters of function

2012-07-11 Thread jim holtman
You have to explicitly add the quotes: Example=paste0("select * from LibDB where Date_Entered ='",as.character(StartDate), "'") # notice the single quotes within the double quotes > sqldf(Example,verbose=TRUE) On Wed, Jul 11, 2012 at 11:16 AM, scstrein wrote: > Hey guys, > > So I'm working with

Re: [R] Analyzing subsets

2012-07-11 Thread jim holtman
Take a look at the 'plyr' package; it probably does what you want. On Wed, Jul 11, 2012 at 7:53 PM, Charles Stangor wrote: > Say I want to perform transformations on row subsets of my dataframe. > > Do I have to break the dataframe into subsets, perform the analysis on each > subset, and rbind()

Re: [R] sapply question

2012-07-11 Thread jim holtman
Go back and reread the section about the scoping of variables and that functions do not have side effects; they only return values. You are changinga "local" copy of df1 within the function which is returning the changed values to df3. On Wed, Jul 11, 2012 at 7:36 PM, Charles Stangor wrote: > Wh

Re: [R] do I need plyr, apply or something else?

2012-07-11 Thread Mikhail Titov
"R. Michael Weylandt" writes: > On Wed, Jul 11, 2012 at 10:05 AM, Russell Bowdrey > wrote: >> >> Dear all, >> >> This is what I'd like to do (I have an implementation using for >> loops, which I designed before I realised just how slow R is at >> executing them - this process currently takes day

[R] Analyzing subsets

2012-07-11 Thread Charles Stangor
Say I want to perform transformations on row subsets of my dataframe. Do I have to break the dataframe into subsets, perform the analysis on each subset, and rbind() them together again? ..or is there another way. Thank you! [[alternative HTML version deleted]]

[R] sapply question

2012-07-11 Thread Charles Stangor
Why does this sapply code change df3 but not df1? Thanks df1 <- read.table(text=" cola colb colc cold cole 1NA59 NA 17 2NA6 NA 14 NA 3 3NA 11 15 19 4 48 12 NA 20 ", header=TRUE) df2 <-df1*2 df1 df2 df3 <-sapply(names(df1),function(x) {df

Re: [R] Help with loop

2012-07-11 Thread Charles Stangor
I think I just learned this myself: Don't put the $ extension in the bracket : df1$cola[is.na(df1$cola)]<- > > df2$cola > Instead substitute using brackets within the brackets: df1["cola"]is.na(df1["cola"])]<- > > df2["cola"] > then the "cola" s can be substituted. > Maybe this will help

Re: [R] unable to subtract dates in R

2012-07-11 Thread arun
Hi, It is a bit difficult to give suggestions when there are no example datasets. Have you checked whether both belong to "Date" class? You could use, difftime(intakeDS$DOB, intakeDS$IntakeDate_d,units="days") to get the difference between dates A.K. - Original Message - From: Willia

Re: [R] Variance Inflation factor

2012-07-11 Thread R. Michael Weylandt
Which Linux are you running? For distros with package managers, that's usually all you need. Also Check up on the R-SIG-Debian (including Ubuntu) or R-SIG-Fedora as appropriate if you need more help. Michael On Jul 11, 2012, at 6:26 PM, Hui Du wrote: > Thanks, all. I will upgrade my R in li

Re: [R] help with merging 2 data frames

2012-07-11 Thread Dimitri Liakhovitski
Thanks a lot, everyone for your helpful suggestions! Eloi, this is very elegant - thank you! I did not know 2 columns are allowed to have the same names! Always good to learn something new. Thanks again! Dimitri On Wed, Jul 11, 2012 at 6:58 PM, Mercier Eloi wrote: > This should do the trick : >

Re: [R] nls problem: singular gradient

2012-07-11 Thread Duncan Murdoch
On 12-07-11 2:34 PM, Jonas Stein wrote: Take a look at the predicted values at your starting fit: there's a discontinuity at 0.4, which sure makes it look as though overflow is occurring. I'd recommend expanding tanh() in terms of exponentials and rewrite the prediction in a way that won't over

Re: [R] HELP me please with import of csv to R

2012-07-11 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of William Dunlap > Sent: Wednesday, July 11, 2012 4:23 PM > To: F86; r-help@r-project.org > Subject: Re: [R] HELP me please with import of csv to R > > You or nabble left out my sug

Re: [R] unable to subtract dates in R

2012-07-11 Thread Rui Barradas
Hello, 1. Post a data example, dput(head(intakeDS, 20)) # post the output of this 2. You are subtracting IntakeDate from DOB, when it should be the other way around. Like this you get negative dates and those are illegal. If this point 2 doesn't solve it, follow step 1. Hope this helps, R

Re: [R] Variance Inflation factor

2012-07-11 Thread Hui Du
Thanks, all. I will upgrade my R in linux but I suspect the root cause is some set up problem although I don't know how to trace it yet. I am not that familiar with R in Linux. If somebody could give me a clue how to diagnose this kind of problem, that will be great. HXD -Original Message

Re: [R] HELP me please with import of csv to R

2012-07-11 Thread William Dunlap
You or nabble left out my suggestion to use dec="," in your call to read.table (or read.csv, etc.) Did you use read.table(filename, ..., dec=",") when importing the data (so "30,3" is read as the number 30 and 3 tenths instead of as the character string "30,3")? along with an example of wha

Re: [R] HELP me please with import of csv to R

2012-07-11 Thread F86
Hello William, - I used str() and got this 'data.frame': 290 obs. of 2 variables: $ Kommuner: Factor w/ 289 levels "Ale","Alingsas",..: 34 40 44 79 95 99 132 162 169 173 ... $ Skatt : Factor w/ 177 levels "28,89","28,9",..: 86 7 47 67 74 25 24 23 85 74 ... - and summary() - got this

Re: [R] help with merging 2 data frames

2012-07-11 Thread Rui Barradas
Hello, About many columns like 'e1' and 'e2' I don't know but with the provided example the following does NOT depend on them, only on 'a', 'b' and 'a2' and 'a3'. z <- lapply(c("a2", "a3"), function(cc) merge(x, y, by.x=c("a", "b"), by.y=c(cc, "b"))) z <- lapply(seq_along(z), function(i)

Re: [R] nls problem: singular gradient

2012-07-11 Thread Jonas Stein
> Take a look at the predicted values at your starting fit: there's a > discontinuity at 0.4, which sure makes it look as though overflow is > occurring. I'd recommend expanding tanh() in terms of exponentials and > rewrite the prediction in a way that won't overflow. > > Duncan Murdoch Hi Du

Re: [R] Variance Inflation factor

2012-07-11 Thread R. Michael Weylandt
You're rather out of date with your version of R -- if you want to use the CRAN binaries provided by install.packages(), you usually have to be at most one minor rev behind. Try install.packages("car", type = "source") But even better -- update to a poppin-fresh R 2.15.1: you get parallelization,

Re: [R] Help needed to tackle multicollinearity problem in count data with the help of R

2012-07-11 Thread John Fox
Dear Umesh Khatri, The vif() function in the car package will compute (generalized) variance inflation factors for GLMs. What (if anything) to do about collinearity isn't in my opinion an answerable question without knowing the details of your research. In particular, ridge regression is not a

[R] Survey package GLM vs. Linear Mixed Models?

2012-07-11 Thread RNewby
Hi there, I'm new to some of these more advanced regression techniques and also new to R. This looks like a great forum. I am trying to examine the association with membership in a group and some different variables, most of which are (approximately) normally distributed. Would just do an ANOVA

Re: [R] help with merging 2 data frames

2012-07-11 Thread Mercier Eloi
This should do the trick : colnames(y)[1:2]=c("a","a") y2=rbind(y[,-1], y[,-2]) #duplicating the "y" matrix so the identifiers are only in 1 column merged = merge(x,y2) merged a b d e1 e2 1 aa 1 10 100 101 2 aa 2 20 200 201 3 ab 1 30 100 101 4 ab 2 40 200 201 5 ba 1 50 300 301 6 ba 2 60

[R] unable to subtract dates in R

2012-07-11 Thread William Mabe
Hi, I wanted to calculate the age of people in my dataset by subtracting the individual's date of birth from their intake into a program. After several hours, searches of help archives, and the downloading of lubiridate, I have had no luck with this. Below is the code I used. > intakeDS$DOB <-

Re: [R] MODE , VARIANCE , NTH PERCENTAILE

2012-07-11 Thread arun
Hi, Just try: dat4<-read.table(text="  ABC PQR XYZ MNO    3  6  7  15    2  12  24  15    20  5  1  2   25  50  15  35  ",sep="",header=TRUE)  apply(dat4,2,quantile)    apply(dat4,2,var) #For mode calculation, use package ?modalvalue {rattle} A.K. , - Original Message - From: Ranton

Re: [R] Skipping lines and incomplete rows

2012-07-11 Thread arun
Hello, Try this: dat3<-read.table("dat3.txt",sep="",skip=3,header=TRUE,fill=TRUE)  dat4<-data.frame(variable1=paste(dat3[,1],dat3[,2],sep=" "),Variable2=dat3[,3],Variable3="",Variable4=dat3[,4])  dat4<-dat4[-1,] row.names(dat4)<-1:nrow(dat4) dat4   variable1 Variable2 Variable3 Variable4 1 11/

Re: [R] help with merging 2 data frames

2012-07-11 Thread Dimitri Liakhovitski
Jorge, thank you! that seems to be working, but unfortunately in real life I have thousands of variables (except for a, a2, a3 and b) so that manually selecting columns (as in c(2:4, 8:9)) would be too difficult... Dimitri On Wed, Jul 11, 2012 at 6:36 PM, Jorge I Velez wrote: > Hi Dimitri, > > Tr

Re: [R] Mixed Models providing a correlation structure.

2012-07-11 Thread Kevin Wright
Why did you use the 'lower.tri' syntax? Does this work for you? lme(Y~Random, data = DATA, random = list(Random = pdSymm(CovM,~Random))) Kevin On Wed, Jul 11, 2012 at 9:27 AM, Marcio wrote: > Dear Simon, > Thanks for the quick reply. > Unfortunately I don't have access to Pinheiro and Bates. I

Re: [R] Variance Inflation factor

2012-07-11 Thread Richard M. Heiberger
Hui Du, There is probably something wrong with either your setup or your choice of CRAN mirror. Both HH and car are present in CRAN for all platforms. ---Your session info just arrived. "R version 2.11.1 (2010-05-31)" is over two years old. The current version is "R version 2.15.1 (2012-06-22)".

Re: [R] fill 0-row data.frame with 1 line of NAs

2012-07-11 Thread William Dunlap
In that case, I think that using a subscript of NA is the best way to go. It works for both matrices and data.frames (unlike an integer larger than nrow(data)) and its meaning is pretty clear. Also, you will probably get better results if the function in your call to apply() returns the index (pe

Re: [R] help with merging 2 data frames

2012-07-11 Thread Jorge I Velez
Hi Dimitri, Try creating a key for "x" and "y" and then merging the result by that variable: x$key <- with(x, paste(a, b, sep = "/")) y$key <- with(y, paste(a2, b, sep = "/")) merge(x, y, by = 'key')[, c(2:4, 8:9)] HTH, Jorge.- On Wed, Jul 11, 2012 at 6:28 PM, Dimitri Liakhovitski <> wrote: >

Re: [R] Variance Inflation factor

2012-07-11 Thread Hui Du
Thank you for your consideration. > sessionInfo() R version 2.11.1 (2010-05-31) i686-pc-linux-gnu locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_

Re: [R] Variance Inflation factor

2012-07-11 Thread Jorge I Velez
Could you please include your sessionInfo() ? Thank you, Jorge.- On Wed, Jul 11, 2012 at 6:27 PM, Hui Du wrote: > Thanks. But in UNIX side, I got the same error > > ** ** > > In getDependencies(pkgs, dependencies, available, lib) : > > package ‘car’ is not available > > ** *

[R] help with merging 2 data frames

2012-07-11 Thread Dimitri Liakhovitski
Dear R-ers, I feel I am close, but can't get it quite right. Thanks a lot for your help! Dimitri # I have 2 data frames: x<-data.frame(a=c("aa","aa","ab","ab","ba","ba","bb","bb"),b=c(1:2,1:2,1:2,1:2),d=c(10,20,30,40,50,60,70,80)) y<-data.frame(a2=c("aa","aa","ba","ba"),a3=c("ab","ab","bb","bb"

Re: [R] Variance Inflation factor

2012-07-11 Thread Hui Du
Thanks. But in UNIX side, I got the same error In getDependencies(pkgs, dependencies, available, lib) : package ‘car’ is not available HXD From: Jorge I Velez [mailto:jorgeivanve...@gmail.com] Sent: Wednesday, July 11, 2012 3:19 PM To: Hui Du Cc: R-help Subject: Re: [R] Variance I

Re: [R] Variance Inflation factor

2012-07-11 Thread Jorge I Velez
See the examples at # install.pacages('car') require(car) ?vif HTH, Jorge.- On Wed, Jul 11, 2012 at 6:10 PM, Hui Du <> wrote: > Hi All, > > > I need to calculate VIF (variance inflation factor) for my linear > regression model. I found there was a function named vif in 'HH' package. > I have

Re: [R] Skipping lines and incomplete rows

2012-07-11 Thread Rui Barradas
Hello, That seems easy. dat$variable1 <- with(dat, paste(variable1, variable2)) dat$variable2 <- dat$variable3 dat$variable3 <- "" Then convert variable1 to date/time using as.POSIXct or strptime See ?strptime. Hope this helps, Rui Barradas Em 11-07-2012 13:30, vioravis escreveu: Thanks a

[R] Variance Inflation factor

2012-07-11 Thread Hui Du
Hi All, I need to calculate VIF (variance inflation factor) for my linear regression model. I found there was a function named vif in 'HH' package. I have two questions: 1) I was able to install that package in my R under windows. But while trying to install that package in UNIX, I got

Re: [R] do I need plyr, apply or something else?

2012-07-11 Thread R. Michael Weylandt
On Wed, Jul 11, 2012 at 10:05 AM, Russell Bowdrey wrote: > > Dear all, > > This is what I'd like to do (I have an implementation using for loops, which > I designed before I realised just how slow R is at executing them - this > process currently takes days to run). > > I have a large dataframe

Re: [R] Passing Multiple Variable Into SQLDF Statement as parameters of function

2012-07-11 Thread Gabor Grothendieck
On Wed, Jul 11, 2012 at 11:16 AM, scstrein wrote: > Hey guys, > > So I'm working with a project where I manage a database within R, and I'm > developing a script/function that will automatically run my queries in R > depending on the date parameters passed in. > > The problem is that when I create

Re: [R] Help with loop

2012-07-11 Thread Rui Barradas
Hello, A one-liner could be df1 <- read.table(text=" cola colb colc cold cole 1NA59 NA 17 2NA6 NA 14 NA 3 3NA 11 15 19 4 48 12 NA 20 ", header=TRUE) df2 <- read.table(text=" cola colb colc cold cole 1 1.4 0.8 0.02 1.6 0.6 ", header=

Re: [R] Substitute list value

2012-07-11 Thread R. Michael Weylandt
It should. Reproducible example of it not? Michael On Jul 11, 2012, at 3:06 PM, Charles Stangor wrote: > I can't seem to determine how to get the name of a list member to > substitute as a variable name: > > ll <- list("a1" = "a","a2" = "b") > > t1[t==ll[1], "v"] <- 99 > > why doesn't this s

Re: [R] For loop help

2012-07-11 Thread Rui Barradas
Hello, Please don't post datasets like this, it's unusable by us. Use dput(). ?dput dput(head(myData, 20)) # post the output of this. Paste the output of that command in a post. It starts with 'structure'. Don't worry if it looks awkward, it is, on the contrary, very usefull. All we need to

Re: [R] c(a, b) for POSIXct objects with tzone attributes?

2012-07-11 Thread Spencer Graves
Hi, Prof. Ripley, Bert: Thanks for the comments. Might there be a function similar to "c" but retains more attributes than just names? Before I write such, I felt a need to ask if anyone knows where it may already have been done -- and if people have suggestions for how

Re: [R] fill 0-row data.frame with 1 line of NAs

2012-07-11 Thread Liviu Andronic
On Wed, Jul 11, 2012 at 9:56 PM, William Dunlap wrote: > Why does one want to replace a zero-row data.frame > with a one-row data.frame of NA's? Unless this is for > an external program that cannot handle zero-row inputs, > this suggests that there is an unnecessary limitation (i.e., > a bug) in

Re: [R] info about R arulesSequences

2012-07-11 Thread Jennifer Maldonado
thanks! 2012/7/11 Yasir > Your error comes from the source file makebin > it's because your sequence identifiers are not in ascending order: > > // check if the sequence and event/time > // identifiers are in ascending order and > // determine the number of sequences. > ns = l = h =

Re: [R] Questions about doing analysis based on time

2012-07-11 Thread Rui Barradas
Hello, If I understanding it, what you want are the values below. half.hours <- function(x){ s <- strsplit(as.character(x), ":") H <- as.integer(sapply(s, `[`, 1)) M <- as.integer(sapply(s, `[`, 2)) h <- (H*60 + M)/60 floor(h/0.5)*0.5 } half.hours(dat$Sun

[R] Substitute list value

2012-07-11 Thread Charles Stangor
I can't seem to determine how to get the name of a list member to substitute as a variable name: ll <- list("a1" = "a","a2" = "b") t1[t==ll[1], "v"] <- 99 why doesn't this substitute to: t1[t=="a", "v"] <- 99 Thank you! -- Charles Stangor Professor -- Charles Stangor Professor

Re: [R] replacement has length zero

2012-07-11 Thread fabiano
Thanks Peter. We did manage to solve the problem using the approach bellow. Hab <- cbind(seq(1,21),habitat) hab <- matrix(NA,nrow=3,ncol=7) for (i in 1:3) {hab[i,] <- Hab[habitat==i,1]} The problem was that the hab matrix was not a multiple of habitat. -- View this message in context: ht

[R] Passing Multiple Variable Into SQLDF Statement as parameters of function

2012-07-11 Thread scstrein
Hey guys, So I'm working with a project where I manage a database within R, and I'm developing a script/function that will automatically run my queries in R depending on the date parameters passed in. The problem is that when I create variables for the dates, and use those variables in my sqldf s

[R] do I need plyr, apply or something else?

2012-07-11 Thread Russell Bowdrey
Dear all, This is what I'd like to do (I have an implementation using for loops, which I designed before I realised just how slow R is at executing them - this process currently takes days to run). I have a large dataframe containing corporate bond data, columns are: BondID Date (goes back 5ye

Re: [R] MODE , VARIANCE , NTH PERCENTAILE

2012-07-11 Thread chamilka
Din't you try sapply function? I tried it for you. Just convert your matrix into a data frame using as.data.frame and then *> rantony* ABC PQR XYZ MNO [1,] 3 6 7 15 [2,] 2 12 24 15 [3,] 20 5 1 2 [4,] 25 50 15 35 *> rantony=as.data.frame(rantony)* *> sapply(rantony,va

Re: [R] HELP me please with import of csv to R

2012-07-11 Thread William Dunlap
Did you use read.table(filename, ..., dec=",") when importing the data (so "30,3" is read as the number 30 and 3 tenths instead of as the character string "30,3")? Whenever importing data follow up by using str() or summary() on its output, before doing any further analysis. E.g., > bad <- read

[R] igraph function "graph.bfs" unavailable

2012-07-11 Thread David Marx
Hi, I've installed the igraph package and have been otherwise using it successfully, but when I try to use graph.bfs I get the error: could not find function "graph.bfs" Moreover, I don't seem to have the documentation installed either. (per ?graph.bfs and ??graph.bfs). I'm using RStudio

[R] Computing inverse cdf (quantile function) from a KDE

2012-07-11 Thread firdaus.janoos
Hello, I wanted to know if there is a simple way of getting the inverse cdf for a KDE estimate of a density (using the ks or KernSmooth packages) in R ? The method I'm using now is to perform a numerical integration of the pdf to get the cdf and then doing a search for the desired probablity valu

Re: [R] replacing NaN for every attribute in my data

2012-07-11 Thread mishkind
Thanks. That worked. -- View this message in context: http://r.789695.n4.nabble.com/replacing-NaN-for-every-attribute-in-my-data-tp4636160p4636185.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https:

Re: [R] Subset based on multiple values

2012-07-11 Thread Yasir Kaheil
yes just use %in% instead of == AllMax.. but also use table for count - Yasir Kaheil -- View this message in context: http://r.789695.n4.nabble.com/Subset-based-on-multiple-values-tp4636159p4636183.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] Mixed Models providing a correlation structure.

2012-07-11 Thread Marcio
Dear Simon, Thanks for the quick reply. Unfortunately I don't have access to Pinheiro and Bates. I tried googling the pdSymm and lme but I still cannot get the syntax right. In my model, I only have 1 random factor with repetitions (groups) (e.g. 2 records per each level) I am pasting bellow a ver

Re: [R] Subset based on multiple values

2012-07-11 Thread Amanduh320
I want the output to be 1,1,1,1,7,7,7,7 The multiple values of AllMax are 1 and 7. I think I've figured it out though, I added a loop at the end: test <- as.matrix(c(1,1,1,1,3,3,7,7,7,7)) Count <- tapply(test[,1], test[,1], length) # count for each value spp <- unique(test[,1]) Count1 <- as.dat

[R] Help needed to tackle multicollinearity problem in count data with the help of R

2012-07-11 Thread umesh khatri
Dear everyone, I'm student of Masters in Statistics (Actuarial) from Central University of Rajasthan, India. I am doing a major project work as a part of the degree. My major project deals with fitting a glm model for the data of car insurance. I'm facing the problem of multicollinearity for this

[R] Help with loop

2012-07-11 Thread paulalou
Hi, I have two dataframes: The first, df1, contains some missing data: cola colb colc cold cole 1NA59 NA 17 2NA6 NA 14 NA 3 3NA 11 15 19 4 48 12 NA 20 The second, df2, contains the following: cola colb colc cold cole 1 1.4 0.8 0.

[R] replacing NaN for every attribute in my data

2012-07-11 Thread mishkind
Hi, I have a list called ds which has the following attributes: attributes(ds) $names [1] "adj.r.squared" "fstatistic""intercept" "slope" [5] "std.error" "tstatistic" I want to replace all the NaN is ds with 0, and after searching past posts I found I can hardcode it like t

[R] Substitute list value

2012-07-11 Thread Charles Stangor
I can't seem to determine how to get the name of a list member to substitute: ll <- list("a1" = "a","a2" = "b") t1[t==ll[0], "v"] <- 99 why doesn't this substitute to: t1[t=="a", "v"] <- 99 Thank you! [[alternative HTML version deleted]] __

[R] For loop help

2012-07-11 Thread cs389
Hi Everyone, I could use help developing a for loop. I have a dataset with tallies for a number of species within 7 different size classes. I need to uncollate the data into the rawest form (ie: each row a different individual) & retrain the metadata associated with each row (Date, Recorder, Sit

[R] read.xls question

2012-07-11 Thread Tsay, Edwin
Hello, I've been using: tmp.df = read.xls(filename, stringsAsFactors = FALSE) to read in my files. Even though I get the "There were 50 or more warnings" thing, for the most part most of the data is read in correctly. However, there are a few select rows where there are values but they are

[R] Chunking in RCurl using getBinaryURL()

2012-07-11 Thread els
Hello everyone, I'm relatively new to the RCurl package, and I'm having some issues with reading in my data the way I want to. I have binary data that I've only been able to read in correctly using getBinaryURL(), but I also want to read the data in chunks (it's a huge timeseries dataset). Accord

[R] Modifying the design matrix X in GAMS to suit data assimilation

2012-07-11 Thread Ateljevich, Eli
I have a data assimilation problem that might be amenable to the use of GAMS, but I am not sure how feasible it is to implement. I was told the R mailing list was a great resource. My observations are spatiotemporal salinity in the San Francisco Bay at a number of instruments over a few days. T

Re: [R] HELP me please with import of csv to R

2012-07-11 Thread F86
Thank you! It is fixed now. However, now when I'm trying with hist(skatter) i get this message: Error in hist.default(skatter) : 'x' must be numeric I don't know what I'm doing wrong but it worked perfectly on windows some weeks ago. My data skatter looks like this: > skatter

[R] Substitute list value

2012-07-11 Thread Charles Stangor
I can't seem to determine how to get the name of a list member to substitute: ll <- list("a1" = "a","a2" = "b") t1[t==ll[0], "v"] <- 99 why doesn't this substitute to: t1[t=="a", "v"] <- 99 Thank you! -- Charles Stangor Professor [[alternative HTML version deleted]]

Re: [R] HELP me please with import of csv to R

2012-07-11 Thread F86
Thank you! It is fixed now. However, now when I'm trying with hist(skatter) i get this message: Error in hist.default(skatter) : 'x' must be numeric I don't know what I'm doing wrong but it worked perfectly on windows some weeks ago. My data skater looks like this: > skatter Ko

[R] Poisson ridge regression

2012-07-11 Thread umesh khatri
-- Forwarded message -- From: umesh khatri Date: Wed, 11 Jul 2012 16:15:11 +0530 Subject: Poisson ridge regression To: r-h...@rproject.org I'm student of Masters in Statistics (Actuarial) from Central University of Rajasthan, India. I am doing a major project work as a part of the

Re: [R] how to create the data frame

2012-07-11 Thread sureshraj
Hi Dude!! It seems that your column names are not sequentially arranged, I guess, If so u just reorder them and do it your way...it will work.. for example, colnames(data)[2]<–"weekly.returns" ## sometimes u can use like this as well, if u want to assign at last most column

[R] declaring negative log likelihood of a distribution

2012-07-11 Thread chamilka
Hi everyone! I already posted http://r.789695.n4.nabble.com/Declaring-a-density-function-with-for-loop-td4635699.html a question on finding density values of a new Binomial like distribution which has the following pmf: http://r.789695.n4.nabble.com/file/n4636134/kb.png Thank fully http://r.789

Re: [R] Help with vectors and rollapply

2012-07-11 Thread Raghuraman Ramachandran
Hi Bill Many thanks for your help. Cheers R -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: 10 July 2012 17:22 To: Raghuraman Ramachandran; r-help@r-project.org Subject: RE: Help with vectors and rollapply It looks like you already have the zoo package loaded so

Re: [R] Understanding cenros Error

2012-07-11 Thread Rich Shepard
On Wed, 11 Jul 2012, MacQueen, Don wrote: An my "easy" but not very useful answer is that this particular subset probably violates some assumption of the cenros() model. I myself would start with simple inspections of the data, such as with( subset(chem, param=='Ag'), table(ceneq1) ) with( s

Re: [R] Subset based on multiple values

2012-07-11 Thread andrija djurovic
Hi. Maybe this: ct <- table(test) as.numeric(names(ct[ct==max(ct)])) test[test[,1]%in%as.numeric(names(ct[ct==max(ct)])),,drop=FALSE] ? Andrija On Wed, Jul 11, 2012 at 8:33 PM, Amanduh320 wrote: > I'm stuck on a seemingly simple problem. I'm trying to subset the data by > several numbers and

Re: [R] Getting objects from quantmod ticker list

2012-07-11 Thread R. Michael Weylandt
On Wed, Jul 11, 2012 at 3:08 PM, R. Michael Weylandt wrote: > On Wed, Jul 11, 2012 at 3:07 PM, R. Michael Weylandt > wrote: >> On Wed, Jul 11, 2012 at 1:49 PM, Cren wrote: >>> # One more question, Joshua: let instead of merging tickers >>> # I would like to put prices from an OHLC object >>> # i

Re: [R] Getting objects from quantmod ticker list

2012-07-11 Thread R. Michael Weylandt
On Wed, Jul 11, 2012 at 3:07 PM, R. Michael Weylandt wrote: > On Wed, Jul 11, 2012 at 1:49 PM, Cren wrote: >> # One more question, Joshua: let instead of merging tickers >> # I would like to put prices from an OHLC object >> # in weekly format, then selecting just the close prices. >> # What woul

Re: [R] Getting objects from quantmod ticker list

2012-07-11 Thread R. Michael Weylandt
On Wed, Jul 11, 2012 at 1:49 PM, Cren wrote: > # One more question, Joshua: let instead of merging tickers > # I would like to put prices from an OHLC object > # in weekly format, then selecting just the close prices. > # What would be a code to do it? > # I guess: > > data = new.env() > ticker.li

Re: [R] fill 0-row data.frame with 1 line of NAs

2012-07-11 Thread William Dunlap
Why does one want to replace a zero-row data.frame with a one-row data.frame of NA's? Unless this is for an external program that cannot handle zero-row inputs, this suggests that there is an unnecessary limitation (i.e., a bug) in the R code that uses this data.frame. Bill Dunlap Spotfire, TIBCO

Re: [R] Understanding cenros Error

2012-07-11 Thread MacQueen, Don
An my "easy" but not very useful answer is that this particular subset probably violates some assumption of the cenros() model. I myself would start with simple inspections of the data, such as with( subset(chem, param=='Ag'), table(ceneq1) ) with( subset(chem, param=='Ag'), qqnorm(quant) )

[R] RGL axis labels parallel to axes

2012-07-11 Thread PatGauthier
Hello useRs, I'm having trouble trying to produce axis labels running parallel to the axes in 3d space. Is their a way to do this when producing 3d graphs using the rgl package? Thanks for your help, Patrick -- View this message in context: http://r.789695.n4.nabble.com/RGL-axis-labels-paral

Re: [R] Subset based on multiple values

2012-07-11 Thread Yasir
I see that this is your input: c(1,1,1,1,3,3,7,7,7,7) what do you want the output to be? what could the multiple values of AllMax be? - Yasir Kaheil -- View this message in context: http://r.789695.n4.nabble.com/Subset-based-on-multiple-values-tp4636159p4636167.html Sent from the R help mai

[R] Subset based on multiple values

2012-07-11 Thread Amanduh320
I'm stuck on a seemingly simple problem. I'm trying to subset the data by several numbers and it cuts out half of the rows. Here is the sample code: test <- as.matrix(c(1,1,1,1,3,3,7,7,7,7)) Count <- tapply(test[,1], test[,1], length) # count for each value spp <- unique(test[,1]) Count1 <- as.d

Re: [R] MODE , VARIANCE , NTH PERCENTAILE

2012-07-11 Thread Rantony
Thank you chamilka. From: chamilka [via R] [mailto:ml-node+s789695n4636142...@n4.nabble.com] Sent: Wednesday, July 11, 2012 8:13 PM To: Akkara, Antony (GE Energy, Non-GE) Subject: Re: MODE , VARIANCE , NTH PERCENTAILE Din't you try sapply function? I tried it for you. Just convert your

Re: [R] replacing NaN for every attribute in my data

2012-07-11 Thread Yasir
You can try this: for (i in 1:length(ds)) { dummy<-ds[[i]]; dummy[is.nan(dummy)]<-0 ds[[i]]<-dummy } if is.nan doesn't work, replace with is.na - Yasir Kaheil -- View this message in context: http://r.789695.n4.nabble.com/replacing-NaN-for-every-attribute-in-my-data-tp4636160p4636163.html

[R] MODE , VARIANCE , NTH PERCENTAILE

2012-07-11 Thread Rantony
Hi, Here i have an matrix like this, ABCPQRXYZ MNO -- --- -- 367 15 2 122415 20 5 1 2 25 50 15 35 i need to get the "MO

Re: [R] fill 0-row data.frame with 1 line of NAs

2012-07-11 Thread arun
Hi, Try this: .xa<-iris[1,][rep(NA,length(iris),1),] .xa #   Sepal.Length Sepal.Width Petal.Length Petal.Width Species #NA   NA  NA   NA  NA    #or .xb<-iris[1,][rep(NA,ncol(iris),1),]  .xb #   Sepal.Length Sepal.Width Petal.Length Petal.Width Species #NA

Re: [R] Questions about doing analysis based on time

2012-07-11 Thread APOCooter
Hmm, I guess that's not exactly what I needed. It's my fault; you gave me what I asked for, I was just asking for the wrong thing. What I'm hoping to do is something similar to: aggregate(dat$SunScore, by=list(h), median) except I'd like to do it by half hour instead of hour. I guess what I ne

Re: [R] info about R arulesSequences

2012-07-11 Thread Yasir
Your error comes from the source file makebin it's because your sequence identifiers are not in ascending order: // check if the sequence and event/time // identifiers are in ascending order and // determine the number of sequences. ns = l = h = 0; for (i = 0; i < LENGTH(sx); i++

Re: [R] Skipping lines and incomplete rows

2012-07-11 Thread vioravis
Thanks a lot for the guidance. I have another text file with a time stamp and an empty column as given below: First line: Skip this line Second line: skip this line Third line: skip this line variable1

Re: [R] fitting power growth

2012-07-11 Thread Yasir
read the part on power fitting: http://www.itc.nl/~rossiter/teach/R/R_CurveFit.pdf -- View this message in context: http://r.789695.n4.nabble.com/fitting-power-growth-tp4635999p4636158.html Sent from the R help mailing list archive at Nabble.com. __ R

  1   2   >