Re: [R] Help Read File With Odd Characters

2012-11-07 Thread Prof Brian Ripley
On 08/11/2012 07:11, Lee Hachadoorian wrote: I have a large (105MB) data file, tab-delimited with a header. There are some odd characters at the beginning of the file that are preventing it from being read by R. > dfTemp = read.delim(filename) Error in make.names(col.names, unique = TRUE) : inv

[R] Help Read File With Odd Characters

2012-11-07 Thread Lee Hachadoorian
I have a large (105MB) data file, tab-delimited with a header. There are some odd characters at the beginning of the file that are preventing it from being read by R. > dfTemp = read.delim(filename) Error in make.names(col.names, unique = TRUE) : invalid multibyte string at 'm' When I view the

Re: [R] New Learner

2012-11-07 Thread Deba Ranjan
Dear sir, I am in the field of Market Research and so i need to study the data analysis for the research. But you know i am very new to the field and the R language. i don't know from where and which part i need to start. Please Experts suggest me and guide me in this R data analysis. i will

Re: [R] R + Hadoop on Amazon

2012-11-07 Thread Deba Ranjan
Dear Experts, Thanks for the Quick response, Yes i have gone through that "help.start()", but i did not understand what exactly it is. i hope might be i am very new to this field or might i did not understand well in going through. But all i know is very quite eager to learn this. i have set o

Re: [R] Absolute path in gdata library

2012-11-07 Thread Prof Brian Ripley
On 07/11/2012 23:12, Marc Schwartz wrote: On Nov 7, 2012, at 4:58 PM, r wrote: Dear list, I have some .xls files that I need to read into R. I am able to do so using read.xls in the gdata package, however the helper functions sheetNames and sheetCount fail. This is the error: Unable to open f

Re: [R] A question on "xyplot" function in Lattice package

2012-11-07 Thread Peter Ehlers
On 2012-11-07 22:37, jpm miao wrote: Hi, I am using xylot function in Lattice package. I find it excellently written, but I don't know how to find resources on this function. One thing I would like to change is the line type. To my knowledge, type ="l" means a regular line, type "g" means br

Re: [R] A question on "xyplot" function in Lattice package

2012-11-07 Thread Pascal Oettli
Hello, ?plot Regards, Pascal Le 08/11/2012 15:37, jpm miao a écrit : Hi, I am using xylot function in Lattice package. I find it excellently written, but I don't know how to find resources on this function. One thing I would like to change is the line type. To my knowledge, type ="l" mea

Re: [R] conditional coding question

2012-11-07 Thread Berend Hasselman
On 08-11-2012, at 00:07, haps wrote: > I have a big dataset. I want to create a new factor variable with certain > conditions based on two existing numeric variables. > Existing variables: indinc (range: 0 to 16), groupinc (range -3 to 5) > Conditional values that 'incorp' will take: > If groupi

[R] A question on "xyplot" function in Lattice package

2012-11-07 Thread jpm miao
Hi, I am using xylot function in Lattice package. I find it excellently written, but I don't know how to find resources on this function. One thing I would like to change is the line type. To my knowledge, type ="l" means a regular line, type "g" means broken lines, but I can't find a complete

Re: [R] Aggregate data frame across columns

2012-11-07 Thread arun
HI, For the quarterly, this may help: names(mySubset)[c(5,9)]<-c("X200509","X200706") #changed the column names to test as the subset included only first quarter data. library(reshape) dat2<-melt(mySubset) dat2$variable<-gsub("[X]","",dat2$variable) dat2$variable2<-gsub("(\\d{4}).*","\\1",dat2$va

Re: [R] Issues with Heat Map Images

2012-11-07 Thread David Winsemius
On Nov 7, 2012, at 3:31 PM, cpleisner wrote: > Hello, > I have a large data set from RNA sequencing and I am trying to make a heat > map of my data. I have am having issues formatting my heat map figure. My > data set is large with the log2 fold change for over 6oo genes across 4 > treatments.

Re: [R] problem with package development and older defs earlier in search order

2012-11-07 Thread Rolf Turner
Suggestions: (1) Work in a different directory (so that you will have a different --- initially empty) .RData file. (2) Or: Clean up the .Rdata file in the directory that you are currently using; rm(list=ls()) does this for you. Every so slightly dangerous! :-) (3) Possibly: Before doin

[R] problem with package development and older defs earlier in search order

2012-11-07 Thread Martin J Reed
Hi, I have a problem with a package I have developed in that functions do not get loaded due to older versions of the functions being in the .GlobalEnv’ fetched from .Rdata files stored from previous saved workspaces. I need to be able to fix this somehow when I load the package. I do not want

