Displaying 20 results from an estimated 3000 matches similar to: "Removing rows if certain elements are found in character string"
2010 Jul 06
2
How to plot confidence bands for nls
I adjusted an exponential regression to the following data and wish to plot
confidence bands as well. Is this possible?
Any help greatly appreciated.
Claudia
x <- c(1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000,2001,
2002,2003,2004,2005,2006,2007,2008,2009)
y <- c(987,937,810,749,1087,807,1050,1294,1455,1022,927,403,698,1191,1078,
1176,1125,936,1263,647,868)
dat <-
2012 Jul 30
2
Alternating between "for loops"
Dear All,
I would like to apply two different "for loops" to each set of four columns
of a matrix (the loops here are simplifications of the actual loops I will
be running which involve multiple if/else statements).
I don't know how to "alternate" between the loops depending on which column
is "running through the loop" at the time.
## Set up matrix
J <- 10
N
2010 May 03
1
rpart, cross-validation errors question
I ran this code (several times) from the Quick-R web page (
http://www.statmethods.net/advstats/cart.html) but my cross-validation
errors increase instead of decrease (same thing happens with an unrelated
data set).
Why does this happen?
Am I doing something wrong?
# Classification Tree with rpart
library(rpart)
# grow tree
fit <- rpart(Kyphosis ~ Age + Number + Start,
2010 May 14
1
Cubic B-spline, how to numerically integrate?
(corrected version of previous posting)
I fit a GAM to turtle growth data following methods in Limpus & Chaloupka
1997 (http://www.int-res.com/articles/meps/149/m149p023.pdf).
I want to obtain figures similar to Fig 3 c & f in Limpus & Chaloupka
(1997), which according to the figure legend are "expected size-at-age
functions" obtained by numerically integrating
2010 May 13
1
GAM, GAMM and numerical integration, help please
I am trying to apply methods used by Chaloupka & Limpus (1997) (
http://www.int-res.com/articles/meps/146/m146p001.pdf) to my own turtle
growth data.
I am having trouble with two things...
1) After the GAM is fit, the residuals are skewed.
>m1 <- gam(growth~s(mean.size,
bs="cr")+s(year,bs="cr",k=7)+s(cohort,bs="cr")+s(age,bs="cr"),
data=grow,
2013 Mar 21
2
Displaying median value over the horizontal(median)line in the boxplot
Hi,
set.seed(45)
test1<-data.frame(columnA=rnorm(7,45),columnB=rnorm(7,10)) #used an example probably similar to your actual data
apply(test1,2,function(x) sprintf("%.1f",median(x)))
#columnA columnB
# "44.5"? "10.2"
par(mfrow=c(1,2))
lapply(test1,function(x) {b<-
2012 Oct 30
3
subtract a time period from a date
Hello everybody,
how can I reduce e.g. 30 days from a date?
When I do the following "2011-05-01 CEST" -"2011-04-01 CEST" I get:
"Time difference of 30 days"
an thats fine.
But when I try "2011-05-01 CEST" - 30 I get nonsense.
So how can I subtract some days, month or years from a date?
thanking you in anticipation
Claudia Paladini
2012 Oct 14
6
transforming a .csv file column names as per a particular column rows using R code
Hello all,
I have a .csv file like below.
Tool,Step_Number,Data1,Data2... etc up to 100 columns.
A,1,0,1
A,2,3,1
A,3,2,1
.
.
B,1,3,2
B,2,1,2
B,3,3,2
.
.
...... so on upto 50 rows
where the column "*Tool*" has distinct steps in second column
"*Step_Number*",but both have same entries in Step_Number column.
I want the output like below.
2012 Sep 28
3
Better way of Grouping?
Hello R users,
This is more of a convenience question that I hope others might find useful
if there is a better answer. I work with large datasets that requires
multiple parsing stages for different analysis. For example, compare group
3 vs. group 4. A more complicated comparison would be time B in group 3 of
group L with B in group 4 of group L. I normally subset each group with
the
2012 Jul 12
3
plot graph by first letter
Hi all, may i know is it possible to plot a graph by first letter?
for example:
Name: Age:
Angel 20
Amelia 20
Bernard 19
Stephanie 20
Vanessa 22
Angeline 23
Camel 21
If I want to plot the name started with letter 'A' and their Angel,
2023 Jan 14
1
Removing variables from data frame with a wile card
You rang sir?
library(tidyverse)
xx = 1:10
yr1 = yr2 = yr3 = rnorm(10)
dat1 <- data.frame(xx , yr1, yr2, y3)
dat1 %>% select(!starts_with("yr"))
or for something a bit more exotic as I have been trying to learn a bit
about the "data.table package
library(data.table)
xx = 1:10
yr1 = yr2 = yr3 = rnorm(10)
dat2 <- data.table(xx , yr1, yr2, yr3)
dat2[, !names(dat2)
2013 Oct 18
1
read table and import of a text file
Hi,
Assuming that you provided the sample data from the file.
temp <- readLines(textConnection("#Hogd/met, Temp, 005[M], Value
#Hogd/met, Difftemp, 051[M], Value
BA0+
1 MTEMP005 1 [deg.C]
2 MDTMP051 1 [deg.C]
EOH
891231, 2400, -1.5, -0.21,
900101, 0100, -1.4, -0.25,
900101, 0200, -1.6, -0.28,
900101, 0300, -1.7, -0.25,
900101, 0400, -2.1, -0.0999999,
900101, 0500, -2.3, -0.0899999,
2013 Mar 03
4
Help searching a matrix for only certain records
Let me start by saying I am rather new to R and generally consider myself to be a novice programmer...so don't assume I know what I'm doing :)
I have a large matrix, approximately 300,000 x 14. It's essentially a 20-year dataset of 15-minute data. However, I only need the rows where the column I've named REC.TYPE contains the string "SAO " or "FL-15".
My
2023 Jan 14
3
Removing variables from data frame with a wile card
Steven,
Just want to add a few things to what people wrote.
In base R, the methods mentioned will let you make a copy of your original DF that is missing the items you are selecting that match your pattern.
That is fine.
For some purposes, you want to keep the original data.frame and remove a column within it. You can do that in several ways but the simplest is something where you sat the
2011 Aug 05
1
If find x, then y, else do nothing
I want to write code that says "If you find an element equal to 4 in this
vector for each person in the data set tested separately, then put in 1 for
2 and 2 for 4, else leave the variable as is"
u.ppl <- (unique(init.dat1$grid))
l.ppl <- length(u.ppl)
for (i in 1:l.ppl)
{
if (grep("4",init.dat1$Slide1_RESP)) {2 == 1, 4 == 2}; else
2013 Apr 14
1
possible loop problem
Hi,
It would be better if you provided the output of dput(dataset).? I am not sure about the structure of your dataset.
Just from reading the data as is shown.
dat1<- read.table(text="
separator,tissID
>,>,2
,2,1
,6,5
,11,13
>,>,4
,4,9
,6,2
,7,3
,21,1
,23,58
,25,9
,26,4
>,>,11
,1,12
>,>,21
,4,1
,11,3
2012 Sep 15
4
how to view only readings of a selected data from a column while the other columns remain
Hi Friends
I am new here and have a problem
Year Market Winner BID
1 1990 ABC Apple 0.1260
2 1990 ABC Apple 0.1395
3 1990 EFG Pear 0.1350
4 1991 EFG Apple 0.1113
5 1991 EFG Orange 0.1094
For each year and separately for the two
2012 Dec 17
7
split character line into rows
Hey R users,
suppose we have data:
[1] 2010.12.26 00:00:52 688,88 11,69 43,00
[2] 11,69 43,00
[3] 11,69 43,00
[4] 11,69 43,00
[5] 11,69 43,00
[6] 11,69 43,00
[7] 11,69 43,00
[8] 11,69 43,00
[9] 11,69 43,00
[10] 11,69 43,00
[11] 11,69 43,00
[12] 11,69 43,00
[13] 11,69 43,00
[14] 11,69 43,00
[15] 11,69
2012 Aug 27
2
simplest way (set of functions) to parse a file
Hello,
What would be the best set of R functions to parse and transform a file?
My file looks as shown below. I would like to plot this data and I need to parse it into a single data frame that sorts of "transposes the data" with the following structure:
> df <- data.frame(n=c(1,1,2,2),iter=c(1,2,1,2),step=as.factor(c('Step 1', 'Step2', 'Step 1',
2013 Aug 30
3
Memory usage bar plot
Hi,
I haven't tried the code yet. Is there a way to parse this data
using R and create bar plots so that each program's 'RAM used' figures are
grouped together.
So 'uuidd' bars will be together. The data will have about 50 sets. So if
there are 100 processes each will have about 50 bars.
What is the recommended way to graph these big barplots ? I am looking