similar to: How to change row value based on previous row value

Displaying 20 results from an estimated 10000 matches similar to: "How to change row value based on previous row value"

2010 Sep 14
1
NA confusion (length question)
Hi folks, I am running a very simple regression using mylm <- lm(mass ~ tarsus, na.action=na.exclude) I would like the use the residuals from this analysis for more regression but I'm running into a snag when I try cbind(mylm$residuals, mydata) # where my data is the original data set The error tells me that it cannot use cbind because the length of mylm$residuals is
2006 Mar 02
1
Curious subsetting behavior
I have a simple vector, called tmp that I want to subset based on another vector called vec. Everything works as expected except for below where the subsetting returns something other than the original data. Any ideas? > vec <- c(1,2,3,4,5,59,60,27,32,21) > tmp [1] 1.0 1.1 2.0 2.1 2.2 3.0 3.1 4.0 5.0 5.1 6.0 7.0 8.0 8.1 9.0 [16] 9.1 9.2 10.0 10.1 11.0 12.0 13.0 14.0
2013 Jan 03
2
Sas by function in R
Hello, It's an alternative to use SAS by function in R? I want to plot d histograms by plot.from example bellow: Thank you! plot d 1 1 16.3 2 1 25.0 3 1 57.8 4 1 17.0 5 2 10.8 13 2 96.4 17 3 76.0 18 3 32.0 19 3 11.0 20 3 11.0 24 3 106.0 25 3 12.5 21 4 19.3 22 4 12.0 26 4 15.0 27 5 99.3 32 7 11.0 36
2020 Nov 24
2
ID Mapping
Hi, I'm using samba for login in Linux via Active Directory (win 2008). In my Active Directory, there is a user "jin", and its primary group is "xts", its supplementary group is "Domain Users". I found that the gid mapping is inconsistent with different samba version. That is: For samba-4.4.4: # id jin uid=30000(jin) gid=30000(xts)
2010 Apr 05
2
find the "next non-NA" value within each row of a data-frame
#I wish to find the "next non-NA" value within each row of a data-frame. #e.g. I have a data frame mydata. Rows 1, 2 & 3 have soem NA values. mydata <- data.frame(matrix(seq(20*6), 20, 6)) mydata[1,3:5] <-  NA mydata[2,2:3] <-  NA mydata[2,5] <-  NA mydata[3,6] <-  NA mydata[1:3,] #this loop accomplishes the task; I am tryign toi learn a "better" way for(i
2010 Apr 16
2
managing data and removing lines
Hi, I am very new to R and I've been trying to work through the R book to gain a better idea of the code (which is also completely new to me). Initially I imputed my data from a text file and that seemed to work ok, but I'm trying to examine linear relationships between gdist and gair, gdist and gsub, m6dist and m6air, etc. This didn't work and I think it might have something to do
2020 Nov 24
1
ID Mapping
Your 'range' in your 4.6.2 config is different than the one in your 4.4.4 config. Try setting it to: 'idmap config *:range = 30000-40000' , to see if the issue no longer occurs. On Tue, 2020-11-24 at 09:17 +0800, ??? via samba wrote: > Hi, > > ????I'm using samba for login in Linux via Active Directory (win > 2008). > > ????In my Active Directory, there is
2008 Jul 28
3
Fill in NA values in vector with previous character/factor
I have a vector of data (species names) interspersed with NA values and I want a function to "fill in the blanks", replacing NA values with whatever the last species name was. For example the vector: "A","B",NA,NA,"C",NA,NA,NA,NA,"D",NA,NA. should evaluate to: "A" "B" "B" "B" "C"
2006 Oct 15
1
gamma distribution don't allow negative value in GLMs?
Dear friends, when i use glm() to fit my data, i use glm(formula = snail ~ vegtype + mhveg + humidity + elevation + soiltem, *family = Gamma(link = inverse),* data =a,)) It shows: error in eval(expr, envir, enclos) : *gamma distribution don't allow negative value*. But i use result<-glm(formula = snail ~ vegtype + mhveg + humidity + elevation + soiltem, family = poisson, data =a) #this
2020 Nov 24
2
ID Mapping
I'm pretty sure you need to clear your winbind cache after modifying the range. I can't find any official documentation on it anywhere, but I think the process goes like: systemctl stop winbind systemctl stop smbd net cache flush systemctl start winbind systemctl start smbd If that doesn't work you could try clearing the tdb files and the group mapping ldb file in /var/lib/samba (
2006 Jul 01
1
The ZFS Read / Write roundabout
Hey all - Was playing a little with zfs today and noticed that when I was untarring a 2.5gb archive both from and onto the same spindle in my laptop, I noticed that the bytes red and written over time was seesawing between approximately 23MB/s and 0MB/s. It seemed like we read and read and read till we were all full up, then wrote until we were empty, and so the cycle went. Now: as it happens,
2009 May 05
2
problem with ggplot2 boxplot, groups and facets
I have a following problem: The call qplot(wg, v.realtime, data=df.best.medians$gv1, colour=sp, geom="boxplot") works nice: for each value of the wg factor I get two box-plots (two levels in the sp factor) in different colours, side-by-side, centered at the wg x-axis. However, I want to separate the data belonging to different levels of the n factor, so I add the facets option:
2017 Jun 25
1
Fill in empty cell in data.frame from previous value
Excellent Boris, thx ? this helps From: Boris Steipe Sent: June 25, 2017 11:23 AM To: Christophe Elek Cc: r-help at r-project.org Subject: Re: [R] Fill in empty cell in data.frame from previous value Run it through a loop. I assume the cell contents is NA (Not Available). Test for it with is.na(). Whenever that returns TRUE, replace the NA value with the value from the previous row. Cheers, B.
2012 Oct 18
1
filling NA gaps according to previous data mean and following data mean
Hi everybody, I have a little problem about filling some gaps of NAs in my data. These gaps are between nearly constant data (temperature under snow). Here's a fake example to illustrate how it looks like approximately: DF <- data.frame(data=c(-0.51,-0.51,-0.48,-0.6,-0.54,-0.38,-0.6,-0.42,NA,NA,NA,NA,NA,NA,NA, -0.25,-0.41,-0.5,-0.5,-0.35,-0.7,-1,-0.87)) I would like to replace my NAs
2007 May 10
3
Quick question on merging two time-series of different frequencies
Hi, A quick beginner's question. I have two time series, A with daily data, and another B with data at varying frequencies, but mostly annual. Both the series are sorted ascending. I need to merge these two series together in the following way: For any entry of A, the lookup should match with B until we find an entry of B that's larger than A's. For all A[i], i = 1,...,N and B[j],
2007 Apr 20
2
sorting data in R
hello, I'd like know how to sort a data frame in R for example how I should do to sort by Catholic with swiss data frame like below thanks Fertility Agriculture Examination Education Catholic Infant.Mortality Courtelary 80.2 17.0 15 12 9.96 22.2 Delemont 83.1 45.1 6 9 84.84 22.2
2003 Jul 28
1
RE: how to use R to model Reliability problem
Dear R users: I am having problem with following datasets: 4 true measurement: 2 10 15 20 10 repeated measurements for each true measurement 1.9 9.8 14.5 20.2 2.1 10 15 20.1 .... 2.1 9.9 15.1 20.3 how can I use R to model a mixed
2013 Apr 29
1
how to add new rows in a dataframe?
Hi, dat1<- read.table(text=" id??????????????? t???????????????????? scores 2???????????????? 0??????????????????????? 1.2 2???????????????? 2???????????????????????? 2.3 2???????????????? 3??????????????????????? 3.6 2???????????????? 4??????????????????????? 5.6 2???????????????? 6??????????????????????? 7.8 3???????????????? 0??????????????????????? 1.6 3????????????????
2012 Jul 02
2
using "na.locf" from package zoo to fill NA gaps
Hi everybody, I have a small question about the function "na.locf" from the package "zoo". I saw in the help that this function is able to fill NA gaps with the last value before the NA gap (or with the next value). But it is possible to fill my NA gaps according to the last AND the next value at the same time? Actually, I want R to fill my gaps with the method of
2008 Nov 20
2
how to replace NA with previous numbers
Hi, I have a vector with lots of NAs. e.g. vec = c(NA, NA, 2, NA, NA, 5, NA, 6, NA) > vec [1] NA NA 2 NA NA 5 NA 6 NA I would like to replace NAs with their immediately previous non NA number. After replacement, the above vector will become > vec [1] 0 0 2 2 2 5 5 6 6. I understand how to do that with a loop but the actual vector is very long and the loop takes too much time in R.