[R] Issues with Heat Map Images

2012-11-07 Thread cpleisner
Hello, I have a large data set from RNA sequencing and I am trying to make a heat map of my data. I have am having issues formatting my heat map figure. My data set is large with the log2 fold change for over 6oo genes across 4 treatments. My csv file is formatted as such: Gene

[R] conditional coding question

2012-11-07 Thread haps
I have a big dataset. I want to create a new factor variable with certain conditions based on two existing numeric variables. Existing variables: indinc (range: 0 to 16), groupinc (range -3 to 5) Conditional values that 'incorp' will take: If groupinc = 5, then ‘cons’; If groupinc is -3 : -2, AND

Re: [R] Newbie question : selecting subset of a Matrix

2012-11-07 Thread arun
Hi, Try this: wok<-read.table(text="   who  task   joe task1   joe task2   joe task3   jack task1   jack task2 ",sep="",header=TRUE,stringsAsFactors=FALSE) wok2<- wok[wok[,1]=="joe" & wok[,2]!="task2",] wok2 #  who  task #1 joe task1 #3 joe task3 A.K. - Original Message - From: "tho.

[R] Newbie question : selecting subset of a Matrix

2012-11-07 Thread thocar
I have a matrix, I would like to use it like I use where query on an SQL table Let's say my matrix is > wok who task 1 joe task1 2 joe task2 3 joe task3 4 jack task1 5 jack task2 I want to extract a matrix that contains only rows where who = "joe" and task != "task2" The result

Re: [R] save/load and package namespaces

2012-11-07 Thread Jamie Olson
Thank you! This explains the error thrown by getNamespace() for the missing package. So I imagine this will happen for any function's environment? Do you know if this should happen for S3 objects or just S4? Jamie Olson On Wed, Nov 7, 2012 at 4:10 PM, Duncan Murdoch wrote: > On 07/11/2012

Re: [R] Aggregate data frame across columns

2012-11-07 Thread arun
HI Keith, May be this helps you: library(reshape) dat2<-melt(mySubset) dat2$variable<-gsub("X(\\d{4}).*","\\1",dat2$variable) res<-do.call(cbind,lapply(split(dat2,dat2[,1]),function(x) rowSums(matrix(x[,2],nrow=nrow(mySubset)),na.rm=TRUE)))  head(res) #   2004   2005   2006   2

Re: [R] Aggregate data frame across columns

2012-11-07 Thread jim holtman
Here is one way of doing it: # get subset of the column names ss <- substring(names(mySubset), 1, 5) # create the indices of common column colIndx <- split(seq(ncol(mySubset)), ss) rSums <- lapply(colIndx, function(x) rowSums(mySubset[, x], na.rm = TRUE)) # create dataframe newResult <- as.data.fr

Re: [R] save/load and package namespaces

2012-11-07 Thread Duncan Murdoch
On 12-11-07 6:20 PM, Jamie Olson wrote: Thank you! This explains the error thrown by getNamespace() for the missing package. So I imagine this will happen for any function's environment? Do you know if this should happen for S3 objects or just S4? It should only happen for objects that have

Re: [R] Absolute path in gdata library

2012-11-07 Thread David Winsemius
On Nov 7, 2012, at 2:58 PM, r wrote: > Dear list, > I have some .xls files that I need to read into R. I am able to do so > using read.xls in the gdata package, however the helper functions > sheetNames and sheetCount fail. This is the error: > > Unable to open file '~/SharedFolder/MyData/mydat

Re: [R] Aggregate data frame across columns

2012-11-07 Thread Keith Weintraub
Arun, Jeff, Bert, Thanks for your help. I have put a subset of my data below in mySubset. I would like to be able to sum the rows by year. In this case the results would be the result data.frame below. How can I automate something like this and how would I do it quarterly if necessary. The

Re: [R] Absolute path in gdata library

2012-11-07 Thread Marc Schwartz
On Nov 7, 2012, at 4:58 PM, r wrote: > Dear list, > I have some .xls files that I need to read into R. I am able to do so > using read.xls in the gdata package, however the helper functions > sheetNames and sheetCount fail. This is the error: > > Unable to open file '~/SharedFolder/MyData/mydat

[R] Absolute path in gdata library

2012-11-07 Thread r
Dear list, I have some .xls files that I need to read into R. I am able to do so using read.xls in the gdata package, however the helper functions sheetNames and sheetCount fail. This is the error: Unable to open file '~/SharedFolder/MyData/mydata.xls'. Warning: running command ''/usr/bin/perl' '

Re: [R] Calling R object from R function

