similar to: switch() usage

Displaying 20 results from an estimated 3000 matches similar to: "switch() usage"

2008 Sep 12
4
reading in results from system(). There must be an easier way...
Hello, I am currently using R to run an external program and then read the results the external program sends to the stdout which are tsv data. When R reads the results in it converts it to to a list of strings which I then have to maniuplate with a whole slew of commands (which, figuring out how to do was a reall challenge for a newbie like myself)--see below. Here's the code I'm
2009 Oct 15
2
Proper syntax for using varConstPower in nlme
Hello, Excuse me for posting two questions in one day, but I figured it would be better to ask my questions in separate emails. I will again give the caveat that I'm not a statistician by training, but have a fairly decent understanding of probability and likelihood. As before, I'm trying to fit a nonlinear model to a dataset which has two main factors using nlme. Within the dataset
2009 Nov 12
0
writing selfStart models that can deal with treatment effects
Hello, I'm trying to do some non-linear regression with 2 cell types and 4 tissue type treatments using selfStart models Following Ritz and Streibig (2009), I wrote the following routines: ##Selfstart expDecayAndConstantInflowModel <- function(Tb0, time, aL, aN, T0){ exp(-time*aL)*(T0*aL+(-1+exp(time * aL))*Tb0 * aN)/aL } expDecayAndConstantInflowModelInit <- function(mCall, LHS,
2009 Oct 30
0
Interpreting gnls() output in comparison to nls()
Hi, I've been trying to work with the gnls() function in the "nlme" package. My decision to use gnls() was so that I could fit varPower and such to some of the data. However, in working with a small dataset, I've found that the results given by gnls() don't seem to make any sense and they differ substantially from those produced by nls(). I suspect that I am just
2009 Oct 15
0
Setting random effects within a category using nlme
Hello, I will start out with the caveat that I'm not a statistician by training, but have a fairly decent understanding of probability and likelihood. Nevertheless, I'm trying to fit a nonlinear model to a dataset which has two main factors using nlme. Within the dataset there are two Type categories and four Tissue categories, thus giving me 8 datasets in total. The dataset is in
2009 Feb 12
2
SAS Institute Adding Support for R
Hi Folks, SAS Institute is adding official support for R: http://support.sas.com/rnd/app/studio/Rinterface2.html Cheers, Bob ========================================================= Bob Muenchen (pronounced Min'-chen), Manager, Research Computing Support U of TN Office of Information Technology Stokely Management Center, Suite 200 916 Volunteer Blvd., Knoxville, TN
2008 Mar 10
1
When to quote a package name
Dear HelpeRs, I'm confused about the role of quotes around package names on the library and detach functions. Books on R use both approaches: library(Hmisc) describe(mydata) detach(package:Hmisc) and library("Hmisc") describe(mydata) detach("package:Hmisc") The help file for detach says "quoted or unquoted" and the help file for library says about the
2007 Feb 10
1
JGR data editor question
Hi All, I'm learning JGR 1.4-15 with R 2.4.1 in Windows XP (all patches applied). JGR looks great but I'm having trouble getting the data editor to save my results. I don't see anything in R-help about it. Here are the steps I followed: 1. I chose "Tools>Object Browser" & double-clicked on a data frame, "mydata". 2. A spreadsheet editor popped up and
2008 Feb 12
3
How many R packages?
Hi All, I searched around to find the number of R packages currently available, but didn't find anything, so I choose all repositories & told it to install. The list contained about 2,856 (correcting roughly for those installed). But the list includes repetitions such as 19 names that begin with "bvbovine". Selecting only CRAN and CRAN(extras) I get 1,344. Is there an easier
2007 Sep 09
1
stacking data frames with different variables
Hi All, If I need to stack two data frames, I can use rbind, but it requires that all variables exist in both sets. I can make that happen, but other stat packages would figure out where the differences were, add the missing variables to each, set their values to missing and stack them. Is there a more automatic way to do that in R? Below is an example program. Thanks, Bob # Top data frame has
2006 Dec 28
2
Aggregation using list with Hmisc summarize function
Hi All, I'm using the Hmisc summarize function and used list instead of llist to provide the by variables. It generated an error message. Is this a bug, or do I misunderstand how Hmisc works with lists? The program below demonstrates the error message. Thanks, Bob x<-1:8 group <- c(1,1,1,1,2,2,2,2) gender<- c(1,2,1,2,1,2,1,2) mydata<-data.frame(x,group,gender)
2007 Oct 17
0
JGR makes help more helpful
Hi All, A few weeks ago I suggested that it would be nice to be able to submit lines from the help files for execution. You can cut and paste them into the console, or enter example(function) to run them all. However, I often find myself wanting to run just a line or two, or even parts of a line to see an intermediate result. It turns out that this is one of the many nice features of the JGR
2007 Jan 29
1
R for SAS & SPSS Users Document
Greetings, I am pleased to announce the availability of the document, "R for SAS and SPSS Users", at http://oit.utk.edu/scc/RforSAS&SPSSusers.doc . It presents an introductory view of R for people who already know SAS and/or SPSS. Included are 27 programs written in all three languages (i.e. 81 total) so that people can see how R works compared to the other two, task by task. I
2007 Nov 20
0
p.adjust on matrix of P-values from correlations
Hi All, I'm stumped on something that must be trivial. I created a correlation matrix on 4 variables (6 correlations) using Hmisc's rcorr function. I wanted to correct the P-value matrix for the number of tests done, so I ran it through the p.adjust function. That function adjusted for the 12 p-values it saw, rather than 6. I added the argument n=6 to p.adjust but it requires that n be
2006 Dec 15
1
Switching labels on a factor
Hi All, I'm perplexed by the way the unclass function displays a factor whose labels have been swapped with the relevel function. I realize it won't affect any results and that the relevel did nothing useful in this particular case. I'm just doing it to learn ways to manipulate factors. The display of unclass leaves me feeling that the relevel had failed. I've checked three books
2007 May 18
1
length, mean, na.rm, na.omit...
Hi All, Can anyone tell me why the length function does not use na.rm? I know how to work around it, I'm just curious to know why such a useful option was left out. I'm also interested in the logic of setting na.rm=TRUE as the default on mean, sd, etc. This is the opposite of the many other stat packages I have used, so I assume it provides some programming benefit that is not obvious to
2007 Aug 24
2
Saving results from Linux command line
Hi All, I'm used to running R on Windows & learning Linux. I know ESS is the way to go in the long run, but I'm trying now to just understand the command line. I can interactively enter commands, see the results on the screen and save input & output to myresults.txt with this approach: $script myresults.txt $R > ...r commands... >q() $exit I can also use the Linux tee
2008 Apr 04
2
NA vs. <NA>
Dear R-Helpers, Why does R show character missing values in vectors as NA and when stored in a data frame as <NA>? I've searched but did not find an explanation. Thanks, Bob > gender <- c("f","f","f",NA,"m","m","m","m") > gender [1] "f" "f" "f" NA "m" "m"
2007 Sep 02
2
NAs in indices
Hi All, I'm fiddling with an program to read a text file containing periods that SAS uses for missing values. I know that if I had the original SAS data set instead of a text file, R would handle this conversion for me. Data frames do not allow missing values in their indices but vectors do. Why is that? A search of the error message points out the problem and solution but not why they
2006 Dec 18
1
Applying variable labels across a data frame
Hi All, I'm working on a class example that demonstrates one way to deal with factors and their labels. I create a function called myLabeler and apply it with lapply. It works on the whole data frame when I subscript it as in lapply( myQFvars[ ,myQFnames ], myLabeler ) but does not work if I leave the [] subscripts off. I would appreciate it if anyone could tell me why. The program below