similar to: Equivalent to a BY command in SAS

Displaying 20 results from an estimated 1500 matches similar to: "Equivalent to a BY command in SAS"

2008 Nov 22
5
What's the BEST way in R to adapt this vector?
Goal: Suppose you have a vector that is a discrete variable with values ranging from 1 to 3, and length of 10. We'll use this as the example: y <- c(1,2,3,1,2,3,1,2,3,1) ...and suppose you want your new vector (y.new) to be equal in length to the possible discrete values (3) times the length (10), and formatted in such a way that if y[1] == 1, then y.new[1:3] == c(1,0,0), and if y[2] ==
2008 Sep 26
3
Dealing With Extremely Large Files
Hi, I'm sure that a large fixed width file, such as 300 million rows and 1,000 columns, is too large for R to handle on a PC, but are there ways to deal with it? For example, is there a way to combine some sampling method with read.fwf so that you can read in a sample of 100,000 records, for example? Something like this may make analysis possible. Once analyzed, is there a way to, say, read
2008 Nov 03
4
How do you apply a function to each variable in a data frame?
I want to apply a more complicated function than what I use in my example, but the idea is the same: Suppose you have a data frame named x and you want to a function applied to each variable, we'll just use the quantile function for this example. I'm trying all sorts of apply functions, but not having luck. My best guess would be: sapply(x, FUN=quantile) -- View this message in
2008 Jul 28
7
Legality Question about R's Open Source GNU GPL License
Hi, I use R at home, and am interested in using it at my work company (which is in the Fortune 100). I began the request, and our legal team has given some gruff about the open source license. Not boring you with the details here, but I used some info on gnu.org as a rebuttal, and someone at the company replied that the generalities of GNU GPL may differ from R's specific GNU GPL license,
2011 Jan 26
2
Sweave: \Sexpr{} inside <<>>?
Hi, Is it possible in Sweave to put \Sexpr{} inside <<>>? This is a bad example, but here goes: <<results=hide>> Age <- 5 @ <<>> x <- \Sexpr{Age} @ I'm trying to get it to display x <- 5, rather than x <- Age. It's probably so obvious I'm going to feel sorry for having to ask, just the same, I'm stumped. Any ideas? Thanks. --
2017 Oct 08
2
Manipulations with CO2 dataset on R
Hi, I just started a new course this semester on R, I never used it in my life and i'm stuck on these questions from 3 days, it would be really nice if someone could explain me the answers with the relative commands. thanks a lot in advance The following 7 questions are based on the CO2 dataset of R. 1) How many of the plants in CO2 are Mc2 for Plant? 2) How many are either Mc2 or Mn2?
2011 Jun 25
2
Multivariate normal density in C for R
Does anyone know of a package that uses C code to calculate a multivariate normal density? My goal is to find a faster way to calculate MVN densities and avoid R loops or apply functions, such as when X and mu are N x K matrices, as opposed to vectors, and in this particular case, speed really matters. I would like to be able to use .C or .Call to pass X, mu, Sigma, and N to a C program and have
2011 Mar 19
3
How would you avoid loops in this simple example?
I'm trying to code more R-like and avoid loops. Here is an example I'm having a hard time getting away from loops with, and the real matrices are rather large, and the computation is too time-consuming. ### Dimensions N <- 2 M <- 3 P <- 4 ### Array and Matrices nu <- array(NA,dim=c(N,M,P)) Lambda <- matrix(1:12,P,M) F <- matrix(1:8,N,P) ### Loop to avoid for (i in 1:N)
2013 Apr 26
2
Remove reciprocal data from a grouped animal social contact dataset
Hi r-help forum, I have been collecting contact data (with proximity logger collars) between a few different species of animal. All animals wear the collars, and any contact between the animals should be detected and recorded by both collars. However, this isn't always the case and more contacts may be recorded on one collar of the two. This is fine, it depends on battery life and other
2006 Jul 18
2
Using corStruct in nlme
I am having trouble fitting correlation structures within nlme. I would like to fit corCAR1, corGaus and corExp correlation structures to my data. I either get the error "step halving reduced below minimum in pnls step" or alternatively R crashes. My dataset is similar to the CO2 example in the nlme package. The one major difference is that in my case the 'conc' steps are
2008 Dec 23
2
beginner data.frame question
I need some help understanding how on of the example data sets is formatted in the basic R installation. If I load the Mona Loa CO2 data, with the command: > data(co2) I can view the data with: > co2 And the data are in the form of 11 rows labeled as years (1994-2004) and 12 columns labeled (Jan - Dec). This structure appears to be a dataframe, however, if I type the command
2008 Aug 21
1
summary.lme and anova question
Dear all, When analyzing data from a climate change experiment using linear mixed-effects models, I recently came across a situation where: - the summary(model) showed a significant difference between the levels of a two-level factor, - while the anova(model) showed no significance for that factor (see below). My question now is: Is the anova.lme() approach correct for that model? And why does
2013 Jul 09
3
fitting log function: errors using nls and nlxb
Hi- I am trying to fit a log function to my data, with the ultimate goal of finding the second derivative of the function. However, I am stalled on the first step of fitting a curve. When I use the following code: FG2.model<-(nls((CO2~log(a*Time)+b), start=setNames(coef(lm(CO2 ~ log(Time), data=FG2)), c("a", "b")),data=FG2)) I get the following error: Error in
2009 Jan 27
1
WhisperStation R
What do you think of this: http://www.microway.com/whisperstation/whisperstation-r.html I'm considering ditching my Windows Vista 2 GB RAM computer for WhisperStation R using Debian 64-bit Linux with 32 GB RAM and setting the whole thing up for R and WinBUGS. I put in a price request, but I know nothing about Linux, or WhisperStation R for that matter, and am really curious what you think?
2010 Dec 29
2
Referring to an object name from within a function
Can anyone show me how to refer to an object name that is passed to a function, from within the function? For example: MyModel <- 1 test <- function(x) { if(x == 1) {cat("x is a valid object.\n")} } test(x) What I would like this to do is pass MyModel to function test, and if it passes a test, be able to print "MyModel is a valid object." Thanks. -- View this
2008 May 02
1
Errors using nlme's gls with autocorrelation
Hi, I am trying out a generalized least squares method of forecasting that corrects for autocorrelation. I downloaded daily stock data from Yahoo Finance, and am trying to predict Close (n=7903). I have learned to use date functions to extract indicator variables for Monday - Friday (and Friday is missing in the model to prevent it from becoming full rank). When I run the following code...
2002 Jun 06
2
covariance analysis model
Dear list users, I have trouble with covariance analysis. I measured nitrate concentrations in the soil (NO3) and the percentage of legumes (LEG, continuous), affected by 2 different CO2 concentrations (CO2, discrete). I suspect that CO2 has an effect on LEG and NO3, but also that LEG has an effect on NO3, so this is the formula I wrote to test this: NO3 ~ CO2 + LEG + CO2:LEG Will LEG be
2005 Jul 12
3
using its to import time series data with uneven dates
Good day: I am trying to use readcsvIts("nwr_data_qc.txt",informat=its.format("%Y%m%d%h%M %Y"),header=TRUE,sep="",skip=0,row.names=NULL,as.is=TRUE,dec=".") to read in a file (nwr_data_qc.txt) that looks like this: Time Y M D H Min CO2 2000.18790 2000. 3. 9. 18. 30. 373.60 2000.20156 2000. 3. 14. 18. 30. 373.34
2007 Jul 16
5
formula(CO2)
The formula attribute of the builtin CO2 dataset seems a bit strange: > formula(CO2) Plant ~ Type + Treatment + conc + uptake What is one supposed to do with that? Certainly its not suitable for input to lm and none of the examples in ?CO2 use the above.
2010 Jul 23
2
re-ordering bwplot
Dear list: I'm using bwplot to compare concentrations by location and treatment as in: # using built in data bwplot( conc ~ Type : Treatment, data = CO2 ) I would like the order of the plots to be: 3,4,1,2. I can't seem to figure this out with index.cond or permc.cond. Any help is appreciated! Brad Eck [[alternative HTML version deleted]]