[R] relative L1 bound

2012-03-25 Thread yx78
In the package lasso2, there is a Prostate Data. To find coefficients in the prostate cancer example we could impose L1 constraint on the parameters. code is: data(Prostate) p.mean <- apply(Prostate, 5,mean) pros <- sweep(Prostate, 5, p.mean, "-") p.std <- apply(pros, 5, var) pros <- sweep(pr

[R] Simple question regarding domain restrictions/piecewise functions in R

2012-03-25 Thread chad.mills
I am a novice R user. I would like to be able to graph some simple piecewise functions/functions with domain restrictions in R, but I'm having trouble defining such functions. For example, I would like to define the following function: f(x)={x^2 if -1http://r.789695.n4.nabble.com/Simple-question

[R] The problem of using library(bigmemory)

2012-03-25 Thread yeheng...@gmail.com
To my understanding, library(bigmemory) should allow us to create a matrix larger than 2GB (say 17,000 by 17,000) by temporarily storing the data on harddisk. But I try the following codes to create such a matrix. library(bigmemory) A <- big . matrix (17000 , 17000 , type ="double", init = 0)

[R] row, col function but for a list (probably very easy question, cannot seem to find it though)

2012-03-25 Thread MBoersma
Hi guys, I'm quite new to R but quite enthousiastic. I'm trying to rewrite a bit of code in order to make it faster, so instead of nesting for loops I'm trying some apply functions. Since it's a combination of lists of matrices and other matrices, I would like to use lapply() on the list and still

[R] Re : ROC Analysis

2012-03-25 Thread Pascal Oettli
Hi Camille, Probably you have to check wether there is any infinte value in x. Or calculate something like that for your x-axis: x[1:(ll-1)]+diff(x)/2 Regards, Pascal - Mail original - De : Camille Leclerc À : r-help@r-project.org Cc : Envoyé le : Lundi 26 mars 2012 0h32 Objet : Re:

[R] sm.density kernel estimation for points

2012-03-25 Thread Matěj Plch
Hi! I have two dimensional dataset which has and I need to decide if a point lies in some "confidence level". If a point has low confidence/density it can be anomaly which I need to find. For example: #load library library(sm) #get some data x.locs = c(74, 74.5, 75, 77,74.5) y.locs = c(64, 63

Re: [R] Multivariate function from univariate functions

2012-03-25 Thread physicistintheory
Petr, thanks! I've now got a function I can work with. Regards! -- View this message in context: http://r.789695.n4.nabble.com/Multivariate-function-from-univariate-functions-tp4502670p4504599.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] How to test omitted level from a multiple level factor against overall mean in regression models?

2012-03-25 Thread Rolf Turner
The test you are requesting is ***MEANINGLESS***. The ``effect value'' of a single level is ill-defined (or in the more usual parlance, "not estimable"). The dummy.coef() procedure suggested by Gabor gives you point estimates *subject to the constraints* imposed by the contrasts used. The c

[R] Updating a Markov Chain

2012-03-25 Thread stivi
Hello, my question is if anyone has any good ideas how to create a Markov Chain from ordered data. So, I have some sort of time series, and if value1 happens as time1 and value2 happens at time2 I record this as an update to the probability transition matrix. The problem is that I cannot predefine

[R] What does "package 'RDCOMClient' is not installed for 'arch=x64' " exactly mean?

2012-03-25 Thread dthomas
Hi, I'm trying to use the excel.link package to write data to excel spreadsheets. I've installed the RDCOMClient package as required but get the error: package 'RDCOMClient' is not installed for 'arch=x64' I'm on Rx64 2.13.0. I assume it means the RDCOMClient package does not work on the x64 ve

Re: [R] R Error : DATA to MATRIX

2012-03-25 Thread David Winsemius
On Mar 25, 2012, at 2:43 PM, ritwi...@isical.ac.in wrote: Thanks David, your suggestion works fine.btw I have another question..If I set (n,m) little bit large, say (n=20,m=10), R cannot handle the large data frame generated through "expand.grid".Is there any way to increase R-m

Re: [R] reading header in txt file and making histogram

2012-03-25 Thread chuck.01
dbh is the column name. What is the name of your data? Lets assume your data is called "YOUR_DATA" then try: with(YOUR_DATA, hist(dbh)) OR hist(YOUR_DATA$dbh) OR hist(YOUR_DATA[, "dbh"]) etc... bamboohydraulics wrote > > Dear all > > I am a BEGINNER and have R on my Mac. I saved my

Re: [R] Problem reading mixed CSV file

2012-03-25 Thread Ashish Agarwal
thanks. works very well. On Mon, Mar 26, 2012 at 12:12 PM, Berend Hasselman wrote: > > On 26-03-2012, at 08:40, Ashish Agarwal wrote: > > > comment.char = NULL does not work. > > Is there any way to make it NULL rather than having a specific character > like '%'? > > > Why don't you try somethin

Re: [R] Problem reading mixed CSV file

2012-03-25 Thread Berend Hasselman
On 26-03-2012, at 08:33, Ashish Agarwal wrote: > OMG. > > I think it uses comment character # as default in the argument. > > comment.char = "#" > > How do I turn it off? ??? How about comment.car="%" for example? Berend __ R-help@r-project.org

Re: [R] Problem reading mixed CSV file

2012-03-25 Thread Berend Hasselman
On 26-03-2012, at 08:40, Ashish Agarwal wrote: > comment.char = NULL does not work. > Is there any way to make it NULL rather than having a specific character like > '%'? > Why don't you try something? comment.char="" looks quite obvious and worth a try. Berend _

Re: [R] Problem reading mixed CSV file

2012-03-25 Thread Ashish Agarwal
comment.char = NULL does not work. Is there any way to make it NULL rather than having a specific character like '%'? On Mon, Mar 26, 2012 at 12:06 PM, Berend Hasselman wrote: > > > comment.char = "#" > > > > How do I turn it off? > ??? > > How about comment.car="%" for example? > > Berend > >

Re: [R] Problem reading mixed CSV file

2012-03-25 Thread Berend Hasselman
On 26-03-2012, at 08:26, Berend Hasselman wrote: > > On 26-03-2012, at 08:16, Ashish Agarwal wrote: > >> Why does the output in the following say 2 and not 6? >> >>> count.fields(textConnection("LL1532Ap,ABC# Depot-A+,,1971,8,2 >> + LL1532Ap,ABC# Depot-A+,Bhutan,1971,6,1 >> + LL1532Ap,ABC# Dep

Re: [R] Problem reading mixed CSV file

2012-03-25 Thread Ashish Agarwal
OMG. I think it uses comment character # as default in the argument. comment.char = "#" How do I turn it off? On Mon, Mar 26, 2012 at 11:56 AM, Berend Hasselman wrote: > > On 26-03-2012, at 08:16, Ashish Agarwal wrote: > > > Why does the output in the following say 2 and not 6? > > > >> count

Re: [R] Problem reading mixed CSV file

2012-03-25 Thread Berend Hasselman
On 26-03-2012, at 08:16, Ashish Agarwal wrote: > Why does the output in the following say 2 and not 6? > >> count.fields(textConnection("LL1532Ap,ABC# Depot-A+,,1971,8,2 > + LL1532Ap,ABC# Depot-A+,Bhutan,1971,6,1 > + LL1532Ap,ABC# Depot-A+,China,1971,17,1 > + LL1532Ap,ABC# Depot-A+,China,1971,33

Re: [R] Problem reading mixed CSV file

2012-03-25 Thread Ashish Agarwal
Why does the output in the following say 2 and not 6? > count.fields(textConnection("LL1532Ap,ABC# Depot-A+,,1971,8,2 + LL1532Ap,ABC# Depot-A+,Bhutan,1971,6,1 + LL1532Ap,ABC# Depot-A+,China,1971,17,1 + LL1532Ap,ABC# Depot-A+,China,1971,33,1 + LL1532Ap,ABC# Depot-A+,HongKong,1971,16,2 + LL1532Ap,AB

[R] trellis plot

2012-03-25 Thread Sebastián Daza
Hi everyone, I am just trying to figure out how to do a xyplot where in addition to dots and lines I can change dots' colors according to an individual variable (e.g., marital disruption across time, a dummy 0/1). When I use "groups" specification (see below), I get two different lines for each in

Re: [R] Seeming failure of options(width=60)

2012-03-25 Thread Yihui Xie
I got an error message: > options(width=60) > pastured <- data.frame( + time=c(9, 14, 21, 28, 42, 57, 63, 70, 79), + yield= c(8.93, 10.8, 18.59, 22.33, 39.35, + 56.11, 61.73, 64.62, 67.08)) > regmod<-"yield ~ t1 - t2*exp(-exp(t3+t4*log(time)))" > huetstart<-c(t1=70, t2=60, t3=0, t4=1) > an

Re: [R] Struggling with zoo and aggregate

2012-03-25 Thread Thomas Adams
Gabor, Thank you for your help -- it did help me a lot. However, with my data: lead_time cycler_squared fcst_date 1 6 0 5.405095e-02 07/31/2010 2 12 0 5.521620e-06 07/31/2010 3 18 0 1.565910e-04 07/31/2010 4 24 0 8.646822e-02 07/31/2010 5

[R] Seeming failure of options(width=60)

2012-03-25 Thread John C Nash
The following example gives output with a line length of 103 on my system. It is causing a nuisance in creating a vignette. Is there something other than e.g., options(width=60) I need to set? The Sweave FAQ suggests this should work. options(width=60) pastured <- data.frame( time=c(9, 14, 21, 2

Re: [R] (no subject)

2012-03-25 Thread Rolf Turner
On 26/03/12 00:18, Anjana Thampi wrote: How do you decompose inequality in R, say by gender? This has to be one of the most meaningless and ill-expressed questions I've ever seen on this list. And that's a high hurdle to clear. cheers, Rolf Turner __

Re: [R] string substitution for argument in function

2012-03-25 Thread Henrique Dallazuanna
try this: `names<-`(rep(2, 3), a) On Sun, Mar 25, 2012 at 6:22 PM, Pedro Martinez wrote: > > hello, > I want to iterate through a list of names and use each element as an > argument in a function. For instance: > > > a = c('one','two','three') > > data= c() > > for(elem in a){data=cbind(elem =

Re: [R] string substitution for argument in function

2012-03-25 Thread Weidong Gu
Hi, This may help a = c('one','two','three') data.frame(eval(substitute(rbind(var,2),list(var=a ?substitute ?eval Weidong Gu On Sun, Mar 25, 2012 at 5:22 PM, Pedro Martinez wrote: > hello, > I want to iterate through a list of names and use each element as an > argument in a function. F

Re: [R] svycoxph and test statistics

2012-03-25 Thread Terry Therneau
On 03/24/2012 06:00 AM, r-help-requ...@r-project.org wrote: I have been using the function 'svycoxph' in the Dr. Lumley's survey package (version 3.26) to compute coefficient estimates for Cox regression. I have noticed the p-values output are based on normal distribution (like in coxph); howe

Re: [R] Format wanted...

2012-03-25 Thread Hasan Diwan
Duncan, On 25 March 2012 15:28, Duncan Murdoch wrote: > In case anyone is interested, I want to output code in a language (GLSL) > that sees 1 and 1. as different types.  I want a floating point value, so I > need the decimal point. GLSL, assuming it's the one that I'm looking at[1], supports im

Re: [R] Accessing more than two coefficients in a plot

2012-03-25 Thread Bert Gunter
Well, as a line in the plane is determined by 2 coefficients only, I'd guess that trying to find an R function that plots a line defined by 4 coefficients has about the same chance of success as finding a unicorn with 3 horns. You do understand that your linear model defines a hyperplane in your t

Re: [R] Format wanted...

2012-03-25 Thread Duncan Murdoch
On 12-03-25 10:45 AM, Marc Schwartz wrote: On Mar 25, 2012, at 7:14 AM, Duncan Murdoch wrote: On 12-03-24 10:47 PM, J Toll wrote: On Sat, Mar 24, 2012 at 7:30 PM, Duncan Murdoch wrote: Do we have a format that always includes a decimal point and a given number of significant digits, but o

[R] Accessing more than two coefficients in a plot

2012-03-25 Thread FJ M
I've successfully plotted (in the plot and abline code below) a simple regression of Lambda1_2 on VV1_2. I then successfully regressed Lambda1_2 on VV1_2, VV1_22 and VV1_212 producing lm2.l. When I go to plot lm2.l using abline I get the warning: "1: In abline(lm2.l, col = "brown", lty = "dott

[R] string substitution for argument in function

2012-03-25 Thread Pedro Martinez
hello, I want to iterate through a list of names and use each element as an argument in a function. For instance: > a = c('one','two','three') > data= c() > for(elem in a){data=cbind(elem = 2,data)} > data elem elem elem [1,]222 instead I want 'elem' to be substituted by the stri

Re: [R] R Error : DATA to MATRIX

2012-03-25 Thread ritwik_r
Thanks David, your suggestion works fine.btw I have another question..If I set (n,m) little bit large, say (n=20,m=10), R cannot handle the large data frame generated through "expand.grid".Is there any way to increase R-memory so that I can tackle large data.frame in R ? regards ri

Re: [R] R numerical integration

2012-03-25 Thread casperyc
The quadinf command in library pracma still fails when mu=-2.986731 with sigma=53415.18. While Maple gives me an estimate of 0.5001701024. Maple: (for those who are interested) myf:=(mu,sigma)-> evalf(Int(exp(-(x-mu)^2/2/sigma^2)/sigma/sqrt(2*Pi)/(1+exp(-x)

[R] 'names' attribute must be the same length as the vector

2012-03-25 Thread jiefan
I have met into this problem when I tried to run panel regression by plm. My code: library(plm) indus <- read.csv(file="full.csv",header=TRUE) industry<-as.data.frame(indus) reg<-lm(LnTSO2 ~ LnPGDP + LnPGDP2 + LnSOES + LnCOES + LnLIMD + LnSHOLD + LnPRIV + LnFIEs + LnEXP + LnIMP + LnLEXRE + Ln

[R] limma design matrix

2012-03-25 Thread statfan
I am trying to construct my design matrix needed in the {limma} function "lmfit" but am having trouble with the formula I am to specify in the function "model.matrix". Namely when to I use ~0 + factors (ex 1) vs ~-1 + factors (ex 2). Any clarification on this would be greatly appreciated. Thanks

Re: [R] avoiding for loops

2012-03-25 Thread Richard M. Heiberger
> df1 <- data.frame(group=c("red", "red", "red", "blue", "blue", "blue"), id=c("A", "B", "C", "D", "E", "F")) df1 <- data.frame(group=c("red", "red", "red", "blue", "blue", + "blue"), id=c("A", "B", "C", "D", "E", "F")) > df1 group id 1 red A 2 red B 3 red C 4 blue D 5 blue E 6 blue

[R] avoiding for loops

2012-03-25 Thread Ed Siefker
I have data that looks like this: > df1 group id 1 red A 2 red B 3 red C 4 blue D 5 blue E 6 blue F I want a list of the groups containing vectors with the ids.I am avoiding subset(), as it is only recommended for interactive use. Here's what I have so far: df1 <- data.fra

Re: [R] Weird POSIXct behaviour

2012-03-25 Thread Joshua Ulrich
On Sun, Mar 25, 2012 at 3:01 PM, Worik R wrote: > My bad.  I should be clearer about the source of my confusion. > > Given two identical string representations of POSIXct objects, can the two > objects represent different times? > Yes. Here's an example (from my Ubuntu machine) of one way: > (t1

Re: [R] Weird POSIXct behaviour

2012-03-25 Thread Worik R
My bad. I should be clearer about the source of my confusion. Given two identical string representations of POSIXct objects, can the two objects represent different times? > > Where has it gone? > > > It's hard to say, especially since you give no indication how you > assigned the value to Time

Re: [R] Nonparmetric statistics with weighted data set?

2012-03-25 Thread Thomas Lumley
On Mon, Mar 26, 2012 at 8:45 AM, Barnet Wagman wrote: > I'm doing some work with a weighted data set (the CPS) and I'd like to use > nonparametric techniques. Is there an R package that supports this?  The np > package doesn't appear to have provisions for weighted data. (Or have I > missed someth

Re: [R] multiple hexbin plots with varying greatest densities

2012-03-25 Thread Thomas Lumley
On Mon, Mar 26, 2012 at 4:59 AM, Wayne Gray wrote: > Greetings: > > I have multiple hexbin plots with varying greatest densities. > > Right now, the data on each plot varies from 1-256 levels of density. The > problem with that is that in Plot A the data are more scattered across a 2 x > 2 grid

[R] Nonparmetric statistics with weighted data set?

2012-03-25 Thread Barnet Wagman
I'm doing some work with a weighted data set (the CPS) and I'd like to use nonparametric techniques. Is there an R package that supports this? The np package doesn't appear to have provisions for weighted data. (Or have I missed something?) I need to perform both density estimation and regres

Re: [R] Handling 8GB .txt file in R?

2012-03-25 Thread steven mosher
As the other poster noted, you can just skip lines. Big matrix should work just fine, except I am not sure how the dates will be handled Here is some sample code from my stuff txtName is the file name of the file you are reading Directory is the path where you want to write the file.backed ma

Re: [R] Reading big files in chunks-ff package

2012-03-25 Thread Jan van der Laan
The 'normal' way of doing that with ff is to first convert your csv file completely to a ffdf object (which stores its data on disk so shouldn't give any memory problems). You can then use the chunk routine (see ?chunk) to divide your data in the required chunks. Untested so may contain err

Re: [R] Multivariate function from univariate functions

2012-03-25 Thread Petr Savicky
On Sat, Mar 24, 2012 at 08:04:49PM -0700, physicistintheory wrote: > I'm relatively new to R and I'm stuck. > > I'm trying to construct a surface to optimize from a multivariate dataset. > The dataset contains the response of a system to various stimuli. I am > trying to optimize the mix of stim

Re: [R] Reading big files in chunks-ff package

2012-03-25 Thread Mav
Thank you Jan My problem is the following: For instance, I have 2 files with different number of rows (15 million and 8 million of rows each). I would like to read the first one in chunks of 5 million each. However between the first and second chunk, I would like to analyze those first 5 million o

[R] multiple hexbin plots with varying greatest densities

2012-03-25 Thread Wayne Gray
Greetings: I have multiple hexbin plots with varying greatest densities. Right now, the data on each plot varies from 1-256 levels of density. The problem with that is that in Plot A the data are more scattered across a 2 x 2 grid whereas in Plot B the data are more concentrated in fewer cells

Re: [R] ROC Analysis

2012-03-25 Thread Camille Leclerc
Hi everybody, Pascal, your code works, but when I want to do the graph I have an error message. here is my code : x<-rev(unlist(pred@cutoffs)) tpf<-unlist(performance(pred, "tpr")@y.values) fpf<-unlist(performance(pred,"fpr")@y.values) ll<-length(x) p<-(tpf[1:(ll-1)]-tpf[2:ll])/(fpf[1:(ll-1)]-fp

Re: [R] How to get the input of a function right?

2012-03-25 Thread Robert Baer
Your definition of x1, x2 and x3 requires the c() function. Try leaving some space around operators for increased readability. Remember that the that the result of operations on sets containing NA is often set to "NA" as well. My guess is that if you print out x it contains NA and that your

Re: [R] Weird POSIXct behaviour

2012-03-25 Thread Joshua Ulrich
On Sun, Mar 25, 2012 at 3:15 AM, Worik R wrote: > Friends > > I have an xts that I wish to access. > > Browse[2]> DATA.ba[[p]]["2012-03-20 00:59:57","bid"] >                       bid > 2012-03-20 00:59:57 1.4993 > > So far so good. > > Now putting the index into a variable: > > Browse[2]> Time >

Re: [R] Nonparametric bivariate distribution estimation and sampling

2012-03-25 Thread heyi xiao
David, Great idea! It is simple yet very effective. I didn’t know that sample can be used with probability/weight. I feel that I learned a lot. Thanks a lot for the help! Heyi --- On Fri, 3/23/12, David Winsemius wrote: > From: David Winsemius > Subject: Re: [R] Nonparametric bivariate distr

Re: [R] Multivariate function from univariate functions

2012-03-25 Thread Mitchell Maltenfort
Naïve question: would a saturated multivariate model work as an interpolation function? On 3/24/12, physicistintheory wrote: > I'm relatively new to R and I'm stuck. > > I'm trying to construct a surface to optimize from a multivariate dataset. > The dataset contains the response of a system to v

[R] SPLS does not output probabilities for predicted classes.

2012-03-25 Thread saskay
Hi, I was using SPLS package to do multi-class classification and would require probabilities to be output for each class. In the vignette, the documentation does say that you can output probabilities by requesting fit.type = "response", however I still only get predicted classes, rather than the r

[R] How to calculate deviance on test data

2012-03-25 Thread zmlr
Hi all, If I got a Cox model based on training set, then how should I calculate the Cox log partial likelihood for the test data? Actually I am trying to calculate the deviance on test dataset to evaluate the performance of prediction model, the equation is as follows: D = -2{L(test)[beta_train] -

[R] (no subject)

2012-03-25 Thread Anjana Thampi
How do you decompose inequality in R, say by gender? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.h

[R] Work -Shift Scheduling - Constraint Linear Programming

2012-03-25 Thread agent dunham
Dear Community, I've a Work -Shift Scheduling Problem I'd like to solve via constraint linear programming. Maybe something similar to http://support.sas.com/documentation/cdl/en/orcpug/63349/HTML/default/viewer.htm#orcpug_clp_sect037.htm Can anybody suggest me any package/R examples to solve t

Re: [R] output by(...)

2012-03-25 Thread INCOMA GfK
perfect, thanks a lot! :o) -z Odesílatel: Gabor Grothendieck [ggrothendi...@gmail.com] Odesláno: 25. března 2012 12:27 Komu: Skála, Zdeněk (INCOMA GfK) Kopie: r-help@r-project.org Předmět: Re: [R] output by(...) 2012/3/25 Skála, Zdeněk (INCOMA GfK) : > Dea

Re: [R] How to test omitted level from a multiple level factor against overall mean in regression models?

2012-03-25 Thread Biedermann, Jürgen
Hi Gabor, Thanks a lot for the answer. However, I'm not so much focusing on the pure effect value of the omitted factor level, but more on the statistical test if it differs significantly from 0. Do you know a way for this purpose too? Greetings Jürgen V

Re: [R] Format wanted...

2012-03-25 Thread Marc Schwartz
On Mar 25, 2012, at 7:14 AM, Duncan Murdoch wrote: > On 12-03-24 10:47 PM, J Toll wrote: >> On Sat, Mar 24, 2012 at 7:30 PM, Duncan Murdoch >> wrote: >>> Do we have a format that always includes a decimal point and a given number >>> of significant digits, but otherwise drops unnecessary charac

Re: [R] Format wanted...

2012-03-25 Thread Duncan Murdoch
On 12-03-24 10:47 PM, J Toll wrote: On Sat, Mar 24, 2012 at 7:30 PM, Duncan Murdoch wrote: Do we have a format that always includes a decimal point and a given number of significant digits, but otherwise drops unnecessary characters? For example, if I wanted 5 digits, I'd want the following:

Re: [R] How to test omitted level from a multiple level factor against overall mean in regression models?

2012-03-25 Thread Gabor Grothendieck
2012/3/25 "Biedermann, Jürgen" : > Hi there, > > I have a linear model with one factor having three levels. > I want to check if the different levels significantly differ from the overall > mean (using contr.sum). > However one level (the last) is omitted in the standard procedure. > > To illustra

Re: [R] output by(...)

2012-03-25 Thread peter dalgaard
On Mar 25, 2012, at 12:27 , Gabor Grothendieck wrote: > 2012/3/25 Skála, Zdeněk (INCOMA GfK) : >> Dear all, >> >> I have a question that is probably pretty stupid, so apologies in advance... >> >> I do a simple >> >>> mydata.tab <- by(my.data.frame, my.data.frame$category, colMeans) >> >> ...

Re: [R] output by(...)

2012-03-25 Thread Gabor Grothendieck
2012/3/25 Skála, Zdeněk (INCOMA GfK) : > Dear all, > > I have a question that is probably pretty stupid, so apologies in advance... > > I do a simple > >> mydata.tab <- by(my.data.frame, my.data.frame$category, colMeans) > > ...works fine, but I need to output the results to some "flat" file (kind

Re: [R] Reading big files in chunks-ff package

2012-03-25 Thread Jan van der Laan
Your question is not completely clear. read.csv.ffdf automatically reads in the data in chunks. You don´t have to do anything for that. You can specify the size of the chunks using the next.rows option. Jan On 03/24/2012 09:29 PM, Mav wrote: Hello! A question about reading large CSV files

[R] output by(...)

2012-03-25 Thread INCOMA GfK
Dear all, I have a question that is probably pretty stupid, so apologies in advance... I do a simple > mydata.tab <- by(my.data.frame, my.data.frame$category, colMeans) ...works fine, but I need to output the results to some "flat" file (kind of table) to work with it in Excel etc. So I am do

[R] How to test omitted level from a multiple level factor against overall mean in regression models?

2012-03-25 Thread Biedermann, Jürgen
Hi there, I have a linear model with one factor having three levels. I want to check if the different levels significantly differ from the overall mean (using contr.sum). However one level (the last) is omitted in the standard procedure. To illustrate this: x <- as.factor(c(1,1,1,2,2,2,2,2,2,3,

Re: [R] Handling 8GB .txt file in R?

2012-03-25 Thread Jan van der Laan
What you could try to do is skip the first 5 lines. After that the file seems to be 'normal'. With read.table.ffdf you could try something like # open a connection to the file con <- file('yourfile', 'rt') # skip first 5 lines tmp <- readLines(con, n=5) # read the remainder using read.table.ff

Re: [R] Weird POSIXct behaviour

2012-03-25 Thread peter dalgaard
I see "NZDT" going in and out of your time values. Could that have something to do with it? On Mar 25, 2012, at 10:15 , Worik R wrote: > Friends > > I have an xts that I wish to access. > > Browse[2]> DATA.ba[[p]]["2012-03-20 00:59:57","bid"] > bid > 2012-03-20 00:59:57 1

Re: [R] How to install tclRequire(Iwidgets)

2012-03-25 Thread peter dalgaard
On Mar 25, 2012, at 08:11 , mrzung wrote: > hi, i'm trying to make "Tabbed Notebook Widget",but cannot install > "tclRequire(Iwidgets)". > > I installed Activetcl but I don't know what can be the next step to execute > "tclRequire(Iwidgets)". > > how can i do that? By adding Iwidgets to your T

[R] Weird POSIXct behaviour

2012-03-25 Thread Worik R
Friends I have an xts that I wish to access. Browse[2]> DATA.ba[[p]]["2012-03-20 00:59:57","bid"] bid 2012-03-20 00:59:57 1.4993 So far so good. Now putting the index into a variable: Browse[2]> Time [1] "2012-03-20 00:59:57 NZDT" Browse[2]> DATA.ba[[p]][Time, "bid"]

[R] How to install tclRequire(Iwidgets)

2012-03-25 Thread mrzung
hi, i'm trying to make "Tabbed Notebook Widget",but cannot install "tclRequire(Iwidgets)". I installed Activetcl but I don't know what can be the next step to execute "tclRequire(Iwidgets)". how can i do that? Thanks -- View this message in context: http://r.789695.n4.nabble.com/How-to-install

Re: [R] Handling 8GB .txt file in R?

2012-03-25 Thread iliketurtles
Thanks to all the suggestions. To the first individual that replied, I can't do any stuff with unix or perl. All I know is R. @KEN: I'm using Windows 7, 64 bit. @Steve: Here's the readLines output.. As we can see, lines 1-3 are empty and line 5 is empty, and there's also empty elements after line

[R] Multivariate function from univariate functions

2012-03-25 Thread physicistintheory
I'm relatively new to R and I'm stuck. I'm trying to construct a surface to optimize from a multivariate dataset. The dataset contains the response of a system to various stimuli. I am trying to optimize the mix of stimuli to maximize the response. To do so, I've interpolated the various datase

Re: [R] How to compute within-group mean and sd?

2012-03-25 Thread reeyarn
Thanks Rui, Greg, and Michael. Your answers helped a lot! Best, Reeyarn On Sun, Mar 25, 2012 at 1:02 AM, Rui Barradas wrote: > Hello, > > > You can use sql with package 'sqldf'. > library(sqldf) # It needs package 'tcltk' > ?sqldf > tbl <- data.frame(firm_id=rep(c(1,2), 10), value=rnorm(20))

Re: [R] cubature

2012-03-25 Thread Jeff Newmiller
Who knows? You mention different machines, yet fail to hint what they are much less provide sessionInfo() output, and x is not defined in your global environment in your snippet. Please read the posting guide. I am not familiar with this library, but I would be surprised if it were capable of h