Re: [R] Inexplicably different results using subset vs bracket notation on logical variable

2012-08-27 Thread peter dalgaard
On Aug 28, 2012, at 05:11 , David Winsemius wrote: > That's exactly it. If a logical index returns NA, its row is included in the > output of "[" extraction. You can correct what I consider a failing and > others consider a feature with: > > df[df$Renewal==TRUE & !is.na(df$Renewal), 1:2] > P

Re: [R] To predict Y based on only one sample of X and Y

2012-08-27 Thread David Winsemius
On Aug 27, 2012, at 8:49 PM, Elaine Kuo wrote: I want to predict wing length using regression commands. (lm and predict) The data details are as followed Data: Bird physiological data 1. body mass 2. body length 3. wing length Data type: Order A: consisting of 20 species, body mass and l

Re: [R] Optim Problem

2012-08-27 Thread Berend Hasselman
On 28-08-2012, at 03:12, Christopher Kelvin wrote: > Hello, > I want to estimate the exponential parameter by using optim with the > following input, where t contains 40% of the data and q contains 60% of the > data within an interval. In implementing the code command for optim i want it > to

[R] [ncdf4] error converting GEIA data to netCDF

2012-08-27 Thread Tom Roche
summary: I can successfully ncvar_put(...) data to a file, but when I try to ncvar_get(...) the same data, I get > Error in if (nc$var[[li]]$hasAddOffset) addOffset = nc$var[[li]]$addOffset > else addOffset = 0 : > argument is of length zero How to fix or debug? details: R code @ https://

Re: [R] write.table and read.table commands

2012-08-27 Thread David Winsemius
On Aug 27, 2012, at 10:04 PM, R. Michael Weylandt > wrote: It's because read.table returns a data frame, not a matrix. You can coerce to a matrix with as.matrix() but you might loose information if your variables are of different classes. Michael On Aug 27, 2012, at 7:07 PM, Cheryl Johns

Re: [R] [netcdfgroup] [ncdf4] error converting GEIA data to netCDF

2012-08-27 Thread Roy Mendelssohn
Just looked at your code, and you do call nc_sync. I am wondering if it works if you call nc_close, reopen and then write. Perhaps the nc_sync is sufficent when you have been in define mode in the nc_create call. -Roy On Aug 27, 2012, at 8:31 PM, Tom Roche wrote: > > summary: I can successfu

Re: [R] [netcdfgroup] [ncdf4] error converting GEIA data to netCDF

2012-08-27 Thread Roy Mendelssohn
If I had to guess, you did not call nc_close or nc_sync. In netcdf, the data is actually really written until that is called. -Roy On Aug 27, 2012, at 8:31 PM, Tom Roche wrote: > > summary: I can successfully ncvar_put(...) data to a file, but when I > try to ncvar_get(...) the same data, I g

Re: [R] Inexplicably different results using subset vs bracket notation on logical variable

2012-08-27 Thread David Winsemius
On Aug 27, 2012, at 5:08 PM, Mauricio Cornejo wrote: Hi, Would anyone have any idea as to why I would obtain completely different results when subsetting using the subset function vs bracket notation? I have a data frame with 65 variables and 4382 rows. When I use execute the following

Re: [R] find and replace

2012-08-27 Thread R. Michael Weylandt
Take a look at gsub() Michael On Aug 27, 2012, at 6:47 PM, Sapana Lohani wrote: > Hi, > > My data frame (Students) is > > ID Name Fav_Place > 101 Andrew� Phoenix AZ > 201 John San Francisco > 303 JulieCalifornia / New York > 304 Monica� New York > > How can I replace Phoenix with Tucson & N

Re: [R] ?nchar ?strsplit

