Displaying 20 results from an estimated 4000 matches similar to: "Create sequential vector for values in another column"
2013 Aug 24
1
Divide the data into sub data on a particular condition
Hi,
Use ?split()
#dat1 is the dataset:
lst1<- split(dat1,dat1$BaseProd)
lst1
#$`2231`
?# BaseProd? CF OSA
#1???? 2231 0.5 0.7
#2???? 2231 0.8 0.6
#3???? 2231 0.4 0.8
#
#$`2232`
?# BaseProd CF OSA
#4???? 2232? 1?? 2
#5???? 2232? 3?? 1
#
#$`2233`
?# BaseProd? CF OSA
#6???? 2233 0.9 0.5
#7???? 2233 0.7 0.5
#8???? 2233 4.0 5.0
#9???? 2233 5.0 7.0
lst1[[1]]
#? BaseProd? CF OSA
#1???? 2231 0.5 0.7
2013 May 13
2
reduce three columns to one with the colnames
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt.
Name: nicht verf?gbar
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20130513/fe848ce7/attachment.pl>
2012 Oct 06
1
arrange data
Dear r-users,
I have dailly rainfall data from year 1971 to 2000. I use aggregate to form monthly rainfall data. What I don't understand is that the data for the year 2000 become on the top, instead of year 1971. Here are some codes and output:
agg_dt1 <- aggregate(x=dt1[,4],by=dt1[,c(1,2)],FUN=sum)
> head(agg_dt1,20); tail(agg_dt1,20)
Tahun Bulan x
1 0 1 398.6
2013 Feb 04
4
If() values in one dataframe then return values from another
I have a large data frame ("data1") that looks like:
A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 A16 A17 A18 A19 A20
[1,] 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
[2,] 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 0 0 0 0 0
[3,] 1 1 0 1 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 0
[4,] 1 1 1 1
2012 Sep 17
1
How to filter information from a big .csv table into a new table
Hi,
I have big .csv file. I would like to filter that file into a new table.
For example, I have .csv file as below:
f1 f2 f3 f4 f5 f6 f7 f9 f10 f11
t1 1 0 1 0 1 0 0 0 0 1
t2 1 0 0 0 0 1 1 1 1 1
t3 0 0 0 0 0 0 0 0 0 0
t4 1 0 0 0 1 0 0 0 0 0
t5 0 0 0 0 0 0 0 0 0 0
t6 0 0 0 0 0 0 0 0 0 0
2016 Apr 29
2
selecting columns from a data frame or data table by type, ie, numeric, integer
Good morning RGuru's
I have a data frame of 575 columns.? I want to extract only those columns that are numeric(double) or integer to do some machine learning with.? I have searched the web for a couple of days (off and on) and have not found anything that shows how to do this.?? Lots of ways to extract rows, but not columns.? I have attempted to use "(x == y)" indices extraction
2023 Nov 03
2
Sum data according to date in sequence
Hi,
I tried this:
# extract date from the time stamp
dt1 <- cbind(as.Date(dt$EndDate, format="%m/%d/%Y"), dt$EnergykWh)
head(dt1)
colnames(dt1) <- c("date", "EnergykWh")
and
my dt1 becomes these, the dates are replace by numbers.
dt1 <- cbind(as.Date(dt$EndDate, format="%m/%d/%Y"), dt$EnergykWh)
dput(head(dt1))
colnames(dt1) <-
2012 Aug 10
4
subsetting levels of a vector
Hi,
I need to subset different levels of vector in a dataset to create a new dataframe that contains only these. These observations are not numerical, so I can't use the subset() function (at least this is the response I get from R).
Suppose the dataframe looks like this:
ParticipID ERP Electrode
1 s1 0.0370 FP1
2 s2 35.0654 FP2
3 s3
2007 Jun 06
1
fixed effects anova in lme lmer
Can lme or lmer fit a plain regular fixed effects anova? Ie a model without a
random effect, or have there be at least one random effect in order for these
functions to work?
Trying to run such, (1) without specifying a random effect produces an error,
(2) specifying that there is no random effect does not produce the same output
as an anova run in lm(); (2b) specifying that there is no
2016 Apr 29
0
selecting columns from a data frame or data table by type, ie, numeric, integer
> dt1[ vapply(dt1, FUN=is.numeric, FUN.VALUE=NA) ]
a c
1 1 1.1
2 2 1.0
...
10 10 0.2
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Fri, Apr 29, 2016 at 9:19 AM, Carl Sutton via R-help <
r-help at r-project.org> wrote:
> Good morning RGuru's
> I have a data frame of 575 columns. I want to extract only those columns
> that are numeric(double) or integer to do
2014 Jul 26
20
[RFC PATCH 00/11] Refactor MSI to support Non-PCI device
Hi all,
The series is a draft of generic MSI driver that supports PCI
and Non-PCI device which have MSI capability. If you're not interested
it, sorry for the noise.
The series is based on Linux-3.16-rc1.
MSI was introduced in PCI Spec 2.2. Currently, kernel MSI
driver codes are bonding with PCI device. Because MSI has a lot
advantages in design. More and more non-PCI devices want to
use
2014 Jul 26
20
[RFC PATCH 00/11] Refactor MSI to support Non-PCI device
Hi all,
The series is a draft of generic MSI driver that supports PCI
and Non-PCI device which have MSI capability. If you're not interested
it, sorry for the noise.
The series is based on Linux-3.16-rc1.
MSI was introduced in PCI Spec 2.2. Currently, kernel MSI
driver codes are bonding with PCI device. Because MSI has a lot
advantages in design. More and more non-PCI devices want to
use
2007 Sep 25
2
Need help with function writing
Hello:
If anyone could guide me with this I would greatly appreciate it. Thanking you in advance for your assistance.
Using a 3-level input factor alternative so that a function(below) can compute both a two-sided and one-sided p-values. Making the two-sided test the default. And produce output information about which alternative was tested. Where would I place the ifelse statement?
2007 Jul 27
3
(PR#9811) sequence(c(2, 0, 3)) produces surprising results,
This is as doumented, and I think you could say the same thing of seq().
BTW, sequence() allows negative inputs, and I don't think you want
sum(input) in that case.
I've never seen the point of sequence(), but it has been around in R for a
long time. It is used in packages eRm, extRemes, hydrosanity, klaR, seas.
Who knows what people have in private code, so I don't see any
2014 Aug 20
1
[RFC PATCH 11/11] x86/MSI: Refactor x86 MSI code
> -----Original Message-----
> From: linux-pci-owner at vger.kernel.org [mailto:linux-pci-owner at vger.kernel.org]
> On Behalf Of Yijing Wang
> Sent: Saturday, July 26, 2014 8:39 AM
> To: linux-kernel at vger.kernel.org
> Cc: Xinwei Hu; Wuyun; Bjorn Helgaas; linux-pci at vger.kernel.org;
> Paul.Mundt at huawei.com; James E.J. Bottomley; Marc Zyngier; linux-arm-
> kernel at
2014 Aug 20
1
[RFC PATCH 11/11] x86/MSI: Refactor x86 MSI code
> -----Original Message-----
> From: linux-pci-owner at vger.kernel.org [mailto:linux-pci-owner at vger.kernel.org]
> On Behalf Of Yijing Wang
> Sent: Saturday, July 26, 2014 8:39 AM
> To: linux-kernel at vger.kernel.org
> Cc: Xinwei Hu; Wuyun; Bjorn Helgaas; linux-pci at vger.kernel.org;
> Paul.Mundt at huawei.com; James E.J. Bottomley; Marc Zyngier; linux-arm-
> kernel at
2011 Apr 03
2
converting "call" objects into character
Dear all,
I would like to log the calls to my functions. I am trying to do this using the function match.call():
fTest<-function(x)
{
theCall<-match.call()
print(theCall)
return(x)
}
> fTest(2)
fTest(x = 2)
[1] 2
I can see "theCall" printed into the console, but I don't manage to convert it into a character to write it into a log file
2012 Nov 27
4
Finding values in one column and
All -
I have a data frame
data.a
ID valueA valueB
6 12 12
17 15 14
58 18 16
98 11 12
73 19 20
84 19 14
58 20 14
24 11 12
81 15 16
21 15 14
62 14 12
67 13 14
78 13 17
35 10 13
13 11 15
14 17 18
85 16 15
35 13 9
18 15 16
and a data frame
data.b
ID valueA valueB
6
84
21
78
14
I'd like to have R find the data.b$ID in data.a$ID and insert the
corresponding data.a$valueA and
2012 Dec 11
5
Retain last grouping after a strsplit()
All -
I have a column of SiteNames:
SiteName
OYS-PIA2-FL-1
OYS-PIA2-LA-1
OYS-PI-LA-BB-1
OYS-PIA2-LA-10
...
[truncated]
and I want to include only the last few digits into a new column.
I tried
substr(data$SiteName, 13, 20)
but because some SiteName values are of a different length, the final
hyphen (i.e., "-") was included:
"1"
"1"
"-1"
"10"
2011 Oct 08
1
HWEBayes, swapping the homozygotes genotype frequencies
I evaluated the Bayes factor in the k=2 allele case with a "triangular"
prior under the null as in the example in the help file:
HWETriangBF2(nvec=c(88,10,2))
[1] 0.4580336
When I swap the n11 entry and n22 entry of nvec, I received totally
different Bayes factor:
>
> HWETriangBF2(nvec=c(2,10,88))
[1] 5.710153
>
In my understanding, defining the genotype frequency as