similar to: How to extract range of colums in a data frame

Displaying 20 results from an estimated 110 matches similar to: "How to extract range of colums in a data frame"

2008 Dec 24
2
Compressing String in R
Dear all, What's the R way to compress the string into smaller 2~3 char/digit length. In particular I want to compress string of length >=30 characters, e.g. ACGATACGGCGACCACCGAGATCTACACTCTTCC The reason I want to do that is because, there are billions of such string I want to print out. And I need to save disk space. - Gundala Viswanath Jakarta - Indonesia
2009 Dec 18
1
The RSQLite version of dbGetQuery drops colums
Hi all, I just noticed (the hard way of course) that when a query returns 0 rows, the columns in the resulting data.frame get dropped as well. See the following example code (where conn is an active connection to an SQLite db): > dbGetQuery(conn, "select 1 as hey, 2 as ho where 1") hey ho 1 1 2 > dbGetQuery(conn, "select 1 as hey, 2 as ho where 0") data frame
2011 Feb 24
1
Removing -Inf values from all the colums in a dataframe
Hi there, b is my dataframe. I have a dataframe. I am trying to get rid of the -INF values but didnt have much luck b[which(is.finite(b))] I can get rid of it for a single column b[,1][which(is.finite(b[,2]))] but not for all dataframe I used it inside of a sapply but still no dice my guess is it might have some differing row numbers and just ignoring the columns itself. Thanks Ramya
2011 Jun 27
1
show colums x till end
Hey again, I didn't wat questions to get mangled up, so here's my second email. In matlab, there is the simple possibility to access colums x till last of a matrix using mydata(1:3, 5:end). In R, I so far use mydata[1:3, 5:ncol(mydata)] Is there a faster way? (in terms of typing) Thanks ahead, Berry ------------------------------------- Berry Boessenkool University of Potsdam,
2012 Jun 27
1
how to convert list of matrix (raster:extract o/p) to data table with additional colums (polygon Id, class)
Hi List, I have a raster and a polygon with attribute ID and Class. I want to have the fraction of each class present in each pixel of raster. I have use the raster::extract to get the value and weights as below. ex<-extract(raster,polygon,weighted=TRUE) this gives me [[1]] value weight 13943 0.24 13958 0.02 13959 0.84 13960 0.19 13987 0.03 13988 0.31 13990 0.30 [[2]]
2012 Apr 25
1
Create new Vector based on two colums
Hello, I am trying to get a new vector 'x1' based on the not NA-values in column 'a' and 'b'. I found a way but I am sure this is not the best solution. So any ideas on how to "optimize" this would be great! m <- factor(c("a1", "a1", "a2", "b1", "b2", "b3", "d1", "d1"), ordered
2008 Apr 02
1
How to best read in this data / Switching rows and colums
Hi, I have to read in data which looks like this: SeriesA, 5, 5, 5, 5 SeriesB, 8, 5, 8, 8, 7, 10, 2, 7, 3 SeriesC, 5, 5, 8, 4, 7, 7, 4, 5 SeriesD, 5, 9, 5, 4, 2, 3, 10, 1 SeriesE, 7, 10, 9, 5, 8, 6, 10, 9, 5, 10, 4, 3, 2, 10, 8, 8, 10, 10, 10 SeriesF, 1, 2, 1, 5, 1, 7, 5, 7, 7, 3 There are actually much more data points in the data, each line contains between 300 and 500 values. If I use
2005 Jan 03
3
colums in ''shorewall show connections'' command
I do not understand some colums in the output to ''shorewall show connections'' /root> shorewall show connections Shorewall-2.0.2f Connections at firewall - Mon Jan 3 13:12:52 PST 2005 .. tcp 6 353296 ESTABLISHED src=112.129.244.121 dst=224.81.133.205 sport=3647 dport=443 src=224.81.133.205 dst=112.129.244.121 sport=443 dport=3647 [ASSURED] use=1 I would like to know
2018 Jan 15
0
barplot that displays sums of values of 2 y colums grouped by different variables
https://stackoverflow.com/questions/25070547/ggplot-side-by-side-geom-bar On Mon, Jan 15, 2018 at 9:39 PM, Kenneth Dyson <kenneth at kidscodejeunesse.org > wrote: > Hi Eric, > > Thanks for the detailed response. > This is not exactly what I want to do but is close. > I want 2 bars for each city, 1 with the sum for "yes" , the other, beside > it, with the sum for
2008 Mar 08
1
Deleting rows satisfying a certain condition (sum of some colums>2)
I have a huge matrix and need to delete certain rows. What I need to do is: 1.In each row, calculate the sum of jth column and (J+2)th column 2. If the sum is greater than 2 then that row needs to be deleted. I have a sample matrix and my codes here. It does remove some rows but when it does, it skips the next row and each time it deletes a row, the dimension changes so it gets out of bound. I
2006 Apr 04
4
Find records based on associated table''s colums
Hello, Let''s say I have a model for a "house". Each house has_a "city", which in turn has_a "state" which in turn has_a "country". The objective is to retrieve all houses in a given state, say "Massachusetts". Being new to Ruby on Rails what I like is that things that should be simple usually are simple, and since we have easy access to
2018 Jan 15
0
barplot that displays sums of values of 2 y colums grouped by different variables
It is not generally advisable to get too fancy with stat functions in ggplot... things can easily get more complicated than ggplot is ready to handle when it comes to calculations. It is better to create data that corresponds directly to the graphical representations you are mapping them to. Read [1] for more on this philosophy. [1] H. Wickham, Tidy Data, Journal of Statistical Software,
2006 Aug 24
5
Check values in colums matrix
Dear all, I apologize if my question is quite simple. I have a dataset (20 columns & 1000 rows) which some of columns have the same value and the others have different values. Here are some piece of my dataset: obj <- cbind(c(1,1,1,4,0,0,1,4,-1), c(0,1,1,4,1,0,1,4,-1), c(1,1,1,4,2,0,1,4,-1), c(1,1,1,4,3,0,1,4,-1), c(1,1,1,4,6,0,1,5,-1),
2007 Jun 05
3
read table
Hi, I'm a novice of R. I want to read the following table into R: names mpg cyl disp hp drat Mazda RX4 21.0 6 160.0 110 3.90 Mazda RX4 Wag 21.0 6 160.0 110 3.90 The command I used is: > test <- read.table(file.choose(),header=T) The result is: Error in read.table(file.choose(), header = T) : more columns than column names
2018 Jan 15
5
barplot that displays sums of values of 2 y colums grouped by different variables
I am trying to create a barplot displaying the sums of 2 columns of data grouped by a variable. the data is set up like this: "city" "n" "y" <br> mon 100 200 <br> tor 209 300 <br> edm 98 87 <br> mon 20 76 <br> tor 50 96 <br> edm 62 27 <br> the resulting plot should have city as the x-axis, 2 bars per city, 1 representing
2009 Oct 29
2
Rounding and printing
Hello, I am trying to print a table with numbers all rounded to the same number of digits (one after the decimal), but R seems to want to not print ".0" for integers. I can go in and fix it one number at a time, but I'd like to understand the principle. Here's an example of the code. The problem is the 13th element, 21 or 21.0: >nvb_deaths <- round(ss[,10]/100,digits=1)
2013 Apr 12
3
Why copying columns of a data.frame becomes numeric?
Dear list, I want the 1st, 2nd, 5th, and 6th columns of mtcars. After copying them, the columns become numeric class rather than data frame. But, when I copy rows, they data frame retains its class. Why is this? I don't see why copying rows vs columns is so different. > class(mtcars) [1] "data.frame" > head(mtcars) mpg cyl disp hp drat wt qsec vs
2012 Mar 03
3
How to read this data properly?
Dear all, I have been given a data something like below: Dat = "2 3 28.3 3.05 8 3 3 22.5 1.55 0 1 1 26.0 2.30 9 3 3 24.8 2.10 0 3 3 26.0 2.60 4 2 3 23.8 2.10 0 3 2 24.7 1.90 0 2 1 23.7 1.95 0 3 3 25.6 2.15 0 3 3 24.3 2.15 0 2 3 25.8 2.65 0 2 3 28.2 3.05 11 4 2 21.0 1.85 0 2 1 26.0 2.30 14 1 1 27.1 2.95 8 2 3 25.2 2.00 1 2 3 29.0 3.00 1 4 3 24.7 2.20 0 2 3 27.4 2.70 5 2 2 23.2 1.95
2006 Jan 18
3
linear contrasts with anova
I have some doubts about the validity of my procedure to estimeate linear contrasts ina a factorial design. For sake of semplicity, let's imagine a one way ANOVA with three levels. I am interested to test the significance of the difference between the first and third level (called here contrast C1) and between the first and the seconda level (called here contrast C2). I used the following
2017 Jun 01
3
odfWeave - A loop of the "same" data
Before I go and do this another way - can I check if anyone has a way of looping through data in odfWeave (or possibly sweave) to do a repeating analysis on subsets of data? For simplicity lets use mtcars dataset in R to explain. Dataset looks like this: > mtcars mpg cyl disp hp drat wt ... Mazda RX4 21.0 6 160 110 3.90 2.62 ... Mazda RX4 Wag 21.0 6 160 110 3.90