similar to: compute differences

Displaying 20 results from an estimated 3000 matches similar to: "compute differences"

2006 Feb 20
3
Boxplot Help for Neophyte
R helpers I am getting to grips with R but came across a small problem today that I could not fix by myself. I have 3 text files, each with a single column of data. I read them in using: myData1<-scan("C:/Program Files/R/myData1.txt") myData2<-scan("C:/Program Files/R/myData2.txt") myData3<-scan("C:/Program Files/R/myData3.txt") I wanted to produce a
2011 Feb 25
1
speed up process
Dear users, I have a double for loop that does exactly what I want, but is quite slow. It is not so much with this simplified example, but IRL it is slow. Can anyone help me improve it? The data and code for foo_reg() are available at the end of the email; I preferred going directly into the problematic part. Here is the code (I tried to simplify it but I cannot do it too much or else it
2009 Jun 26
3
to raise in a loop more than 1
I would raise x,y and z in a loop but I won't raise of 1. I tried this but it doesn't work mydata=matrix(nrow=1500,ncol=3) i=1 for(x in 0:10){ for(y in 0:20){ for(z in 0:10){ mydata[i,]=c(x,y,z) i=i+1 z=z+2} y=y+4} x=x+2} And I would have something like that x y z 0 0 0 0 0 2 0 0 4 0 0 6 0 0 8 0 0 10 0 4 0 0 4 2 ... Could anybody help me? I
2007 Aug 10
7
Help wit matrices
Hello all, I am working with a 1000x1000 matrix, and I would like to return a 1000x1000 matrix that tells me which value in the matrix is greater than a theshold value (1 or 0 indicator). i have tried mat2<-as.matrix(as.numeric(mat1>0.25)) but that returns a 1:100000 matrix. I have also tried for loops, but they are grossly inefficient. THanks for all your help in advance. Lanre
2007 Mar 02
2
sampling random groups with all observations in the group
Hi I have a panel dataset with large number of groups and differing number of observations for each group. I want to randomly select say, 20% of the groups or 200 groups, but along with all observations from the selcted groups (with the corresponding data). I guess it is possible to generate a random sample from the groups ids and then match that with the entire dataset to have the intended
2005 Aug 08
2
selecting outliers
Hi everybody, I'd like to know if there's an easy way for extracting outliers record from a dataset, in order to perform further analysis on them. Thanks Alessandro
2005 Nov 21
1
modify boxplot
Hi everybody, I'm trying to modify the boxplot just to set the upper whisker to the 90 percentile value, but I still couldn't find the solution. Can anyone help me? Thanks Alessandro Carletti
2005 Oct 28
4
clustering
Hi everybody, I'm performing a cluster analysis (pkg "cluster") on a dataset which includes 15 variables: is there a way to know how much each variable weighs on the final clustering output? Thanks Alessandro
2005 Apr 27
2
date format
Hi, I'm trying to convert a vector containing dates in character format ("dd/mm/yy"): mdy.date (from date package) seems to be able to do that, but it returns to me a vector containing julian dates... but negative! for example: 16/12/03 is converted into -20470 it is because R recognizes year ../03 as 1903, instead of 2003, but how can I do to solve this problem? (of course, I
2011 Feb 24
1
Selecting data based on the range of dates
Hi: I want to give an index with all the dates between Sept. to Nov. as 1, and anything else is 0. It doesn't matter which year it is, as long as it is between Sept. to Nov, then set up to 1, otherwise is 0. My data frame looks like below: ID Date 201 1/1/05 6:07 AM 201 3/27/09 9:45 AM 201 9/29/09 8:44 AM 203 10/16/08 10:01 AM 203 10/28/08 9:45 AM 203 10/31/08 11:12 AM 203 11/7/08 11:32 AM
2010 Aug 19
1
zoo. window
Hi, I have a dataset including monthly date from 1971-01-01 to 2009-01-01. The dates are character variables. I want to select the subsample from my original data, so I use mydata3<-window(mydata,start="1972-02-01",end="2005-02-01"), or mydata3<-window(mydata, start=as.date("1972-02-01"),end=as.date("2005-02-01")) or mydata3<-window(mydata,
2008 Jul 09
2
Read.table - Less rows than original data
Dear all, I have problem when reading a table into R. The total row of read in table has is much less than the original saved table. I built a 1,273,230 by 6 data set named "mydata2", it was saved in the following command, write.table(mydata2, "mydata2.txt", row.name=F,col.name=T,quote=F,sep="\t") The next day I read in above saved text file into R,
2001 Dec 19
2
How to create a data.frame "like" another, but longer?
Hello, does anyone know of a quick way to create a data frame "like" another, but with more rows? What I'd like to do is this: if mydata is a data.frame like a b c 1 TRUE yes 2 FALSE no 3 TRUE yes I'd like to get mydata2 with the same column names and column types, but without the values and with more rows. All I could think of was to manually do
2012 Jul 03
1
insert missing dates
Hello I have dataframes. mydata1 <-data.frame(value=c(15,20,25,30,45,50),dates=c("2005-05-25 07:00:00 ","2005-05-25 19:00:00","2005-06-25 07:00:00","2005-06-25 19:00:00 ","2005-07-25 07:00:00","2005-8-25 19:00:00")) or mydata2 <-data.frame(value=c(15,20,25,30,45,50),dates=c("2005-05-25 00:00:00 ","2005-05-25
2008 Aug 19
4
spatial probit/logit for prediction
Hello all, I am wondering if there is a way to do a spatial error probit/logit model in R? I can't seem to find it in any of the packages. I can do it in MATLAB with Gibbs sampling, but would like to confirm the results. Ideally I would like to use this model to predict probability of parcel conversion in a future time period. This seems especially difficult in a binary outcome model
2010 Jan 11
1
Forming Portfolios for Fama / French Regression
Hi mates, I have a problem. I am new to R and want to conduct the Fama/French asset pricing test. As I am from Germany, I cannot use the already computed factors from French's website, but need to compute them myself. So I have to sort a number of stocks into different portfolios using one factor, then subdivide these portfolios into several more using another factor, then compute portfolio
2007 Mar 08
1
R: Searching and deleting elements of list
you could try mapply mydata2<-mapply("[", mydata, lapply(mydata, function(x) !x %in% A)) mydata2[[1]]<-A #to replace the obviously deleted elements of "A" mydata2 mydata2[[1]] mydata2[[2]] mydata2[[3]] mydata2[[4]] Stefano -----Messaggio originale----- Da: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch]Per conto di jastar
2009 Jan 06
5
Using apply for two datasets
I can run one-sample t-test on an array, for example a matrix myData1, with the following apply(myData1, 2, t.test) Is there a similar fashion using apply() or something else to run 2-sample t-test with datasets from two groups, myData1 and myData2, without looping? TIA, Gang
2009 May 31
1
warning message when running quantile regression
Hi All, I am running quantile regression in a "for loop" starting with 1 variable and adding a variable at a time reaching a maximum of 20 variables. I get the following warning messages after my "for" loop runs. Should I be concerned about these messages? I am building predictive models and am not interested in inference. Warning messages: 1: In
2005 Aug 08
1
vector vs array
Hi! OK, I'm trying to select some "useful outliers" from my dataset: I defined 11 "treshold" values (1 for each level of a variable (sampling site) as follows: tresholds<-function(x) { tapply(x,mm$NAME,FUN=mean ,simplify = T, na.rm=T)->med tapply(x,mm$NAME,FUN=sd ,simplify = T, na.rm=T)->standev standev+med } tresholds(mm$chl) Now I'd like to select