search for: joshb41

Displaying 20 results from an estimated 30 matches for "joshb41".

2008 Aug 20
4
Looping over groups
Hello, My R skills are somewhere between novice and intermediary, and I am hoping that some of you very helpful forum members, whom I've seen work your magic on other peoples' problems/questions, can help me here. I have a matrix with the following format: (i) individual plants comprising many different genotype groups (i.e., a plant is genotype 1 or genotype 2 or genotype 3, etc). The
2011 Feb 17
4
Find and replace all the elements in a data frame
Hi all, I'm having a problem once again, trying to do something very simple. Consider the following data frame: x <- read.table(textConnection("locus1 locus2 locus3 A T C A T NA T C C A T G"), header = TRUE) closeAllConnections() I am trying to make a new data frame, replacing "A" with "A/A", "T" with "T/T", "G" with
2010 Oct 06
2
Pointing to a specific place on the x-axis with an arrow
Hi all, I am trying to do something simple, but which is deviling me. I want to add an up-arrow to the x-axis, pointing to a specific location on the axis. I want the arrow to be as large as possible. Here is where I'm at with my code: #this part if from the ?plot example: require(stats) plot(cars) lines(lowess(cars)) #I am trying to use mtext to add the arrow... but I don't know how
2010 Jul 19
3
concatenating column names in a loop
Hi all, I am trying to concatenate words together to create new column names, using a loop. Please consider the following toy example: x <- matrix(nrow = 1, ncol = 3) colnames(x) <- c("a", "b", "c") x[1,1] <- "1" x[1,2] <- "2" x[1,3] <- "3" I would like to create a new matrix with column names based on the column names
2010 Jun 09
1
Subset columns by prefix
Hello R listserve, I would appreciate someone's help with this problem. Consider the following toy dataset: x <- read.table(textConnection("worldclim.1 worldclim.2 cru.1 cru.2 indv.1 7 8 32 658 indv.2 7 7 39 422"), header = TRUE) How could I create a subset of the data based on the column prefix? For instance, let's say I wanted to subset only the columns with the
2008 Sep 29
1
Simple question about extracting a subset of data
Hello all, I have a (hopefully) simple question. If I have a data table (named "x") such as this: daylengthleavesflowering.datefruits LD1.90055581.64353250.76668986 LD-0.9399410-1.2592968-0.60141837 LD1.0222946-0.9697459 -0.60141837 SD-0.2668132-0.9697459-0.47363322 SD -1.5892393-0.70540660.66469785 SD -0.5222961-0.7054066-0.10701187 How do create a new data table that contains,
2010 Jun 09
2
Change the name of one column ONLY
Hi all, I have a very simple problem that I cannot seem to find the answer to. Consider the following toy dataset: x <- read.table(textConnection("V1 apples bananas cherries indv.1 7 8 4 3 indv.2 7 7 4 9"), header = TRUE) How would I change the column name of ONLY the first column, not the others? Surely I should not have to re-specify the names of ALL the columns -- e.g.,
2009 Jan 18
2
Deleting columns based on the number of non-blank observations
Hello, I have a dataset (named "x") with many (966) columns. What I would like to do is delete any columns that do not have at least 375 non-blank observations (i.e., the cells have some value in them besides NA). How can I do this? I have come up with the following code to _count_ the non-blank observations in each column, but how would I adapt this code to _delete_ columns from the
2011 Apr 11
2
Plotting a quadratic line on top of an xy scatterplot
Dear Listserv, Here is my latest in a series of simple-seeming questions that dog me. Consider the following data: x <- read.table(textConnection("temperature probability 0.11 9.4 0 2.3 0.38 8.7 0.43 9.2 0.6 15.6 0.47 8.7 0.09 12.8 0.11 9.4 0.01 7.7 0.83 8 0.65 9.3 0.05 7.4 0.34 10.1 0.02 4.8 0.07 9.1 0.6 15.6 0.01 8.4 0.9 9.6 0.83 8 0.12 8.4 0.01 8 0 5 0.11 9.7 0.41 7.4 0.05 9.4 0.09
2010 Sep 26
2
Splitting a data frame into several completely separate data frames
Hello again, How do I split a data frame into smaller, completely separate data frames (rather than separate data frames comprising a single "list")? Consider the following data, and my coding attempt: x <- read.table(textConnection("id type number indv.1 bagel 6 indv.2 bagel 1 indv.3 donuts 10 indv.4 donuts 9"), header = TRUE) closeAllConnections() x.split <-
2010 Mar 13
2
Indexing a matrix within loops
Hi, I was hoping someone could help me with the following problem. Consider this toy example. For the input dataset there are four individuals (rows "indv.1" through "indv.4"), measured for two different variables (columns "var.1" and "var.2") at two different levels of a factor (column "factor.level"). I want to calculate a matrix that has the
2010 Sep 16
3
Help with customizing a histogram figure
Hi all, Please consider the following code: require(plotrix) l <- list(rnorm(50),rnorm(50,sd=2),rnorm(50,mean=3)) multhist(l) I have two things I need help with: (1) In the output, there are empty spaces on the x-axis. How would I eliminate these spaces? I want a nice, smooth, empty-spaceless x-axis. (2) How could I add tracing lines to each histogram? I am undoubtedly using the wrong
2009 Feb 27
5
Filtering a dataset's columns by another dataset's column names
Hello all, I hope some of you can come to my rescue, yet again. I have two genetic datasets, and I want one of the datasets to have only the columns that are in common with the other dataset. Here is a toy example (my real datasets have hundreds of columns): Dataset 1: Individual SNP1 SNP2 SNP3 SNP4 SNP5 1 A G T C A 2 T C A G T 3 A C T
2008 Oct 15
0
R-help Digest, Vol 67, Issue 31
...tion. For example R takes the derivative of the function by d1=D(expression(x^2*(cosh*(x^3))), "x"). Is there a similar function available in R to find the integral? Thanks, Kim ------------------------------ Message: 63 Date: Mon, 29 Sep 2008 12:54:59 -0700 (PDT) From: Josh B <joshb41 at yahoo.com> Subject: [R] Simple question about extracting a subset of data To: R Help <r-help at r-project.org> Message-ID: <192025.49678.qm at web110113.mail.gq1.yahoo.com> Content-Type: text/plain Hello all, I have a (hopefully) simple question. If I have a data table (named &...
2010 Jun 13
1
Standard error of regression coefficient
Hi all, This should be a very simple question for you, whereas it is proving devilish for me. How do I output the STANDARD ERROR of the regression coefficient (i.e., the standard error of b) from a simple linear regression? Consider this data, taken directly from ?lm: ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
2008 Sep 27
1
Using "by" to create individual variance-covariance matrices
Hello R list subscribers, I am trying to use the "by" command to create line-specific variance covariance matrices (where "x" is the original data matrix): by(x, x$line, function(d) { d.clean <- d[,-1]}) write.table(d.clean$line[1,1], sep = ",", file = "covariances.csv", col.names = FALSE, row.names = FALSE, append = TRUE) write.table("", sep
2009 Jan 23
1
Outputing residuals
Hello, I was wondering if someone could tell me how to output, to file, the residuals from a REML model-fit. The type of residuals I am interested in are the simple "original raw values - model fit" type. Thanks in advance, Josh B. [[alternative HTML version deleted]]
2011 Sep 30
0
Data simulation for ANOVA decomposition into sums of squares
Dear listserv, Please consider the following dataset: x <- matrix(nrow = 8, ncol = 2) colnames(matrix) <- c("classification", "soluble_fiber") x[1:4,1] <- "bagel" x[5:8,1] <- "donut" How would I simulate a dataset for a one-way fixed-effect ANOVA (where "classification" is the treatment variable and "soluble_fiber" is the
2010 Jun 15
1
Getting the eigenvectors for the dependent variables from principal components analysis
Dear listserv, I am trying to perform a principal components analysis and create an output table of the eigenvalues for the dependent variables. What I want is to see which variables are driving each principal components axis, so I can make statements like, "PC1 mostly refers to seed size" or something like that. For instance, if I try the example from ?prcomp > prcomp(USArrests,
2010 Jun 19
1
Extracting P-values from the lrm function in the rms library
Hello again R users, I have a devilishly hard problem, which should be very simple. I hope someone out there will have the answer to this on the tip of their tongue. Please consider the following toy example: x <- read.table(textConnection("y x1 x2 indv.1 bagels 4 6 indv.2 donuts 5 1 indv.3 donuts 1 10 indv.4 donuts 10 9 indv.5 bagels 0 2 indv.6 bagels 2 9 indv.7 bagels 8 5 indv.8