2012-11-07 Thread R. Michael Weylandt
On Wed, Nov 7, 2012 at 6:40 PM, Fares Said wrote: > Hi Michael, > > Can you explain more please why it want return an error? > > vectx and vectz just a vector of columns index I change them when ever is > required so I want use them at the begin of my get.m function before I do > the resampling.

Re: [R] extract indep vars from formula

2012-11-07 Thread Bert Gunter
...perhaps ?all.vars as in > form <- y~x+z > all.vars(form) [1] "y" "x" "z" > all.vars(form)[-1] [1] "x" "z" -- Bert On Wed, Nov 7, 2012 at 2:03 PM, Alexander Shenkin wrote: > Hello, > > I'm trying to extract the independent variables from a formula. The > closest I've been able to come,

Re: [R] extract indep vars from formula

2012-11-07 Thread Marc Schwartz
On Nov 7, 2012, at 4:03 PM, Alexander Shenkin wrote: > Hello, > > I'm trying to extract the independent variables from a formula. The > closest I've been able to come, aside from rolling my own, is the following: > >> a = y ~ b * x >> attr(terms(formula(a)),"variables") > > The reason I'm do

Re: [R] extract indep vars from formula

2012-11-07 Thread Ista Zahn
Hi, On Wed, Nov 7, 2012 at 5:03 PM, Alexander Shenkin wrote: > Hello, > > I'm trying to extract the independent variables from a formula. This is somewhat ambiguous. Do you want the actual columns of values? The quoted variable names? Including the interaction term or not? If you just want the q

Re: [R] how to generate a set of random numbers that sum to 1 with uniform distribution of elements

2012-11-07 Thread Greg Snow
The Dirichlet distribution will give values that sum to one and with the correct conditions will have uniform margins. There are multiple packages that will generate data from Dirichlet distributions, either gtools or gmodels is one of them, but there are others as well. On Wed, Nov 7, 2012 at 6

[R] extract indep vars from formula

2012-11-07 Thread Alexander Shenkin
Hello, I'm trying to extract the independent variables from a formula. The closest I've been able to come, aside from rolling my own, is the following: > a = y ~ b * x > attr(terms(formula(a)),"variables") The reason I'm doing this is that I'm building a grid of points that I use to construct a

Re: [R] LiblineaR: accept sparse matrices

2012-11-07 Thread Ben Bolker
Sam Steingold gnu.org> writes: > > Thibault, > > It would be nice if LiblineaR() accepted data in the form of a sparse > matrix (it does not accept whatever e1071::read.matrix.csr returns). > > It would also be nice if there were functions to read/write files in the > native liblinear file for

Re: [R] Executing SAS Codes in R

2012-11-07 Thread Ista Zahn
On Wed, Nov 7, 2012 at 4:03 PM, Rolf Turner wrote: > On 08/11/12 09:09, peter dalgaard wrote: >> >> On Nov 7, 2012, at 19:34 , Bert Gunter wrote: >> >>> I certainly hope not! >> >> fortune("reverse the procedure") >> > > See also fortune("SAS to R parser"). Yes, all delightful and amusing! But pe

Re: [R] how to generate a set of random numbers that sum to 1 with uniform distribution of elements

2012-11-07 Thread David L Carlson
It sounds like you are trying to generate a uniform distribution on the simplex (e.g. compositional analysis where the values represent the proportion of each constituent in the whole). If so, you probably want the compositions package. Here's a simple example with just 3 parts so we can plot the r

[R] fdrtool

