similar to: Constructing lists (yet, again)

Displaying 20 results from an estimated 5000 matches similar to: "Constructing lists (yet, again)"

2012 Mar 17
2
Reading then transposing from file
Hi, I'm an R beginner and I'm struggling with what should be a rudimentary task. My data is along these lines: ID name1 name2 name3 name4 Class 0 1 0 2 Var1 A B C A Var2 B C C A Var3 C A B A etc. I'm using the following: foo <- data.frame(t(read.table("file", header=FALSE))) but of course now it's not using ID, Class, etc. as column names. As you can imagine,
2000 Oct 16
2
renaming an object
Say I have a file called exp.batch which contains 2 cols The first col contains names of R objects the user would like to use. The second col contains the file names which will be read in using read.table i.e. exp.batch may look like this..... name1 complex/filename/path1.txt name2 complex/filename/path2.txt name3 complex/filename/path3.txt name4 complex/filename/path4.txt I want to have a
2010 May 26
1
Xen guest does not autostart
I have a virtual machine stack which was purely Centos 5.4 the last time I rebooted and experienced this problem: one of the guests does not start automatically after reboot. [root at farm1 xen]# pwd /etc/xen [root at farm1 xen]# ls -l auto total 0 lrwxrwxrwx 1 root root 8 Dec 11 17:25 name1 -> ../name1 lrwxrwxrwx 1 root root 8 May 5 21:10 name2 -> ../name2 lrwxrwxrwx 1 root root 8 Nov
2010 Feb 23
3
how to rearrange a dataframe
Hi all, I'd appreciate if anyone can help me with this... I have a data frame that looks like this: 1 + name1 1 2 3 2 + name2 5 9 10 2 - name3 56 74 93 1 - name4 65 75 98 I need to rearrange this in a way so that the rows with "1" in the first column, and "-" in the second column; then columns 4 and 6 should switch places. That is, column 6 would be now column 4 and
2012 Dec 17
3
Merge more than 2 dataframe
Hello. I have for example 4 or more dataframe which like such this example: date value 2006-11 0.4577647 2006-12 NaN 2006-10 0.1577647 2006-11 0.3577647 2006-12 NaN 2007-01 NaN 2007-02 NaN 2007-03 0.2956429 2007-01 0.3677647 2007-02 NaN They have the same length. I need merge by date undefined number of dataframes. End result output will look like
2018 Mar 21
2
how to add a child to a child in XML
I am trying to add a child to a child using XML package in R. the following fails library(XML) node1 <- c("val1","val2","val3") names(node1) <- c("att1","att2","att3") root <- xmlNode("root", attrs=node1) node2 <- LETTERS[1:3] names(node2) <- paste("name",1:3,sep="") root <-
2006 Aug 11
1
Group By
Hi, I have a table similar structure below. id name position page 1 name1 1 1 2 name2 2 1 3 name3 3 1 4 name4 1 1 5 name5 1 1 6 name6 1 2 What i want is to select all the items for a given page number grouped by pos and displayed in a view using a loop like: display position number, number of records for
2012 Mar 16
1
R merge two dataframes with different row?
Hi everyone, I have a question for R code to merge. Say I have two dataframes: File1 is: V1 V2 V3 V4 1 100 101 name1 2 200 201 name2 2 300 301 name3 3 400 401 name4 3 500 501 name5 4 600 601 name6 4 700 701 name7 File2 is: V1 V2 V3 V4 1 50 55 p1 3 402 449 p2 4 550 650 p3 4 651 660
2018 Mar 22
2
how to add a child to a child in XML
Big thanks. newXMLNode works great. Wonder why it is not included in the documentation. There is newXMLDoc and newXMLNamespace, but no mention of newXMLNode. Stephen From: Ben Tupper [mailto:btupper at bigelow.org] Sent: Wednesday, March 21, 2018 6:18 PM To: Bond, Stephen Cc: r-help Subject: Re: [R] how to add a child to a child in XML Hi, XML doesn't use the `$` to access child nodes.
2018 Mar 21
0
how to add a child to a child in XML
Hi, XML doesn't use the `$` to access child nodes. Instead use either `[name]` to get a list of children of that name or `[[name]]` to get the just the first child of that name encountered in the genealogy. Thus for your example... > root$child1 NULL > root[['child1']] <child1 name1="A" name2="B" name3="C"/> On the other hand, you might
2009 Sep 06
1
struggling with "split" function
I am very sorry for such a simple question, but I am struggling with "split". I have the following data frame: x<-data.frame(A=c(NA,NA,NA,NA,"split",NA,NA,NA,NA,"split",NA,NA,NA,NA,"split",NA,NA,NA,NA),
2009 Oct 20
2
LDA Precdict - Seems to be predicting on the Training Data
When I import a simple dataset, run LDA, and then try to use the model to forecast out of sample data, I get a forecast for the training set not the out of sample set. Others have posted this question, but I do not see the answers to their posts. Here is some sample data: Date Names v1 v2 v3 c1 1/31/2009 Name1 0.714472361 0.902552278 0.783353694 a 1/31/2009 Name2 0.512158919 0.770451596
2017 Jul 16
3
Arranging column data to create plots
Dear All, I need some help arranging data that was imported. The imported data frame looks something like this (the actual file is huge, so this is example data) DF: IDKey X1 Y1 X2 Y2 X3 Y3 X4 Y4 Name1 21 15 25 10 Name2 15 18 35 24 27 45 Name3 17 21 30 22 15 40 32 55 I would like to create a new data frame with the following NewDF: IDKey X Y Name1 21 15 Name1
2006 Jan 20
3
Selecting data frame components by name - do you know a shorter way?
Hi! I suspect there must be an easy way to access components of a data frame by name, i.e. the input should look like "name1 name2 name3 ..." and the output be a data frame of those components with the corresponding names. I ´ve been trying for hours, but only found the long way to do it (which is not feasible, since I have lots of components to select):
2020 Jul 23
5
Off Topic bash question
I have a simple script: #!/bin/bash # index=0 total=0 names=() ip=() while read -r LINE do NODENAME=` echo $LINE | cut -f 1 -d ','` IP=` echo $LINE | cut -f 2 -d ','` names[index]="$NODENAME" ip[index]="$IP" index=`expr index+1` total=`expr total+1` done <<< $(cat list.txt) simple file: more list.txt name1,ip1 name2,ip2 name3,ip3 output when
2001 May 23
1
Passing a string variable to Surv
Hi, I am trying to write a function to automate multiple graph generation. My data looks like: Table of numeric values with the following headers: timeM1 statusM1 xM1 timeM2 statusM2 xM2 timeM3 statusM3 xM3 1 2 3 4 5 6 Where M1,M2, M3 hve no similarity except they have a max string length of 7. Examples are mcw0045, adl0003, lei0101. Now, what I want to do is Function(M1, M2,
2008 May 25
3
naming components of a list
Hi I have a character vector with thousands of names which looks like this: > V=c("Fred", "Mary", "SAM") > V [1] "Fred" "Mary" "SAM" > class(V) [1] "character" I would like to change it to a list: > L=as.list(V) > L [[1]] [1] "Fred" [[2]] [1] "Mary" [[3]] [1] "SAM" but I need to
2017 Jul 16
0
Arranging column data to create plots
On Sat, 15 Jul 2017, Michael Reed via R-help wrote: > Dear All, > > I need some help arranging data that was imported. It would be helpful if you were to use dput to give us the sample data since you say you have already imported it. > The imported data frame looks something like this (the actual file is > huge, so this is example data) > > DF: > IDKey X1 Y1 X2 Y2
2017 Jun 04
2
Warning from reshape2 when melting a data frame with uneven number of columns.
Here is a small reproducible example: data <- structure(list(V1 = structure(1:3, .Label = c("Name1", "Name2", "Name3"), class = "factor"), V2 = structure(c(1L, 3L, 2L), .Label = c("nam1", "name-1", "name_12"), class = "factor"), V3 = structure(1:3, .Label = c("nam2", "nam_34",
2018 Mar 22
0
how to add a child to a child in XML
Hi, It's a reasonable question. The answer is that it actually is included, but there are many instances across packages where multiple functions are documented on a single help page. The following brings up such a page... (for XML_3.98-1.9) > library(XML) > ?newXMLNode You can see the same on line... https://www.rdocumentation.org/packages/XML/versions/3.98-1.9/topics/newXMLDoc