2012-08-27 Thread David Winsemius
On Aug 27, 2012, at 1:40 PM, Sapana Lohani wrote: Hi, my data frame is x<-data.frame(ID=c("abc/def","abc/def/ghi","abc","mno/pqr/st/ab")) I want to split my column ID using "/" as the place to split. How can I do that without telling the code how many sub-columns. I could use nchar(gsub("

Re: [R] write.table and read.table commands

2012-08-27 Thread R. Michael Weylandt
It's because read.table returns a data frame, not a matrix. You can coerce to a matrix with as.matrix() but you might loose information if your variables are of different classes. Michael On Aug 27, 2012, at 7:07 PM, Cheryl Johnson wrote: > Greetings, > > When I try to use the write.table c

Re: [R] Inexplicably different results using subset vs bracket notation on logical variable

2012-08-27 Thread William Dunlap
subset(dataFrame, subset) does the equivalent of dataFrame[!is.na(subset) & subset,]. I.e., it treats the NA's in the subset argument the same as FALSEs. Doesn't help(subset) mention this? By the way, if Renewal is a logical vector, it will be identical to Renewal==TRUE so you may as well leav

[R] Optim Problem

2012-08-27 Thread Christopher Kelvin
Hello, I want to estimate the exponential parameter by using optim with the following input, where t contains 40% of the data and q contains 60% of the data within an interval. In implementing the code command for optim i want it to contain both the t and q data so i can obtain the correct estim

[R] New to R

2012-08-27 Thread moulirc
Hi, I am new to R and using Rcmdr and like to automate and get into scripting... I am using for evaluating two variables .Table <- xtabs(~CurSWI+BckMo, data=swanalysis_run1) .Table fisher.test(.Table) remove(.Table) the output for this will be > .Table BckMo CurSWI N/A No Yes N/A

[R] write.table and read.table commands

2012-08-27 Thread Cheryl Johnson
Greetings, When I try to use the write.table command to save a matrix as a file and then open the file with read.table, if I try to take the mean of the entire matrix, instead each column of the matrix has its mean calculated. I have copied and pasted an example of my code below. When I try to mak

[R] find and replace

2012-08-27 Thread Sapana Lohani
Hi, My data frame (Students) is ID Name Fav_Place 101 Andrew  Phoenix AZ 201 John San Francisco 303 JulieCalifornia / New York 304 Monica  New York How can I replace Phoenix with Tucson & New York with New York City in the df? Thanks [[alternative HTML version deleted]] __

Re: [R] Lattice graphics adding abline line (1:1 line) ???

2012-08-27 Thread iwaite
I have read multiple books and looked at many posts online and can't seem to figure out how to add a 1:1 line in lattice xyplot. I've tried multiple versions of getting this to work, including trying "panel.abline(h=0,v=1), panel=function and others. Second question, how do I get the legend creat

Re: [R] find and replace

2012-08-27 Thread jim holtman
I am making the assumption that all the columns are character and not factors: for (i in c("A", "B", "C", "D", "E")){ yourdf[[i]] <- ifelse(yourdf[[i]] == 'x' , 'y' , ifelse(yourdf[[i]] == 'a' , 'b' , yourd

[R] Inexplicably different results using subset vs bracket notation on logical variable

2012-08-27 Thread Mauricio Cornejo
Hi, Would anyone have any idea as to why I would obtain completely different results when subsetting using the subset function vs bracket notation? I have a data frame with 65 variables and 4382 rows. When I use execute the following subset command I get the correct results (125 rows) > subset(

Re: [R] ?nchar ?strsplit

2012-08-27 Thread arun
HI, #In addition to, nchar1<-nchar(gsub("[^/]","",x$ID))  max(nchar1) #[1] 3 library(stringr)  data.frame(str_split_fixed(x$ID,"/",max(nchar1)+1)) #or strsplit(as.character(x$ID),"/")   #You can also use: strsplit(gsub("(.*)/(.*)","\\1 \\2",gsub("(.*)/(.*)/(.*)","\\1 \\2 \\3",gsub("(.*)/(.*

Re: [R] write.matrix.csr data conversion

2012-08-27 Thread David Meyer
done, thanks for the suggestion. David On 2012-08-27 21:15, Sam Steingold wrote: * jim holtman [2012-08-27 14:55:08 -0400]: Most likely when 'y' is converted to a dataframe (not sure what the function 'write.matrix.csr' does since you did not say where you got it), sorry, library(e1071) '

[R] find and replace

2012-08-27 Thread Sapana Lohani
I have 5 (A,B,C,D,E) columns in my dataframe. I want to replace all "x" with "y" and all "a" with "b" within these 5 columns. Can I do it in one step? Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat

Re: [R] How to generate a matrix of Beta or Binomial distribution

2012-08-27 Thread JeffND
Dear Michael, Thanks very much for your explicit explanation! That makes much sense. Best wishes, Jeff -- View this message in context: http://r.789695.n4.nabble.com/How-to-generate-a-matrix-of-Beta-or-Binomial-distribution-tp4641422p4641472.html Sent from the R help mailing list archive at

Re: [R] ?nchar ?strsplit

2012-08-27 Thread David L Carlson
Splitting is easy: strsplit(as.character(x$ID), "/") That produces a list with four elements, each of which is a character vector. R does not have a representation for "sub-columns" so you will have to be clearer about how you want to represent the data and what you are planning to do with it. -

[R] Error in Installing RODBC in Linux R

2012-08-27 Thread Madana_Babu
Hi All, I am trying to install RODBC Package in Linux version of R. PFB the error message. Request all, if you have any solution how to overcome this error. configure: error: "ODBC headers sql.h and sqlext.h not found" Regards, Madana -- View this message in context: http://r.789695.n4.nabbl

Re: [R] How to generate a matrix of Beta or Binomial distribution

2012-08-27 Thread Rui Barradas
Hello, I'm glad it helped. Inline. Em 27-08-2012 19:00, Zuofeng Shang escreveu: Hi Rui, Many thanks for your excellent code! That works very well. But I still have a kind of naive question about the set.seed(1) Consider shape1=c(1,3) and shape2=c(2,4) Using R I got that > set.seed(1) > rbe

[R] Font size in geom_dl (using ggplot2)

2012-08-27 Thread Matthias Habjan
Hey everyone, I am an R-newby... so sorry for bothering you with simple-to-solve questions;) I have the following issue: trying to add labels to my scatterplots (with geom_dl in ggplot2). Everything works fine, but after checking every resource I do not find a way to change the font size of my lab

[R] To predict Y based on only one sample of X and Y

2012-08-27 Thread Elaine Kuo
Hello I want to predict wing length using regression commands. (lm and predict) The data details are as followed Data: Bird physiological data 1. body mass 2. body length 3. wing length Data type: Order A: consisting of 20 species, body mass and length of all 20 species are measured

Re: [R] Changing entries of column of type "factor"/Adding a new level to a factor

2012-08-27 Thread Bert Gunter
Perfectly sensible, and indeed what I originally wrote. But it only works for my trivial example, not the general situation where it might not be the first level that needs changing. -- Bert On Mon, Aug 27, 2012 at 1:52 PM, David Winsemius wrote: > > On Aug 27, 2012, at 12:18 PM, Bert Gunter wro

Re: [R] Changing entries of column of type "factor"/Adding a new level to a factor

2012-08-27 Thread David Winsemius
On Aug 27, 2012, at 12:18 PM, Bert Gunter wrote: Well ...See below. -- Cheers, Bert On Mon, Aug 27, 2012 at 9:19 AM, David Winsemius > wrote: On Aug 27, 2012, at 3:09 AM, Fridolin wrote: What is a smart way to change an entry inside a column of a dataframe or matrix which is of type "fa

Re: [R] RGL plot : lighting problem when triangle3d and persp3d are used in the same plot

2012-08-27 Thread Duncan Murdoch
On 27/08/2012 1:47 PM, Stephane Chantepie wrote: Dear all, I have tried to plot a triangular matrix with the function persp3d(rgl). for example z=rbind(c(1,NA,NA,NA),c(5,3,NA,NA),c(4,2,9,NA),c(8,6,5,11)) x=1:4 y=1:4 persp3d(x,y,z,color="gray") The two extreme points are not plotted (value=1 a

Re: [R] Turning of[f] source echo

2012-08-27 Thread David Winsemius
I wasn't an Rstudio user at that point, but now that I am a new user, I am wondering "how" you were interacting with the Rstudio windows. I have an editing window open and is has both a "Run" button and a "Source" button. I get the behavior you describe when I hit the Source button and the

Re: [R] Assigning colors on low p-values in table

2012-08-27 Thread Jean V Adams
Emil, It's helpful to provide code that generates your (example) data. You can use the function dput() to do that. # I set up your matrix a bit differently than what you presented. output <- structure(c(-2.3109, -0.2934, -0.5539, -2.1352, -2.6968, -2.0429, -0.3973, -0.6468, 0.4181, -0.6243, 2.9

Re: [R] saving and reading csv and rda files

2012-08-27 Thread R. Michael Weylandt
On Mon, Aug 27, 2012 at 9:56 AM, Alok Bohara, PhD wrote: > Hi: > > I am trying to understand the link between ".csv" and ".rda" files.Is > there any easy to follow tutorial on this? > > (I could do some of the operations below, but I got lost in the details.) > > 1. Reading .rda file ? > > d

Re: [R] ?nchar ?strsplit

2012-08-27 Thread Bert Gunter
Typo: > y <- as.character(x[[1]]) ## You need a character vector argument > strsplit(y,"/") ## works -- Bert On Mon, Aug 27, 2012 at 12:58 PM, Bert Gunter wrote: > (Re-)read ?strsplit. You do not have to tell the code how many columns ... > etc. > And the split isn't into sub columns. > > y <-

Re: [R] ?nchar ?strsplit

2012-08-27 Thread Bert Gunter
(Re-)read ?strsplit. You do not have to tell the code how many columns ... etc. And the split isn't into sub columns. y <- as.character(x[[1]] ## You need a character vector argument strsplit(y,"/") ## works -- Bert On Mon, Aug 27, 2012 at 11:40 AM, Sapana Lohani wrote: > Hi, my data frame is >

Re: [R] How to generate a matrix of Beta or Binomial distribution

2012-08-27 Thread R. Michael Weylandt
On Mon, Aug 27, 2012 at 9:49 AM, JeffND wrote: > Hi folks, > > I have a question about how to efficiently produce random numbers from Beta > and Binomial distributions. > > For Beta distribution, suppose we have two shape vectors shape1 and shape2. > I hope to generate a 1 x 2 matrix X whose i

[R] Help with recursive least squares

2012-08-27 Thread Nikhil Joshi
I need some help with using recursive least squares lm.fit.recursive {quantreg}. I found some references online but cannot find a reproducible example as to how to use recursive least squares. I'd really appreciate if anyone can point me to a reproducible example. [[alternative HTML versi

[R] has anybody used gpuCor?

2012-08-27 Thread flora flora
I tried to calculate the pairwise pearson correlation of the column vector of a matrix of 20,000 columns using the gpuCor fucntion from the package gputools, and compare the speed with the ordinary cor function. The gpuCor is supposed to be much faster than cor. But I found that the ordinay cor is

[R] ?nchar ?strsplit

2012-08-27 Thread Sapana Lohani
Hi, my data frame is x<-data.frame(ID=c("abc/def","abc/def/ghi","abc","mno/pqr/st/ab")) I want to split my column ID using "/" as the place to split. How can I do that without telling the code how many sub-columns. I could use nchar(gsub("[^/]","",x$ID)) to get how many "/" are in each row of t

[R] RGL plot : lighting problem when triangle3d and persp3d are used in the same plot

2012-08-27 Thread Stephane Chantepie
Dear all, I have tried to plot a triangular matrix with the function persp3d(rgl). for example z=rbind(c(1,NA,NA,NA),c(5,3,NA,NA),c(4,2,9,NA),c(8,6,5,11)) x=1:4 y=1:4 persp3d(x,y,z,color="gray") The two extreme points are not plotted (value=1 and value=10). It seems because the half of the matr

[R] High Density region using hdrcde

2012-08-27 Thread Andras Farkas
Dear All,   could you please confirm (or disconfimr, and then please explain:-)) my understanding of the results generated by the following code:   hdr.den(rnorm(200,55,3))   result:       [,1] [,2] 99% 47.07170 63.26864 95% 48.83670 61.55108 50% 53.04884 57.37916   the way I am interpreti

Re: [R] Standard deviation from MANOVA??

2012-08-27 Thread BrutishFruit
Hi David. I mean that I want to get the *standard error of the predicted means* (which is a type standard deviation, if I have understand everything right), which the se.fit switch mentioned above should require from the "predict()" function. But the se.fit switch doesn't seem to work for manova ob

Re: [R] looping through numbered variables

2012-08-27 Thread Daniel Caro
Thank you, character indexing (?"[") is what I was looking for: sapply(paste('var', 1:100, sep=''), function(x) weighted.mean(data[[x]], data$weight)) Daniel On Mon, Aug 27, 2012 at 6:26 PM, Bert Gunter wrote: > Have you read "An Introduction to R". If not, please do so before > osting and pay

[R] Filtering Beadarray Summary Data

2012-08-27 Thread gundliwe
Hey all, I was wondering if someone could tell me a way to remove the lines in my annoated BeadSummary Data file that have a PROBEQUALITY of "BAD" and "Match". They method they used in the Bead summary tutorial gives me the following error. Anyone have any ideas? Thanks in advance Will ids <-

Re: [R] write.matrix.csr data conversion

2012-08-27 Thread Sam Steingold
> * jim holtman [2012-08-27 14:55:08 -0400]: > > Most likely when 'y' is converted to a dataframe (not sure what the > function 'write.matrix.csr' does since you did not say where you got > it), sorry, library(e1071) > '0' and '1' are converted to factors which probably show up as 1 > and 2 in t

Re: [R] Reading pdf file into R

2012-08-27 Thread Marc Schwartz
I was going to point you to the same utility, which I have used over the years on both Linux and OSX. A Google search using "pdf to text" will bring up a variety of non-R related possibilities. It is possible that somebody, somewhere has built an interface in R to pdftotext, such as a wrapper f

[R] matrix.csr %*% matrix --> matrix

2012-08-27 Thread Sam Steingold
When a sparse matrix is multiplied by a regular one, the result is usually not sparse. However, when matrix.csr is multiplied by a regular matrix in R, a matrix.csr is produced. Is there a way to avoid this? Thanks! -- Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.1110300

Re: [R] write.matrix.csr data conversion

2012-08-27 Thread jim holtman
Most likely when 'y' is converted to a dataframe (not sure what the function 'write.matrix.csr' does since you did not say where you got it), '0' and '1' are converted to factors which probably show up as 1 and 2 in the file. Here is a quick example: > x <- sample(c(0,1), 20,TRUE) > y <- table(x)

Re: [R] Reading pdf file into R

2012-08-27 Thread Christofer Bogaso
Thanks Berend for your reply. However I was expecting something may be available within R itself (or perhaps some added package.) Thanks and regards, On Tue, Aug 28, 2012 at 12:23 AM, Berend Hasselman wrote: > > On 27-08-2012, at 20:21, Christofer Bogaso wrote: > >> Dear all, I have got a pdf fi

[R] write.matrix.csr data conversion

2012-08-27 Thread Sam Steingold
> write.matrix.csr(mx, y = y, file = file) > table(y) 0 1 5194394 23487 $ cut -d' ' -f1 f | sort | uniq -c 23487 2 5194394 1 i.e., 0 is written as 1 and 1 is written as 2. why? is there a way to disable this? -- Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X

Re: [R] Reading pdf file into R

2012-08-27 Thread Berend Hasselman
On 27-08-2012, at 20:21, Christofer Bogaso wrote: > Dear all, I have got a pdf file with lot of numerical data which I > want to export to R for some analysis. Is there any way to doing that? > > Thanks for your time. Possibly the program pdftotext from xpdf tools (http://www.foolabs.com/xpdf

Re: [R] simplest way (set of functions) to parse a file

2012-08-27 Thread Giovanni Azua
Thank you very much! It worked nicely. Best! Giovanni On Aug 27, 2012, at 4:18 PM, jim holtman wrote: > try this: > > > > input <- readLines(textConnection("Iteration JminError Elapsed > > Corral Duality Gap Step1 Step2 Step3 Step4 > + 2 2 0.00e+001

[R] Reading pdf file into R

2012-08-27 Thread Christofer Bogaso
Dear all, I have got a pdf file with lot of numerical data which I want to export to R for some analysis. Is there any way to doing that? Thanks for your time. Thanks and regards, __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listin

Re: [R] dimnames in an array(I'll be grateful if this message will be passed to all list users)

2012-08-27 Thread William Dunlap
res3 = Profile.LS(fhn, data=data2, times=times, pars=pars, coefs=coefs, lambda=lambda, out.meth='nls', control.in=control.in, control.out=control.out) #Rather than parameter estimates, as with the single replicate analysis, this produces

Re: [R] Drawing a simplex

2012-08-27 Thread Chel Hee Lee
Thank you, David. I found some good stuffs for which I have been looking. On Sun, 2012-08-26 at 09:01 -0700, David Winsemius wrote: > On Aug 25, 2012, at 9:00 PM, Chel Hee Lee wrote: > > > I will very appreciate if anyone can provide some materials to draw a > > simplex plot of a Dirichlet dist

Re: [R] How to average time series data around regular intervals

2012-08-27 Thread jim holtman
try this: > x <- read.table(text = "2012-07-22 12:12:00, 21 + 2012-07-22 12:15:00, 22 + 2012-07-22 12:18:00, 24 + 2012-07-22 12:39:00, 21 + 2012-07-22 12:45:00, 25 + 2012-07-22 12:49:00, 26 + 2012-07-22 12:53:00, 20 + 2012-07-22 13:00:00, 18 + 2012-07-22 13:06:00, 22", colClasses = c("POSIXct", "

Re: [R] Changing entries of column of type "factor"/Adding a new level to a factor

2012-08-27 Thread Bert Gunter
Well ...See below. -- Cheers, Bert On Mon, Aug 27, 2012 at 9:19 AM, David Winsemius wrote: > > On Aug 27, 2012, at 3:09 AM, Fridolin wrote: > >> What is a smart way to change an entry inside a column of a dataframe or >> matrix which is of type "factor"? >> >> Here is my script incl. input data:

Re: [R] looping through numbered variables

2012-08-27 Thread David Winsemius
On Aug 27, 2012, at 7:11 AM, Daniel Caro wrote: Hello, This is a beginner question. You should read the Posting Guide. (As well as following Bert's suggestion to work through "Intro to R". I am trying to loop through numbered variables with "apply" to calculate weighted means. My data i

[R] practical way to change column names?

2012-08-27 Thread Niklas Fischer
Dear R helpers, I have a social network data including repated measures of ten alters (whom you contact) and their attributes(gender, age, strength of tie). I wrote variables related with alters just for wrote alter 1 and alter 2. I'd like to change the like below. I'd change each name separetely

Re: [R] Changing entries of column of type "factor"/Adding a new level to a factor

2012-08-27 Thread David Winsemius
On Aug 27, 2012, at 3:09 AM, Fridolin wrote: What is a smart way to change an entry inside a column of a dataframe or matrix which is of type "factor"? Here is my script incl. input data: #set working directory: setwd("K:/R") #read in data: input<-read.table("Exampleinput.txt", sep="\t", h

Re: [R] looping through numbered variables

2012-08-27 Thread Bert Gunter
Have you read "An Introduction to R". If not, please do so before osting and pay particular attention to the section on indexing. If so, re-read the sections on indexing. For a terser exposition, ?"[" -- Bert On Mon, Aug 27, 2012 at 7:11 AM, Daniel Caro wrote: > Hello, > > This is a beginner qu

[R] How to generate a matrix of Beta or Binomial distribution

2012-08-27 Thread JeffND
Hi folks, I have a question about how to efficiently produce random numbers from Beta and Binomial distributions. For Beta distribution, suppose we have two shape vectors shape1 and shape2. I hope to generate a 1 x 2 matrix X whose i th rwo is a sample from reta(2,shape1[i]mshape2[i]). Of co

[R] randomLCA

2012-08-27 Thread Gabriele Accetta
Can anybody, please, explain me how many parameter are estimated using randomLCA? For examples, model "dentistry.lca2random" estimate 1 scale (or variance, b_j) parameter and 2 position parameters (a_cj)? Doesn't it? Do I need at least 4 diagnostic tests for such a model? What happens if I

[R] interpret the importance output?

2012-08-27 Thread Johnathan Mercer
> importance(rfor.pdp11_t25.comb1,type=1) %IncMSE v1 -0.28956401263 v2 1.92865561147 v3 -0.63443929130 v4 1.58949137047 v5 0.03190940065 I wasn't entirely confident with interpreting these results based on the documentation. Could you please interpret? [[alternative HTML vers

Re: [R] String Handling() for Split a word by a letter

2012-08-27 Thread Rui Barradas
Hello, If the op says he has tried strsplit, maybe a simple subsetting afterwards would solve it. a <- "12345_mydata" strsplit(a, "_")[[1]][1] Hope this helps, Rui Barradas Em 27-08-2012 15:22, jim holtman escreveu: Is this what you want: a<- "12345_mydata" sub("_.*", "", a) [1] "12345

[R] bpplot question

2012-08-27 Thread Andras Farkas
Dear All,   wondering if I could get some help on the following using a box-percentile plotting in Hmisc:   1. how could I put limits on the y axis? the following does NOT seem to work:   bpplot(b,c,d,e,f,g,h, ylim=c(0,2500))   2. I would like to color in each box plot from b to h the line represe

Re: [R] Changing entries of column of type "factor"/Adding a new level to a factor

2012-08-27 Thread William Dunlap
One way is to read in your text data as character columns with read.table(stringsAsFactors=FALSE,...), then fiddle with the values, and finally make factors out of the columns that you want to be factors, specifying the levels explicitly. (Do you really want those number/number things to be treat

[R] [R-pkgs] PVAClone: new package for population viability analysis

2012-08-27 Thread Peter Solymos
Dear UseRs! We are pleased to announce the release of our new package 'PVAClone'. The 'PVAClone' package implements Population Viability Analysis (PVA) methodology using data cloning. The data cloning algorithm by Lele et al. (2007, 2010) is employed to compute maximum likelihood estimates of the

[R] looping through numbered variables

2012-08-27 Thread Daniel Caro
Hello, This is a beginner question. I am trying to loop through numbered variables with "apply" to calculate weighted means. My data is "data", the variables are "var1" to "var100", the weight is "weight". The command works using sapply(paste('data$var', 1:100, sep=''), function(x) weighted.mean(

[R] saving and reading csv and rda files

2012-08-27 Thread Alok Bohara, PhD
Hi: I am trying to understand the link between ".csv" and ".rda" files. Is there any easy to follow tutorial on this? (I could do some of the operations below, but I got lost in the details.) 1. Reading .rda file ? data <- load("profit.rda") # supposed to have four variable --y

[R] Dozen+ Online R Courses: $110-$150 total cost thru 9/3

2012-08-27 Thread Geoffrey Hubona
VCU faculty and non-profit Georgia R School offer 11-14 substantial (4-10 classes each) online courses using R on: Fundamentals; Graphics; Data Manipulation; Data Mining; Multivariate Statistics; PLS Path Modeling; Programming; Simulation; and more. Take until May 15, 2013 to complete as many cours

Re: [R] Changing entries of column of type "factor"/Adding a new level to a factor

2012-08-27 Thread PIKAL Petr
Hi you could save yourself time to read help page for factor > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Fridolin > Sent: Monday, August 27, 2012 12:09 PM > To: r-help@r-project.org > Subject: [R] Changing entries of colu

Re: [R] total CPU time in Matlab - what is the equivalent in R?

2012-08-27 Thread Jan Mueller
Maybe the unix time command comes in handy (provided you work with linux)? http://en.wikipedia.org/wiki/Time_(Unix) Best Jan -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von William Dunlap Gesendet: Montag, 27. August 2012 1

Re: [R] Reference classes and memory consumption

2012-08-27 Thread Jan Mueller
I found something that looks a bit odd to me: The memory consumption of reference classes seems to increase dramatically (roughly 10x in the example below) with serialization/deserialization (saveRDS() / readRDS()). Maybe creating instances of the same class has a synergy effect (references?) w

Re: [R] Standard deviation from MANOVA??

2012-08-27 Thread David Winsemius
On Aug 27, 2012, at 6:37 AM, Jean V Adams wrote: Not sure why that is. You can always use manova() to get the multivariate summary statistics and then use individual models to get predictions for each response. For example, mydata <- data.frame(y1=rnorm(50), y2=rnorm(50), x1=rnorm(50), x

Re: [R] total CPU time in Matlab - what is the equivalent in R?

2012-08-27 Thread William Dunlap
I didn't notice a discussion of what system or user time meant in those two articles. (The first correctly says that system.time() is a more convenient way to time things, as it calls proc.time() before and after your expression and subtracts. It also does garbage collection before the timing, so

Re: [R] littler and rJava

2012-08-27 Thread John Laing
Hi Dirk, Thanks for the quick reply. Setting LD_LIBRARY_PATH does the trick, so I can get by with that in my environment. I would be happy to look into potential improvements. The ./configure may work, but I installed littler through the debian package and thus bypassed manual configuration. I'll

Re: [R] for loop optimization help

2012-08-27 Thread Jinsong Zhao
On 2012-08-27 22:25, David Winsemius wrote: On Aug 27, 2012, at 1:53 AM, Jinsong Zhao wrote: On 2012-08-27 9:35, David Winsemius wrote: On Aug 26, 2012, at 5:06 PM, Jinsong Zhao wrote: Hi there, In my code, there is a for loop like the following: pmatrix <- matrix(NA, nrow = 99, ncol =

Re: [R] for loop optimization help

2012-08-27 Thread David Winsemius
On Aug 27, 2012, at 1:53 AM, Jinsong Zhao wrote: On 2012-08-27 9:35, David Winsemius wrote: On Aug 26, 2012, at 5:06 PM, Jinsong Zhao wrote: Hi there, In my code, there is a for loop like the following: pmatrix <- matrix(NA, nrow = 99, ncol = 1) qmatrix <- matrix(NA, nrow = 99, ncol

Re: [R] String Handling() for Split a word by a letter

2012-08-27 Thread jim holtman
Is this what you want: > a<- "12345_mydata" > sub("_.*", "", a) [1] "12345" On Mon, Aug 27, 2012 at 5:29 AM, Rantony wrote: > Hi, > > here im unable to run a string handle function called unpaste(). > > for eg:- a<- "12345_mydata" > Actually my requirement what is i need to get , only 12345.

Re: [R] simplest way (set of functions) to parse a file

2012-08-27 Thread jim holtman
try this: > input <- readLines(textConnection("Iteration JminError Elapsed Corral Duality Gap Step1 Step2 Step3 Step4 + 2 2 0.00e+001.912976e-031 0.00e+00 1.779780e-037.214600e-051.243600e-052.246700e-05 + ../test/genmoons_data/l

Re: [R] simplest way (set of functions) to parse a file

2012-08-27 Thread arun
Hi, I guess this helps you. library(reshape) dat1<-read.table(text=" Iteration    Jmin    Error    Elapsed    Corral    Duality_Gap    Step1    Step2    Step3    Step4 10    32    3.133476e-03    6.075853e-03    8    4.057531e-01    1.613035e-03    3.956920e-03    3.077200e-05    4.390900e-05 20

[R] Assigning colors on low p-values in table

2012-08-27 Thread Rmillan
Hi all R-users, I’m trying to assign colors on those p-value in my table output that fall above a certain critical value, let’s say a p-value >0.05. My table looks like this: Assets ADF-Level P-Value ADF-First D P-Value ADF-Se

[R] Changing entries of column of type "factor"/Adding a new level to a factor

2012-08-27 Thread Fridolin
What is a smart way to change an entry inside a column of a dataframe or matrix which is of type "factor"? Here is my script incl. input data: > #set working directory: > setwd("K:/R") > > #read in data: > input<-read.table("Exampleinput.txt", sep="\t", header=TRUE) > > #check data: > input I

[R] String Handling() for Split a word by a letter

2012-08-27 Thread Rantony
Hi, here im unable to run a string handle function called unpaste(). for eg:- a<- "12345_mydata" Actually my requirement what is i need to get , only 12345. Means that , i need the all letter as a word which is before of first " _ " - symbol of "a". i tried to do with unpaste, it says functio

[R] kernlab`s custom kernel of ksvm freeze

2012-08-27 Thread okabes
Hello, together I'm trying to use user defined kernel. I know that kernlab offer user defined kernel(custom kernel functions) in R. I used data spam including package kernlab. (number of variables=58 number of examples =4061) i'm user defined kernel's form, kp=function(d,e){ as=v*d bs=v*e cs=

[R] How to average time series data around regular intervals

2012-08-27 Thread Jason Gilmore
Hi, I'm pretty new to R and have run into a task which although I'm certain is within R's capabilities, falls outside of mine. :-) Consider the following data set: 2012-07-22 12:12:00, 21 2012-07-22 12:15:00, 22 2012-07-22 12:18:00, 24 2012-07-22 12:39:00, 21 2012-07-22 12:45:00, 25 2012-07-22 12

Re: [R] littler and rJava

2012-08-27 Thread Dirk Eddelbuettel
John, I see this: edd@max:~$ r -e'require(rJava)' Loading required package: rJava Loading required package: methods Error : .onLoad failed in loadNamespace() for 'rJava', details: call: dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared object '/usr/lib/R/site-library/rJava

Re: [R] Standard deviation from MANOVA??

2012-08-27 Thread Jean V Adams
Not sure why that is. You can always use manova() to get the multivariate summary statistics and then use individual models to get predictions for each response. For example, mydata <- data.frame(y1=rnorm(50), y2=rnorm(50), x1=rnorm(50), x2=rnorm(50), x3=rnorm(50)) myfit <- manova(cbind(y1,

[R] littler and rJava

2012-08-27 Thread John Laing
Hello list, I'm having some difficulty getting rJava to load in littler. Even after a R CMD javareconf and a reinstall of littler, I get this: jlaing@xenon:~$ r -e "require(rJava)" Loading required package: rJava Loading required package: methods Error : .onLoad failed in loadNamespace() for 'rJav

Re: [R] Error while installing gsubfn_0.6-4.tar.gz for R 2.15.1

2012-08-27 Thread Gabor Grothendieck
If the problem is the same then you still have an incomplete version of R. As you can see from the August 27th checks gsubfn works fine on the latest version of R: http://cran.r-project.org/web/checks/check_results_gsubfn.html Try installing Rcmdr. I suspect it won't install either on your ver

[R] simplest way (set of functions) to parse a file

2012-08-27 Thread Giovanni Azua
Hello, What would be the best set of R functions to parse and transform a file? My file looks as shown below. I would like to plot this data and I need to parse it into a single data frame that sorts of "transposes the data" with the following structure: > df <- data.frame(n=c(1,1,2,2),iter=c(

Re: [R] kernlab | ksvm error

2012-08-27 Thread Uwe Ligges
On 26.08.2012 15:33, Reza Salimi-Khorshidi wrote: Thanks Uwe, Am I right that in ksvm's internal cross-validation, there is no guarantee for having *at least one* of each classes in each subset? That is my guess, but I haven't read the code. Please read it yourself in case you want more det

Re: [R] if then in R versus SAS

2012-08-27 Thread peter dalgaard
On Aug 24, 2012, at 21:51 , Daniel Nordlund wrote: >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] >> On Behalf Of Marc Schwartz >> Sent: Friday, August 24, 2012 12:06 PM >> To: ramoss >> Cc: r-help@r-project.org >> Subject: Re: [R] if the

Re: [R] for loop optimization help

2012-08-27 Thread Jinsong Zhao
On 2012-08-27 9:35, David Winsemius wrote: On Aug 26, 2012, at 5:06 PM, Jinsong Zhao wrote: Hi there, In my code, there is a for loop like the following: pmatrix <- matrix(NA, nrow = 99, ncol = 1) qmatrix <- matrix(NA, nrow = 99, ncol = 3) paf <- seq(0.01, 0.99, 0.01) for (i in 1

[R] How can I find the principal components and run regression/forecasting using dynlm

2012-08-27 Thread jpm miao
Hello, I would like to write a program that compute the principal components of a set of data and then 1. Run the dependent variable against the principal components (lagged value) 2. Do prediction , following Stock and Watson (1999) "Forecasting Inflation". All data are time series.