2012-11-07 Thread Wang, Li
Dear list members: I am using the package fdrtool to calculate qval from my input p values. My input pvalue ranged from 0.5-0. And the result I got for qval and lfdr are all much less than 0.01, I feel very confused about the result. The command used there is very easy: fdrtool(pvalue, statisti

Re: [R] c weirdness

2012-11-07 Thread William Dunlap
Or use [[ instead of [ (assuming you are only selecting one item) > tab <- table(c(16,16,17,17,17)) > c(n=1, seed=tab[2]) n seed.17 1 3 > c(n=1, seed=unname(tab[2])) n seed 13 > c(n=1, seed=tab[[2]]) n seed 13 > c(n=1, seed=tab[["17"]]) n seed 13 Bi

Re: [R] c weirdness

2012-11-07 Thread William Dunlap
Your example doesn't work here - you didn't show what 'tab' was. Perhaps it was an output of table: > tab <- table(c(16,16,17,17,17)) > c(n=1, seed=tab[2]) n seed.17 1 3 > c(n=1, seed=unname(tab[2])) n seed 13 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com >

[R] on Rclusterpp package usage

2012-11-07 Thread Antonio Silva
Hello I have a large dataset to make a cluster analysis and I'm trying to use Rclusterpp to do so. Nevertheless in a sample matrix analysis (see http://dl.dropbox.com/u/755659/gillnet.txt) I'm getting different results from Rclusterpp and hclust. Following the example from "An Introduction to Rc

Re: [R] plm(): observations not used for modelling

2012-11-07 Thread David Winsemius
Restoring some context: DB wrote: > >> The fuction plm only uses 286 of these observations (also if the model is >> changed to first differences and the effect to individual) and omits 23 >> observations due to na.action, but in my dataset they do not contain NAs. >> Is this due to the Transforma

Re: [R] save/load and package namespaces

2012-11-07 Thread Duncan Murdoch
On 07/11/2012 12:50 PM, Jamie Olson wrote: Could someone explain to me what namespaces are loaded/saved when objects are saved? None are loaded or saved when you save the object, but the names of some are saved. For example, library(Hmisc) # not normally loaded/attached x <- zoom # copy a

Re: [R] sample from list

2012-11-07 Thread Jean V Adams
Ben, Can you provide a small example data set for inds so that we can run the code you have supplied? It's difficult for me to follow what you've got and where you're trying to go. Jean "Benjamin Ward (ENV)" wrote on 11/06/2012 03:29:52 PM: > > Hi all, > > I have a list of genes p

[R] A warning message in glht

2012-11-07 Thread Yuliia Aloshycheva
Dear all, I was wondering if you could give me any suggestions/help on the following issue. So I carried out the analysis of my data using generalized linear model (glm). After that, to check for multiple comparisons, I applied the glht function from the multcomp package in R. The output, however,

Re: [R] RMySQL install on windows

2012-11-07 Thread sbarandiaran
Hi, I've followed these steps: I set the MYSQL_HOME environmental variable like this: "c:\PROGRA~1\MySQL\MYSQLS~1.5", then I opened a command prompt, got to the folder that contains the "RMySQL_0.9-3.tar.gz" file, and run the command: "c:\Program Files\R\R-2.15.1\bin\x64\R" CMD INSTALL RMySQL

Re: [R] plm(): observations not used for modelling

2012-11-07 Thread Daniel Bab.
Thank you for your help. That's an interesting point, I haven't thought about that. Altough I would find it strange that I get a model, where just some observations are missing, if the problem is due to invalid variable names. That's the first thing I will try to change. -- View this message in

Re: [R] Executing SAS Codes in R

2012-11-07 Thread Rolf Turner
On 08/11/12 09:09, peter dalgaard wrote: On Nov 7, 2012, at 19:34 , Bert Gunter wrote: I certainly hope not! fortune("reverse the procedure") See also fortune("SAS to R parser"). cheers, Rolf __ R-help@r-project.org mailing list htt

Re: [R] Executing SAS Codes in R

2012-11-07 Thread David Winsemius
On Nov 7, 2012, at 10:34 AM, Bert Gunter wrote: > I certainly hope not! > > There are of course many resources on "R for SAS users" and the like. One could even think of R-help as a distributed support group for recovering-SAS-users. > > -- Bert > > On Wed, Nov 7, 2012 at 10:24 AM, Peter M

Re: [R] c weirdness

2012-11-07 Thread Duncan Murdoch
On 07/11/2012 3:53 PM, Sam Steingold wrote: is there a way to avoid c() appending ".0" and ".1" to seed? Don't give it a named vector. You can use the unname() function to strip the names from tab: c("nons"=1, "seed"=unname(tab[1])) --8<---cut here---start-

[R] LiblineaR: accept sparse matrices

2012-11-07 Thread Sam Steingold
Thibault, It would be nice if LiblineaR() accepted data in the form of a sparse matrix (it does not accept whatever e1071::read.matrix.csr returns). It would also be nice if there were functions to read/write files in the native liblinear file format; I am sure the original liblinear library prov

Re: [R] save/load and package namespaces

2012-11-07 Thread David Winsemius
On Nov 7, 2012, at 9:50 AM, Jamie Olson wrote: > Could someone explain to me what namespaces are loaded/saved when objects > are saved? None. That's what require() or library() or source() are for. > > Specifically, I'm using this: > save(list = ls(all.names = TRUE, envir = envir), file = name

[R] c weirdness

2012-11-07 Thread Sam Steingold
is there a way to avoid c() appending ".0" and ".1" to seed? --8<---cut here---start->8--- > c("nons"=1, "seed"=3) nons seed ## good! 13 > c("nons"=1, "seed"=tab[1]) nons seed.0 ## don't want ".0"! 1 2344600

Re: [R] Can you turn a string into a (working) symbol?

2012-11-07 Thread Greg Snow
Others have shown you ways to do what you asked, and what you asked happens to also be FAQ 7.22 (but with terms different enough that that FAQ is not obvious). However the solutions that you are tending towards are running into the problems addressed in fortune(106) and fortune(236), the solutions

Re: [R] save/load and package namespaces

2012-11-07 Thread Jeff Newmiller
Stop being surprised. Loaded packages are not part of "envir" (whatever that is), nor are they part of the global environment. You have to reload any packages needed separately from the load call. --- Jeff Newmiller

[R] rJava not loading on Windows

2012-11-07 Thread Henrik Bengtsson
Hi, I've successfully used it on a Linux setup, but when I try to load rJava on Windows 7 64-bit (session info below) I get: % R --vanilla > library("rJava") Error : .onLoad failed in loadNamespace() for 'rJava', details: call: dirname(this$RuntimeLib) error: a character vector argument expec

Re: [R] pivot table

2012-11-07 Thread farnoosh sheikhi
I'm using Revolution R Enterprise. This command worked perfectly. Thank you so much for your help and time:-)   Best,Farnoosh Sheikhi Cc: R help Sent: Wednesday, November 7, 2012 10:47 AM Subject: Re: [R] pivot table HI, Could you tell me which version of R

[R] customizing asix in xyplot in lattice

2012-11-07 Thread Kris Jaeger
Hello, I have a time series dataset in long format (15 minute data over approximately 2 years). The data set is composed of time series of multiple sensors; much of the time series are duplicate dates and times, but of different lengths. I can plot the data converting the datetime to as.numeric,

Re: [R] Executing SAS Codes in R

2012-11-07 Thread peter dalgaard
On Nov 7, 2012, at 19:34 , Bert Gunter wrote: > I certainly hope not! fortune("reverse the procedure") > > There are of course many resources on "R for SAS users" and the like. > > -- Bert > > On Wed, Nov 7, 2012 at 10:24 AM, Peter Maclean wrote: >> Is there a way of executing SAS codes in

Re: [R] how to generate a set of random numbers that sum to 1 with uniform distribution of elements

2012-11-07 Thread David Winsemius
On Nov 7, 2012, at 10:48 AM, Albyn Jones wrote: > What uniform distribution do you want for the columns? The average > value of X_k given \sum X_i = 1 must be 1/n. If you start with > X_i ~ U(0,1), the result must be skewed. > > If you generate X_i uniformly distributed on (0, 2/n), the condi

Re: [R] HELP! Excel and R give me totally different regression results using the exact same data

2012-11-07 Thread frauke
Okay. Sorry for being vague in my earlier message. I had missed a few lines from your message because they were hiding well in my own email. I am really on the learning side with this, so it will take some time. Sorry. There seem to be two issues: (1) Me preparing the data incorrectly and (2) the

Re: [R] row index for max values of row groups

2012-11-07 Thread William Dunlap
Note that the unlist(tapply()) algorithm depends on the groups column being in order. Here is one that works no matter how the data frame is ordered. > which( with(df1, {tmp <- logical(length(groups)) ; split(tmp, groups) <- lapply(split(values, groups), function(x)x==max(x)) ; tmp})) [1] 4

Re: [R] row index for max values of row groups

2012-11-07 Thread Rui Barradas
Hello, Though my function is equal to Arun's, it's wrapped by a different way of returning the index. which(unlist(tapply(df1$values, df1$groups, FUN=function(x) x == max(x Hope this helps, Rui Barradas Em 07-11-2012 18:54, arun escreveu: Hi, One method will be: row.names(df1[unlist(ta

Re: [R] how to generate a set of random numbers that sum to 1 with uniform distribution of elements

2012-11-07 Thread Heramb
This is a modified code if it helps. Matrix=function(n,simulations){Tab=cbind(runif(n,0,1)) for(i in 2:simulations) {x=NULL for(j in 1:n) {x=c(x,runif(1,0,1-sum(Tab[j,]

Re: [R] Executing SAS Codes in R

2012-11-07 Thread Bert Gunter
I certainly hope not! There are of course many resources on "R for SAS users" and the like. -- Bert On Wed, Nov 7, 2012 at 10:24 AM, Peter Maclean wrote: > Is there a way of executing SAS codes in R environment? > > > Peter Maclean > Department of Economics > UDSM > [[alternative HTML v

Re: [R] pivot table

2012-11-07 Thread farnoosh sheikhi
Hi there, Thanks forhelping. I really appreciate it. The only thing is I get this error: "Error in gsub("[\\_]", ".", paste0("Lab", colnames(res2)[-1])) :    could not find function "paste0"" Thanks.   Best,Farnoosh Sheikhi Cc: R help Sent: Tuesday, November

Re: [R] R + Hadoop on Amazon

2012-11-07 Thread Jamie Olson
I've been using Amazon Elastic Mapreduce combined with RHadoop with great success. The only real problem is that the default JAVA_HOME doesn't points to a jdk that works with rJava, so you have to correct it. I've been meaning to do a writeup on it and will update you once it's up. Jamie Olson

[R] times-series HLM in R

2012-11-07 Thread Nita Umashankar
Hello, If you have any advice on how to code a time-series HLM model in R? The code I have right now is: glmer(sale ~ agent_techmc*CultDistmc + ismc*CultDistmc + contactsmc*CultDistmc + pfmc + warranty + engineering_diff_res + Cust_internet + Cust_mobility_mobile + durationmc + (1| JOURNALTE

Re: [R] save/load and package namespaces

2012-11-07 Thread Jamie Olson
Could someone explain to me what namespaces are loaded/saved when objects are saved? Specifically, I'm using this: save(list = ls(all.names = TRUE, envir = envir), file = name, envir = envir) to save out everything from an environment. Later, loading it on another machine, I'm surprised to see t

Re: [R] how to generate a set of random numbers that sum to 1 with uniform distribution of elements

2012-11-07 Thread Heramb
Hi, This is a humble try. Matrix=function(n){Tab=cbind(runif(n,0,1)) for(i in 2:n) {x=NULL for(j in 1:n) {x=c(x,runif(1,0,1-sum(Tab[j,])))} Tab=cbind(Tab,x) } T

Re: [R] row index for max values of row groups

2012-11-07 Thread arun
Hi, One method will be: row.names(df1[unlist(tapply(df1$values,df1$groups,FUN=function(x) x==max(x))),]) #[1] "4"  "8"  "11" #or row.names(df1[as.logical(ave(df1$values,df1$groups,FUN=function(x) x==max(x))),]) #[1] "4"  "8"  "11" A.K. - Original Message - From: Omphalodes Verna To: "

Re: [R] how to generate a set of random numbers that sum to 1 with uniform distribution of elements

2012-11-07 Thread Albyn Jones
What uniform distribution do you want for the columns? The average value of X_k given \sum X_i = 1 must be 1/n. If you start with X_i ~ U(0,1), the result must be skewed. If you generate X_i uniformly distributed on (0, 2/n), the conditional distribution given the sum is 1 will be less skewed.

Re: [R] Executing SAS Codes in R

2012-11-07 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Peter Maclean > Sent: Wednesday, November 07, 2012 10:25 AM > To: R mailing list > Subject: Re: [R] Executing SAS Codes in R > > Is there a way of executing SAS codes in R enviro

Re: [R] pivot table

2012-11-07 Thread arun
HI, Could you tell me which version of R you are using?  I guess paste0() works from >R.2.14. YOu can use instead: colnames(res1)[-1]<-gsub("[\\_]",".",paste("Lab",colnames(res1)[-1],sep="")) res1 #  ID Lab1.A Lab1.N Lab2.N Lab3.N #1  a  1  1  1  0 #2  b  1  0  0 

Re: [R] Aggregate data frame across columns

2012-11-07 Thread arun
HI, Forgot about the 2nd part (by quarter): set.seed(1) dat2<-data.frame(matrix(sample(10:250,96,replace=TRUE),ncol=24)) names(dat2)<-c(paste0("2004",paste0("0",1:9),sep=""),paste0("2004",10:12),paste0("2005",paste0("0",1:9),sep=""),paste0("2005",10:12)) library(reshape) dat3<-melt(dat2) dat4<-wit

[R] row index for max values of row groups

2012-11-07 Thread Omphalodes Verna
Dear list members! I am looking for ''nice solution'' for (maybe) simple problem. I need a code (small program) to calculate row index for max value (example below: df1$values) by groups (example below: df1$groups). df1 <- data.frame( groups = c(1,1,1,1,1,2,2,2,3,3,3,3), values = c(1,1,1,2,1,1,2,

Re: [R] Excel Regression Function

2012-11-07 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Paul Bernal > Sent: Wednesday, November 07, 2012 10:17 AM > To: frauke; r-help@r-project.org > Subject: [R] Excel Regression Function > > Dear Frauke, good afternoon, > > Could

Re: [R] R: net reclassification index after Cox survival analysis

2012-11-07 Thread David Winsemius
On Nov 7, 2012, at 9:59 AM, petre...@unina.it wrote: > Thanks to David Winsemius for the replay. i use the latest update of Hmisc > package and I try as reported in the example: > > set.seed(1) > library(survival) > x1 <- rnorm(400) > x2 <- x1 + rnorm(400) > d.time <- rexp(400) + (x1 - min(x1))

Re: [R] Calling R object from R function

2012-11-07 Thread R. Michael Weylandt
On Wed, Nov 7, 2012 at 3:31 PM, frespider wrote: > Hi, > > Can you please help me with this please? > > What I am trying to do is call a vector from R function and used in the new > function > > So I create 4 functions with these arguments > M11 <- function(TrainData,TestData,mdat,nsam) { > ls <-

Re: [R] Executing SAS Codes in R

2012-11-07 Thread Peter Maclean
Is there a way of executing SAS codes in R environment?   Peter Maclean Department of Economics UDSM [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the postin

[R] Excel Regression Function

2012-11-07 Thread Paul Bernal
Dear Frauke, good afternoon, Could you tell me which excel function didnt work for regression analysis and what excel version where you using? Best regards, Paul El 07/11/2012 11:55, "frauke" escribió: > Hi David, hi Rui, > > thanks for your quick replies. I have replicated David's R results a

Re: [R] HELP! Excel and R give me totally different regression results using the exact same data

2012-11-07 Thread David Winsemius
On Nov 7, 2012, at 8:53 AM, frauke wrote: > Hi David, hi Rui, > > thanks for your quick replies. I have replicated David's R results and > confirmed them with Minitab. Though I'm not sure what you are trying to tell > me with the code you wrote, David. Do you mean, I should use a dataframe > rat

Re: [R] Aggregate data frame across columns

2012-11-07 Thread Jeff Newmiller
The best way to get an answer is to provide sample data and desired results (computed by hand or by any other available means). See http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example. In the vague question begets a vague answer department, I would use melt fr

Re: [R] Aggregate data frame across columns

2012-11-07 Thread arun
HI, Without data, it is a bit hard to know how your data looks like.  Anyway, try this: set.seed(1) dat2<-data.frame(matrix(sample(10:150,50,replace=TRUE),ncol=10)) names(dat2)<-c(paste0("20040",1:4),paste0("20050",1:3),paste0("20080",1:3)) library(reshape) dat3<-melt(dat2) dat3$variable<-gsub(

[R] save/load and package namespaces

2012-11-07 Thread Jamie Olson
Could someone explain to me what namespaces are loaded/saved when objects are saved? Specifically, I'm using this: save(list = ls(all.names = TRUE, envir = envir), file = name, envir = envir) to save out everything from an environment. Later, loading it on another machine, I'm surprised to see t

Re: [R] R: net reclassification index after Cox survival analysis

2012-11-07 Thread petretta
Thanks to David Winsemius for the replay. i use the latest update of Hmisc package and I try as reported in the example: set.seed(1) library(survival) x1 <- rnorm(400) x2 <- x1 + rnorm(400) d.time <- rexp(400) + (x1 - min(x1)) cens <- runif(400,.5,2) death <- d.time <= cens d.time <- pmin(d.tim

[R] Calling R object from R function

2012-11-07 Thread frespider
Hi, Can you please help me with this please? What I am trying to do is call a vector from R function and used in the new function So I create 4 functions with these arguments M11 <- function(TrainData,TestData,mdat,nsam) { ls <- list() I have few statments one of them is vectx <- c(,1,2,3,4,5,

[R] Welch Two Sample T-Test

2012-11-07 Thread cosworth201
I know when I enter this into R: > x = c(15, 10, 13, 7, 9, 8, 21, 9, 14, 8) > y = c(15, 14, 12, 8, 14, 7, 16, 10, 15, 12) > t.test(x,y,alt="less",var.equal=TRUE) it shows: Two Sample t-test data: x and y t = -0.5331, df = 18, p-value = 0.3002 alternative hypothesis: true difference in

[R] Annotation using org.At.tair.db package in R

2012-11-07 Thread stace
Iam using R version 2.15 in a linux operating system. I have a matrix consisting of the gene ids and their specific signal intensity values as follows( a subset of the whole matrix) : probes GSM362180GSM362181 GSM362188GSM362189 GSM362192 244901 5.094871713 4.626623079 4.55427

[R] error message no lines available in input

2012-11-07 Thread Katrin Heimann
Dear all, a program that worked well for weeks today gave me consistently the error message no lines available in input referring to the lines for (i in (0:(timeintervals-1))) { j=subjectquantity+6+i*(subjectquantity+7) print (j) results<-read.table(file, header=F, skip=j, nrows=

Re: [R] Survplot, Y-axis in percent

2012-11-07 Thread maziar.mohaddes
Dear Prof Harell, great thanks for your solution to this. I have been trying to figure this out last four weeks by reading loads of manuals and forums around the net without success. Once again thank you for the solution and the great option of shadowed Conf int in the survplot Best Regards --

[R] connecting R & eclipse problem

2012-11-07 Thread sagarnikam123
i am connecting R 2.15 with Eclipse IDE 3.7,using [StatET] -: http://www.walware.de/ i have installed rjava,rj-1.1,rj.gd-1.1,installed new software "StatET 3.0-3.1" in eclipse ,etc as prerequisite, i done all procedure as per eclipse says(Configure & Launch R console panel),but at end,when configur

[R] how to generate a set of random numbers that sum to 1 with uniform distribution of elements

2012-11-07 Thread Bärbel
Hi, I am looking for a way to generate a matrix of random numbers in a way that each row of the matrix would sum to 1 and that the numbers in the columns of the matrix would have a uniform distribution. So far I have found several ways to create random numbers that would sum to 1, but then the dist

Re: [R] Aggregate data frame across columns

2012-11-07 Thread Bert Gunter
Have you read the Introduction to R tutorial? This is discussed there, I believe. If you have not, please do so before posting here further. But ... ?tapply ?aggregate ?ave Also the plyr package for "user-friendlier" approaches. -- Bert On Wed, Nov 7, 2012 at 9:32 AM, Keith Weintraub wrote: >

[R] Aggregate data frame across columns

2012-11-07 Thread Keith Weintraub
Folks, I have a data frame with columns 200401, 200402, ..., 201207, 201208. These represent years/months. What would be the best way to sum these columns by year? What about by quarter? Thanks for your time, KW -- [[alternative HTML version deleted]] __

Re: [R] R: net reclassification index after Cox survival analysis

2012-11-07 Thread David Winsemius
On Nov 7, 2012, at 6:54 AM, petre...@unina.it wrote: > Dear all, > > I am interested to evaluate reclassification using net > reclassification improvement and Integrated Discrimination Index IDI after > survival analysis (Cox proportional hazards using stcox). I search a R > package or a R code

Re: [R] pseudo R-squared with likfit (geoR)

2012-11-07 Thread Bert Gunter
... and you might also wish to try the R-sig-geo list, for obvious reasons. -- Bert On Wed, Nov 7, 2012 at 9:01 AM, Marion Jacquot wrote: > We want to compute a pseudo R-squared for a model whose parameter > estimation was based on maximum likelihood (function likfit, package geoR). > I tried to

Re: [R] pseudo R-squared with likfit (geoR)

2012-11-07 Thread Bert Gunter
This is basically a statistics question, despite the fact that you refer to an R implementation. You should therefore probably post on a statistics list, like stats.stackexchange.com, especially the part about asking for alternative R^2. -- Bert On Wed, Nov 7, 2012 at 9:01 AM, Marion Jacquot wro

[R] pseudo R-squared with likfit (geoR)

2012-11-07 Thread Marion Jacquot
We want to compute a pseudo R-squared for a model whose parameter estimation was based on maximum likelihood (function likfit, package geoR). I tried to compute the R2 proposed by Maddala (1983) which compare the maximized likelihood for the model without any predictor and the maximized likeliho

[R] generic question about differences between PCA and DMFA

2012-11-07 Thread Guido Leoni
Dear list I'd like to have your opinion about my case study. I'm analizing a dataset of 9 experiments and 15 variables with the aim to highlight the variables that can majorly explain the variance between the experiments. This is an example with only 3 rows and 5 variables

Re: [R] HELP! Excel and R give me totally different regression results using the exact same data

2012-11-07 Thread frauke
Hi David, hi Rui, thanks for your quick replies. I have replicated David's R results and confirmed them with Minitab. Though I'm not sure what you are trying to tell me with the code you wrote, David. Do you mean, I should use a dataframe rather than a matrix, or use the "data=" part of the lm() f

Re: [R] a simple list question

2012-11-07 Thread William Dunlap
And the ls()[grep("^x\\.[[:digit:]]+$", ls())] can be simplified to grep("^x\\.[[:digit:]]+$", ls(), value=TRUE) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of

Re: [R] a simple list question

2012-11-07 Thread David L Carlson
Combining your, Rolf, and Michael's suggestions makes it possible to eliminate the lappy(): mget(ls()[grep("^x\\.[[:digit:]]+$", ls())], .GlobalEnv) -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4

  1   2   >