java中的数据报(Datagrams in java)
在没有使用本机函数发送数据报的情况下java的可能性吗?
Is possibility in java without using native functions to send datagrams ?
原文:https://stackoverflow.com/questions/2168114
最满意答案
假设文件在工作目录中,我们用
list.files()
列出文件,通过list.files()
循环读取它们,提取前缀('Site1','Site2'),中间部分('处理','NoTreatment')使用sub
,使用Map
在每个list
元素中创建列'Site'和'Treatment',然后rbind
创建一个单一的data.frame
。files <- list.files() lst <- lapply(files, read.csv, header=TRUE, stringsAsFactors=FALSE) v1 <- sub('\\..*', '', files) v2 <- sub('.*\\.(.*)\\.csv', '\\1', files) d1 <- do.call(rbind, Map(cbind, lst, Site=v1, Treatment= v2))
Assuming that the files are in the working directory, we list the files with
list.files()
, read those into alist
by looping withlapply
, extract the prefix ('Site1', 'Site2'), the middle part ('Treatment', 'NoTreatment') usingsub
, useMap
to create the columns 'Site' and 'Treatment' in eachlist
elements and thenrbind
to create a singledata.frame
.files <- list.files() lst <- lapply(files, read.csv, header=TRUE, stringsAsFactors=FALSE) v1 <- sub('\\..*', '', files) v2 <- sub('.*\\.(.*)\\.csv', '\\1', files) d1 <- do.call(rbind, Map(cbind, lst, Site=v1, Treatment= v2))
相关问答
更多-
如何将标识属性添加到SQL Server中的现有列(How do I add the identity property to an existing column in SQL Server)[2022-11-13]
我不相信你能做到这一点。 最好的办法是创建一个新的标识列,并使用标识插入命令复制数据(如果您确实想保留旧值)。 这里有一篇体面的文章详细描述了这个过程: http : //www.mssqltips.com/tip.asp? tip= 1397 I don't beleive you can do that. Your best bet is to create a new identity column and copy the data over using an identity insert com ... -
你可以尝试一个正常的更新 ,并只需替换问题中的列选项。 UPDATE pollData SET option2 = option2 + 1 You could try a normal UPDATE, and just replace the column option in question. UPDATE pollData SET option2 = option2 + 1
-
您需要创建一个允许您支持此功能的自定义TableModel 。 JTable只是在GUI上显示表格。 TableModel具有数据的所有业务逻辑以及每个单元应如何操作。 为此,您必须离开GUI-Builder并编写实际代码。 教程: 创建表模型 You need to make a custom TableModel that will allow you to support this functionality. JTable is just there to display the table on ...
-
import fileinput for fl, line in zip(li, fileinput.input(['a.txt'], inplace=True)): print(line.strip() + '\t' + str(fl)) import fileinput for fl, line in zip(li, fileinput.input(['a.txt'], inplace=True)): print(line.strip() + '\t' + str(fl))
-
尝试 [fid2,m] = fopen( 'r1.txt', 'a+' ); 然后检查m的内容 try [fid2,m] = fopen( 'r1.txt', 'a+' ); then check the content of m
-
你需要一个自定义模块: 注册您的模块: app/etc/modules/Dropdown_Layout.xml 并插入
true local ... -
假设文件在工作目录中,我们用list.files()列出文件,通过list.files()循环读取它们,提取前缀('Site1','Site2'),中间部分('处理','NoTreatment')使用sub ,使用Map在每个list元素中创建列'Site'和'Treatment',然后rbind创建一个单一的data.frame 。 files <- list.files() lst <- lapply(files, read.csv, header=TRUE, stringsAsFactors=FALS ...
-
private ImageIcon[] grasslevels = new ImageIcon[42]; for (int i = 0; i < grasslevels.length; ++i) { grasslevels[i] = new ImageIcon("/home/vishnu/workspace/game/bin/grasslevel" + i + ".png"); } JButton k = new JButton(""); k.setIcon(grasslevels[ ...
-
如何使用python将列添加到现有excel文件?(How do I add a column to an existing excel file using python?)[2022-08-18]
使用Pandas包更容易 import pandas as pd file_name = #Path to your file df = pd.read_excel(file_name) #Read Excel file as a DataFrame df['Ratio'] = df['Gamma']/df['Theta'] #Display top 5 rows to check if everything looks good df.head(5) #To save it back as Excel ... -
有几种方法,但它们都是从增加DATABASE_NEW_VERSION开始的。 然后,在版本低于DATABASE_NEW_VERSION指定版本的设备上调用onUpgrade()方法。 如果您发现自己随着时间的推移进行了多次更改,可以通过查看传递给此方法的oldVersion来检查设备是否是多个版本。 通用解决方案(如果您开始重命名表,列并通常重新映射数据)只是从数据库/表中读取“旧数据”并将其存储在ArrayList等中。然后DROP旧表, CREATE新表(s) ),然后INSERT数据。 但是,如果您只 ...